minitest 5.25.1 → 5.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +76 -0
- data/README.rdoc +25 -15
- data/Rakefile +18 -2
- data/design_rationale.rb +21 -19
- data/lib/hoe/minitest.rb +2 -1
- data/lib/minitest/assertions.rb +21 -26
- data/lib/minitest/autorun.rb +4 -4
- data/lib/minitest/benchmark.rb +2 -2
- data/lib/minitest/expectations.rb +2 -2
- data/lib/minitest/hell.rb +1 -1
- data/lib/minitest/manual_plugins.rb +1 -1
- data/lib/minitest/mock.rb +27 -29
- data/lib/minitest/parallel.rb +2 -0
- data/lib/minitest/pride.rb +1 -1
- data/lib/minitest/pride_plugin.rb +2 -2
- data/lib/minitest/spec.rb +17 -13
- data/lib/minitest/test.rb +5 -4
- data/lib/minitest/test_task.rb +28 -11
- data/lib/minitest/unit.rb +1 -1
- data/lib/minitest.rb +50 -34
- data/test/minitest/test_minitest_assertions.rb +19 -62
- data/test/minitest/test_minitest_mock.rb +77 -15
- data/test/minitest/test_minitest_reporter.rb +17 -16
- data/test/minitest/test_minitest_spec.rb +42 -28
- data/test/minitest/test_minitest_test.rb +20 -2
- data.tar.gz.sig +0 -0
- metadata +32 -22
- metadata.gz.sig +3 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require "minitest/autorun"
|
|
2
|
-
|
|
2
|
+
require_relative "metametameta"
|
|
3
3
|
require "forwardable"
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class FakeTest < Minitest::Test
|
|
6
6
|
def woot
|
|
7
7
|
assert true
|
|
8
8
|
end
|
|
@@ -29,11 +29,12 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
29
29
|
super
|
|
30
30
|
self.io = StringIO.new(+"")
|
|
31
31
|
self.r = new_composite_reporter
|
|
32
|
+
@et = @ft = @pt = @st = @sse = nil
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def error_test
|
|
35
|
-
unless
|
|
36
|
-
@et =
|
|
36
|
+
unless @et then
|
|
37
|
+
@et = FakeTest.new :woot
|
|
37
38
|
@et.failures << Minitest::UnexpectedError.new(begin
|
|
38
39
|
raise "no"
|
|
39
40
|
rescue => e
|
|
@@ -45,7 +46,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
def system_stack_error_test
|
|
48
|
-
unless
|
|
49
|
+
unless @sse then
|
|
49
50
|
|
|
50
51
|
ex = SystemStackError.new
|
|
51
52
|
|
|
@@ -56,7 +57,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
56
57
|
|
|
57
58
|
ex.set_backtrace ary
|
|
58
59
|
|
|
59
|
-
@sse =
|
|
60
|
+
@sse = FakeTest.new :woot
|
|
60
61
|
@sse.failures << Minitest::UnexpectedError.new(ex)
|
|
61
62
|
@sse = Minitest::Result.from @sse
|
|
62
63
|
end
|
|
@@ -64,8 +65,8 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
def fail_test
|
|
67
|
-
unless
|
|
68
|
-
@ft =
|
|
68
|
+
unless @ft then
|
|
69
|
+
@ft = FakeTest.new :woot
|
|
69
70
|
@ft.failures << begin
|
|
70
71
|
raise Minitest::Assertion, "boo"
|
|
71
72
|
rescue Minitest::Assertion => e
|
|
@@ -77,18 +78,18 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
def passing_test
|
|
80
|
-
@pt ||= Minitest::Result.from
|
|
81
|
+
@pt ||= Minitest::Result.from FakeTest.new(:woot)
|
|
81
82
|
end
|
|
82
83
|
|
|
83
84
|
def passing_test_with_metadata
|
|
84
|
-
test =
|
|
85
|
+
test = FakeTest.new :woot
|
|
85
86
|
test.metadata[:meta] = :data
|
|
86
87
|
@pt ||= Minitest::Result.from test
|
|
87
88
|
end
|
|
88
89
|
|
|
89
90
|
def skip_test
|
|
90
|
-
unless
|
|
91
|
-
@st =
|
|
91
|
+
unless @st then
|
|
92
|
+
@st = FakeTest.new :woot
|
|
92
93
|
@st.failures << begin
|
|
93
94
|
raise Minitest::Skip
|
|
94
95
|
rescue Minitest::Assertion => e
|
|
@@ -294,7 +295,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
294
295
|
Finished in 0.00
|
|
295
296
|
|
|
296
297
|
1) Failure:
|
|
297
|
-
|
|
298
|
+
FakeTest#woot [FILE:LINE]:
|
|
298
299
|
boo
|
|
299
300
|
|
|
300
301
|
1 runs, 0 assertions, 1 failures, 0 errors, 0 skips
|
|
@@ -318,7 +319,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
318
319
|
Finished in 0.00
|
|
319
320
|
|
|
320
321
|
1) Error:
|
|
321
|
-
|
|
322
|
+
FakeTest#woot:
|
|
322
323
|
RuntimeError: no
|
|
323
324
|
FILE:LINE:in 'error_test'
|
|
324
325
|
FILE:LINE:in 'test_report_error'
|
|
@@ -344,7 +345,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
344
345
|
Finished in 0.00
|
|
345
346
|
|
|
346
347
|
1) Error:
|
|
347
|
-
|
|
348
|
+
FakeTest#woot:
|
|
348
349
|
SystemStackError: 274 -> 12
|
|
349
350
|
a
|
|
350
351
|
b
|
|
@@ -402,7 +403,7 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
|
402
403
|
r.report
|
|
403
404
|
end
|
|
404
405
|
|
|
405
|
-
exp = "
|
|
406
|
+
exp = "FakeTest#woot [foo.rb:123]"
|
|
406
407
|
|
|
407
408
|
assert_includes io.string, exp
|
|
408
409
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative "metametameta"
|
|
2
2
|
require "stringio"
|
|
3
3
|
|
|
4
4
|
class MiniSpecA < Minitest::Spec; end
|
|
@@ -108,7 +108,7 @@ describe Minitest::Spec do
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
it "needs to catch an expected exception" do
|
|
111
|
-
@assertion_count
|
|
111
|
+
@assertion_count -= 2
|
|
112
112
|
|
|
113
113
|
expect { raise "blah" }.must_raise RuntimeError
|
|
114
114
|
expect { raise Minitest::Assertion }.must_raise Minitest::Assertion
|
|
@@ -148,25 +148,13 @@ describe Minitest::Spec do
|
|
|
148
148
|
it "needs to pattern match" do
|
|
149
149
|
@assertion_count = 1
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
expect { good_pattern }.must_pattern_match
|
|
153
|
-
else
|
|
154
|
-
assert_raises NotImplementedError do
|
|
155
|
-
expect {}.must_pattern_match
|
|
156
|
-
end
|
|
157
|
-
end
|
|
151
|
+
expect { good_pattern }.must_pattern_match
|
|
158
152
|
end
|
|
159
153
|
|
|
160
154
|
it "needs to error on bad pattern match" do
|
|
161
|
-
skip unless RUBY_VERSION > "3"
|
|
162
|
-
|
|
163
155
|
@assertion_count = 1
|
|
164
156
|
|
|
165
|
-
exp =
|
|
166
|
-
"[1, 2, 3]" # terrible error message!
|
|
167
|
-
else
|
|
168
|
-
/length mismatch/
|
|
169
|
-
end
|
|
157
|
+
exp = /length mismatch/
|
|
170
158
|
|
|
171
159
|
assert_triggered exp do
|
|
172
160
|
expect { bad_pattern }.must_pattern_match
|
|
@@ -212,9 +200,10 @@ describe Minitest::Spec do
|
|
|
212
200
|
must_raise
|
|
213
201
|
must_respond_to
|
|
214
202
|
must_throw
|
|
203
|
+
must_verify
|
|
215
204
|
path_must_exist]
|
|
216
205
|
|
|
217
|
-
bad = %w[not raise throw send output be_silent]
|
|
206
|
+
bad = %w[not raise throw send output be_silent verify]
|
|
218
207
|
|
|
219
208
|
expected_wonts = expected_musts.map { |m| m.sub("must", "wont") }.sort
|
|
220
209
|
expected_wonts.reject! { |m| m =~ /wont_#{Regexp.union(*bad)}/ }
|
|
@@ -283,7 +272,7 @@ describe Minitest::Spec do
|
|
|
283
272
|
@assertion_count = 3
|
|
284
273
|
@assertion_count += 2 unless error_on_warn? # 2 extra assertions
|
|
285
274
|
|
|
286
|
-
exp =
|
|
275
|
+
exp = /.*?test_minitest_\w+.rb:\d+: warning: DEPRECATED: Use assert_nil if expecting nil. This will fail in Minitest 6./
|
|
287
276
|
|
|
288
277
|
assert_deprecation exp do
|
|
289
278
|
assert_success _(nil).must_equal(nil)
|
|
@@ -709,8 +698,6 @@ describe Minitest::Spec do
|
|
|
709
698
|
end
|
|
710
699
|
|
|
711
700
|
describe Minitest::Spec, :let do
|
|
712
|
-
i_suck_and_my_tests_are_order_dependent!
|
|
713
|
-
|
|
714
701
|
def _count
|
|
715
702
|
$let_count ||= 0
|
|
716
703
|
end
|
|
@@ -721,21 +708,21 @@ describe Minitest::Spec, :let do
|
|
|
721
708
|
end
|
|
722
709
|
|
|
723
710
|
it "is evaluated once per example" do
|
|
724
|
-
|
|
711
|
+
exp = _count + 1
|
|
725
712
|
|
|
726
|
-
_(count).must_equal
|
|
727
|
-
_(count).must_equal
|
|
713
|
+
_(count).must_equal exp
|
|
714
|
+
_(count).must_equal exp
|
|
728
715
|
|
|
729
|
-
_(_count).must_equal
|
|
716
|
+
_(_count).must_equal exp
|
|
730
717
|
end
|
|
731
718
|
|
|
732
719
|
it "is REALLY evaluated once per example" do
|
|
733
|
-
|
|
720
|
+
exp = _count + 1
|
|
734
721
|
|
|
735
|
-
_(count).must_equal
|
|
736
|
-
_(count).must_equal
|
|
722
|
+
_(count).must_equal exp
|
|
723
|
+
_(count).must_equal exp
|
|
737
724
|
|
|
738
|
-
_(_count).must_equal
|
|
725
|
+
_(_count).must_equal exp
|
|
739
726
|
end
|
|
740
727
|
|
|
741
728
|
it 'raises an error if the name begins with "test"' do
|
|
@@ -940,6 +927,16 @@ class TestMeta < MetaMetaMetaTestCase
|
|
|
940
927
|
assert_equal "ExampleB::random_method::addl_context", spec_c.name
|
|
941
928
|
end
|
|
942
929
|
|
|
930
|
+
def test_inspect
|
|
931
|
+
spec_a = describe ExampleA do; end
|
|
932
|
+
spec_b = describe ExampleB, :random_method do; end
|
|
933
|
+
spec_c = describe ExampleB, :random_method, :addl_context do; end
|
|
934
|
+
|
|
935
|
+
assert_equal "ExampleA", spec_a.inspect
|
|
936
|
+
assert_equal "ExampleB::random_method", spec_b.inspect
|
|
937
|
+
assert_equal "ExampleB::random_method::addl_context", spec_c.inspect
|
|
938
|
+
end
|
|
939
|
+
|
|
943
940
|
def test_name2
|
|
944
941
|
assert_equal "NamedExampleA", NamedExampleA.name
|
|
945
942
|
assert_equal "NamedExampleB", NamedExampleB.name
|
|
@@ -952,6 +949,23 @@ class TestMeta < MetaMetaMetaTestCase
|
|
|
952
949
|
assert_equal "ExampleB::random_method", spec_b.name
|
|
953
950
|
end
|
|
954
951
|
|
|
952
|
+
def test_name_inside_class
|
|
953
|
+
spec_a = nil
|
|
954
|
+
spec_b = nil
|
|
955
|
+
inside_class_example = Class.new Minitest::Spec
|
|
956
|
+
Object.const_set :InsideClassExample, inside_class_example
|
|
957
|
+
inside_class_example.class_eval do
|
|
958
|
+
spec_a = describe "a" do
|
|
959
|
+
spec_b = describe "b" do; end
|
|
960
|
+
end
|
|
961
|
+
end
|
|
962
|
+
|
|
963
|
+
assert_equal "InsideClassExample::a", spec_a.name
|
|
964
|
+
assert_equal "InsideClassExample::a::b", spec_b.name
|
|
965
|
+
ensure
|
|
966
|
+
Object.send :remove_const, :InsideClassExample
|
|
967
|
+
end
|
|
968
|
+
|
|
955
969
|
def test_structure
|
|
956
970
|
x, y, z, * = util_structure
|
|
957
971
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative "metametameta"
|
|
2
2
|
|
|
3
3
|
e = Encoding.default_external
|
|
4
4
|
if e != Encoding::UTF_8 then
|
|
@@ -157,6 +157,24 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
|
157
157
|
refute_predicate test, :skipped?
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
+
def test_skipped_is_reachable
|
|
161
|
+
test_class = Class.new FakeNamedTest do
|
|
162
|
+
def test_omg
|
|
163
|
+
skip
|
|
164
|
+
ensure
|
|
165
|
+
flunk unless skipped?
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
test = test_class.new :test_omg
|
|
170
|
+
test.run
|
|
171
|
+
|
|
172
|
+
refute_predicate test, :error?
|
|
173
|
+
refute_predicate test, :passed?
|
|
174
|
+
|
|
175
|
+
assert_predicate test, :skipped?
|
|
176
|
+
end
|
|
177
|
+
|
|
160
178
|
def util_expand_bt bt
|
|
161
179
|
bt.map { |f| f.start_with?(".") ? File.expand_path(f) : f }
|
|
162
180
|
end
|
|
@@ -644,7 +662,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
644
662
|
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
|
|
645
663
|
EOM
|
|
646
664
|
|
|
647
|
-
skip
|
|
665
|
+
skip unless Minitest.parallel_executor # locks up test runner if 1 CPU
|
|
648
666
|
|
|
649
667
|
assert_report expected do |reporter|
|
|
650
668
|
reporter.extend Module.new {
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minitest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.27.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain:
|
|
11
10
|
- |
|
|
12
11
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
12
|
+
MIIDPjCCAiagAwIBAgIBCTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
|
14
13
|
ZC1ydWJ5MRkwFwYKCZImi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|
|
31
30
|
-----END CERTIFICATE-----
|
|
32
|
-
date:
|
|
31
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
33
32
|
dependencies:
|
|
34
33
|
- !ruby/object:Gem::Dependency
|
|
35
34
|
name: rdoc
|
|
@@ -57,14 +56,14 @@ dependencies:
|
|
|
57
56
|
requirements:
|
|
58
57
|
- - "~>"
|
|
59
58
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '4.
|
|
59
|
+
version: '4.3'
|
|
61
60
|
type: :development
|
|
62
61
|
prerelease: false
|
|
63
62
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
63
|
requirements:
|
|
65
64
|
- - "~>"
|
|
66
65
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '4.
|
|
66
|
+
version: '4.3'
|
|
68
67
|
description: |-
|
|
69
68
|
minitest provides a complete suite of testing facilities supporting
|
|
70
69
|
TDD, BDD, mocking, and benchmarking.
|
|
@@ -160,14 +159,29 @@ files:
|
|
|
160
159
|
- test/minitest/test_minitest_spec.rb
|
|
161
160
|
- test/minitest/test_minitest_test.rb
|
|
162
161
|
- test/minitest/test_minitest_test_task.rb
|
|
163
|
-
homepage: https://
|
|
162
|
+
homepage: https://minite.st/
|
|
164
163
|
licenses:
|
|
165
164
|
- MIT
|
|
166
165
|
metadata:
|
|
167
|
-
homepage_uri: https://
|
|
166
|
+
homepage_uri: https://minite.st/
|
|
167
|
+
source_code_uri: https://github.com/minitest/minitest
|
|
168
168
|
bug_tracker_uri: https://github.com/minitest/minitest/issues
|
|
169
169
|
changelog_uri: https://github.com/minitest/minitest/blob/master/History.rdoc
|
|
170
|
-
post_install_message:
|
|
170
|
+
post_install_message: |
|
|
171
|
+
NOTE: minitest 5 will be the last in the minitest family to support
|
|
172
|
+
ruby 1.8 to 2.7. If you need to keep using these versions,
|
|
173
|
+
you need to pin your dependency to minitest with something
|
|
174
|
+
like "~> 5.0". See History.rdoc to locate compatible
|
|
175
|
+
versions.
|
|
176
|
+
|
|
177
|
+
Further, minitest 6 will be dropping the following:
|
|
178
|
+
|
|
179
|
+
+ MiniTest (it's been Minitest for >10 years)
|
|
180
|
+
+ MiniTest::Unit
|
|
181
|
+
+ MiniTest::Unit::TestCase
|
|
182
|
+
+ assert_send (unless you argue for it well)
|
|
183
|
+
+ assert_equal nil, obj
|
|
184
|
+
+ mocks and stubs: moving minitest/mock.rb to its own gem
|
|
171
185
|
rdoc_options:
|
|
172
186
|
- "--main"
|
|
173
187
|
- README.rdoc
|
|
@@ -177,18 +191,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
177
191
|
requirements:
|
|
178
192
|
- - ">="
|
|
179
193
|
- !ruby/object:Gem::Version
|
|
180
|
-
version: '
|
|
181
|
-
- - "<"
|
|
182
|
-
- !ruby/object:Gem::Version
|
|
183
|
-
version: '4.0'
|
|
194
|
+
version: '3.1'
|
|
184
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
196
|
requirements:
|
|
186
197
|
- - ">="
|
|
187
198
|
- !ruby/object:Gem::Version
|
|
188
199
|
version: '0'
|
|
189
200
|
requirements: []
|
|
190
|
-
rubygems_version: 3.
|
|
191
|
-
signing_key:
|
|
201
|
+
rubygems_version: 3.7.2
|
|
192
202
|
specification_version: 4
|
|
193
203
|
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
|
194
204
|
BDD, mocking, and benchmarking
|
metadata.gz.sig
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
�&#��T�d���p�V ��M����F�e��s�������Έ�&o��5Eȿ3He��Ǘ�t�>h�E!�1W;rl��}�Y�f
|
|
2
|
+
��J�;�&��'*pU�'��
|
|
3
|
+
������8�b�Q6��-p����N5-4�=��L5�{#�a[�&��*����|�1��,���y˰p 2*`�Aӊ���Rf�N
|