minitest 2.11.4 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +13 -0
- data/lib/minitest/spec.rb +2 -0
- data/lib/minitest/unit.rb +29 -1
- data/test/test_minitest_spec.rb +7 -4
- data/test/test_minitest_unit.rb +43 -9
- metadata +6 -6
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 2.12.0 / 2012-04-03
|
2
|
+
|
3
|
+
* 4 minor enhancements:
|
4
|
+
|
5
|
+
* ::it returns test method name (wojtekmach)
|
6
|
+
* Added #record method to runner so runner subclasses can cleanly gather data.
|
7
|
+
* Added Minitest alias for MiniTest because even I forget.
|
8
|
+
* Deprecated assert_block!! Yay!!!
|
9
|
+
|
10
|
+
* 1 bug fix:
|
11
|
+
|
12
|
+
* Fixed warning in i_suck_and_my_tests_are_order_dependent! (phiggins)
|
13
|
+
|
1
14
|
=== 2.11.4 / 2012-03-20
|
2
15
|
|
3
16
|
* 2 minor enhancements:
|
data/lib/minitest/spec.rb
CHANGED
data/lib/minitest/unit.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'optparse'
|
2
2
|
require 'rbconfig'
|
3
|
+
require 'rubygems/deprecate'
|
3
4
|
|
4
5
|
##
|
5
6
|
# Minimal (mostly drop-in) replacement for test-unit.
|
@@ -641,10 +642,13 @@ module MiniTest
|
|
641
642
|
msg ||= "Skipped, no message given"
|
642
643
|
raise MiniTest::Skip, msg, bt
|
643
644
|
end
|
645
|
+
|
646
|
+
extend Gem::Deprecate
|
647
|
+
deprecate :assert_block, :assert, 2012, 9
|
644
648
|
end
|
645
649
|
|
646
650
|
class Unit # :nodoc:
|
647
|
-
VERSION = "2.
|
651
|
+
VERSION = "2.12.0" # :nodoc:
|
648
652
|
|
649
653
|
attr_accessor :report, :failures, :errors, :skips # :nodoc:
|
650
654
|
attr_accessor :test_count, :assertion_count # :nodoc:
|
@@ -652,6 +656,7 @@ module MiniTest
|
|
652
656
|
attr_accessor :help # :nodoc:
|
653
657
|
attr_accessor :verbose # :nodoc:
|
654
658
|
attr_writer :options # :nodoc:
|
659
|
+
attr_accessor :last_error # :nodoc:
|
655
660
|
|
656
661
|
##
|
657
662
|
# Lazy accessor for options.
|
@@ -827,9 +832,12 @@ module MiniTest
|
|
827
832
|
print "#{suite}##{method} = " if @verbose
|
828
833
|
|
829
834
|
@start_time = Time.now
|
835
|
+
self.last_error = nil
|
830
836
|
result = inst.run self
|
831
837
|
time = Time.now - @start_time
|
832
838
|
|
839
|
+
record suite, method, inst._assertions, time, last_error
|
840
|
+
|
833
841
|
print "%.2f s = " % time if @verbose
|
834
842
|
print result
|
835
843
|
puts if @verbose
|
@@ -840,6 +848,21 @@ module MiniTest
|
|
840
848
|
return assertions.size, assertions.inject(0) { |sum, n| sum + n }
|
841
849
|
end
|
842
850
|
|
851
|
+
##
|
852
|
+
# Record the result of a single run. Makes it very easy to gather
|
853
|
+
# information. Eg:
|
854
|
+
#
|
855
|
+
# class StatisticsRecorder < MiniTest::Unit
|
856
|
+
# def record suite, method, assertions, time, error
|
857
|
+
# # ... record the results somewhere ...
|
858
|
+
# end
|
859
|
+
# end
|
860
|
+
#
|
861
|
+
# MiniTest::Unit.runner = StatisticsRecorder.new
|
862
|
+
|
863
|
+
def record suite, method, assertions, time, error
|
864
|
+
end
|
865
|
+
|
843
866
|
def location e # :nodoc:
|
844
867
|
last_before_assertion = ""
|
845
868
|
e.backtrace.reverse_each do |s|
|
@@ -854,6 +877,7 @@ module MiniTest
|
|
854
877
|
# exception +e+
|
855
878
|
|
856
879
|
def puke klass, meth, e
|
880
|
+
self.last_error = e
|
857
881
|
e = case e
|
858
882
|
when MiniTest::Skip then
|
859
883
|
@skips += 1
|
@@ -875,6 +899,7 @@ module MiniTest
|
|
875
899
|
@report = []
|
876
900
|
@errors = @failures = @skips = 0
|
877
901
|
@verbose = false
|
902
|
+
self.last_error = nil
|
878
903
|
end
|
879
904
|
|
880
905
|
def process_args args = [] # :nodoc:
|
@@ -1107,6 +1132,7 @@ module MiniTest
|
|
1107
1132
|
|
1108
1133
|
def self.i_suck_and_my_tests_are_order_dependent!
|
1109
1134
|
class << self
|
1135
|
+
undef_method :test_order if method_defined? :test_order
|
1110
1136
|
define_method :test_order do :alpha end
|
1111
1137
|
end
|
1112
1138
|
end
|
@@ -1288,6 +1314,8 @@ module MiniTest
|
|
1288
1314
|
end # class Unit
|
1289
1315
|
end # module MiniTest
|
1290
1316
|
|
1317
|
+
Minitest = MiniTest # because ugh... I typo this all the time
|
1318
|
+
|
1291
1319
|
if $DEBUG then
|
1292
1320
|
module Test # :nodoc:
|
1293
1321
|
module Unit # :nodoc:
|
data/test/test_minitest_spec.rb
CHANGED
@@ -679,17 +679,20 @@ class TestMeta < MiniTest::Unit::TestCase
|
|
679
679
|
end
|
680
680
|
|
681
681
|
def test_describe_first_structure
|
682
|
-
x = y = z = nil
|
682
|
+
x = x1 = x2 = y = z = nil
|
683
683
|
x = describe "top-level thingy" do
|
684
684
|
y = describe "first thingy" do end
|
685
685
|
|
686
|
-
it "top-level-it" do end
|
687
|
-
it "не латинские буквы-и-спецсимволы&いった α, β, γ, δ, ε hello!!! world" do end
|
686
|
+
x1 = it "top-level-it" do end
|
687
|
+
x2 = it "не латинские буквы-и-спецсимволы&いった α, β, γ, δ, ε hello!!! world" do end
|
688
688
|
|
689
689
|
z = describe "second thingy" do end
|
690
690
|
end
|
691
691
|
|
692
|
-
|
692
|
+
test_methods = ['test_0001_top_level_it', 'test_0002_не_латинские_буквы_и_спецсимволы_いった_α_β_γ_δ_ε_hello_world'].sort
|
693
|
+
|
694
|
+
assert_equal test_methods, [x1, x2]
|
695
|
+
assert_equal test_methods,
|
693
696
|
x.instance_methods.grep(/^test/).map {|o| o.to_s}.sort
|
694
697
|
assert_equal [], y.instance_methods.grep(/^test/)
|
695
698
|
assert_equal [], z.instance_methods.grep(/^test/)
|
data/test/test_minitest_unit.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'test/metametameta'
|
3
|
+
require 'rubygems/deprecate'
|
3
4
|
|
4
5
|
module MyModule; end
|
5
6
|
class AnError < StandardError; include MyModule; end
|
@@ -697,16 +698,22 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
|
697
698
|
end
|
698
699
|
end
|
699
700
|
|
701
|
+
include Gem::Deprecate
|
702
|
+
|
700
703
|
def test_assert_block
|
701
|
-
|
702
|
-
|
704
|
+
skip_during do
|
705
|
+
@tc.assert_block do
|
706
|
+
true
|
707
|
+
end
|
703
708
|
end
|
704
709
|
end
|
705
710
|
|
706
711
|
def test_assert_block_triggered
|
707
|
-
|
708
|
-
|
709
|
-
|
712
|
+
skip_during do
|
713
|
+
util_assert_triggered "blah.\nExpected block to return true value." do
|
714
|
+
@tc.assert_block "blah" do
|
715
|
+
false
|
716
|
+
end
|
710
717
|
end
|
711
718
|
end
|
712
719
|
end
|
@@ -1272,10 +1279,15 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
|
|
1272
1279
|
methods = MiniTest::Assertions.public_instance_methods
|
1273
1280
|
methods.map! { |m| m.to_s } if Symbol === methods.first
|
1274
1281
|
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1282
|
+
# These don't have corresponding refutes _on purpose_. They're
|
1283
|
+
# useless and will never be added, so don't bother.
|
1284
|
+
ignores = %w[assert_block assert_output assert_raises assert_send
|
1285
|
+
assert_silent assert_throws]
|
1286
|
+
|
1287
|
+
# These are test/unit methods. I'm not actually sure why they're still here
|
1288
|
+
ignores += %w[assert_no_match assert_not_equal assert_not_nil
|
1289
|
+
assert_not_same assert_nothing_raised
|
1290
|
+
assert_nothing_thrown assert_raise]
|
1279
1291
|
|
1280
1292
|
asserts = methods.grep(/^assert/).sort - ignores
|
1281
1293
|
refutes = methods.grep(/^refute/).sort - ignores
|
@@ -1559,6 +1571,28 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
|
|
1559
1571
|
assert_equal expected, sample_test_case.test_methods
|
1560
1572
|
end
|
1561
1573
|
|
1574
|
+
def test_i_suck_and_my_tests_are_order_dependent_bang_sets_test_order_alpha
|
1575
|
+
@assertion_count = 0
|
1576
|
+
|
1577
|
+
shitty_test_case = Class.new MiniTest::Unit::TestCase
|
1578
|
+
|
1579
|
+
shitty_test_case.i_suck_and_my_tests_are_order_dependent!
|
1580
|
+
|
1581
|
+
assert_equal :alpha, shitty_test_case.test_order
|
1582
|
+
end
|
1583
|
+
|
1584
|
+
def test_i_suck_and_my_tests_are_order_dependent_bang_does_not_warn
|
1585
|
+
@assertion_count = 0
|
1586
|
+
|
1587
|
+
shitty_test_case = Class.new MiniTest::Unit::TestCase
|
1588
|
+
|
1589
|
+
def shitty_test_case.test_order ; :lol end
|
1590
|
+
|
1591
|
+
assert_silent do
|
1592
|
+
shitty_test_case.i_suck_and_my_tests_are_order_dependent!
|
1593
|
+
end
|
1594
|
+
end
|
1595
|
+
|
1562
1596
|
def util_assert_triggered expected, klass = MiniTest::Assertion
|
1563
1597
|
e = assert_raises(klass) do
|
1564
1598
|
yield
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 12
|
9
|
+
- 0
|
10
|
+
version: 2.12.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2012-
|
39
|
+
date: 2012-04-04 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
requirements: []
|
172
172
|
|
173
173
|
rubyforge_project: bfts
|
174
|
-
rubygems_version: 1.8.
|
174
|
+
rubygems_version: 1.8.12
|
175
175
|
signing_key:
|
176
176
|
specification_version: 3
|
177
177
|
summary: minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking
|
metadata.gz.sig
CHANGED
Binary file
|