minitest 5.15.0 → 5.16.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 +27 -0
- data/Manifest.txt +2 -0
- data/README.rdoc +40 -10
- data/Rakefile +1 -1
- data/lib/minitest/assertions.rb +2 -0
- data/lib/minitest/benchmark.rb +5 -5
- data/lib/minitest/mock.rb +76 -29
- data/lib/minitest/pride_plugin.rb +1 -1
- data/lib/minitest/spec.rb +1 -1
- data/lib/minitest/test.rb +21 -6
- data/lib/minitest/test_task.rb +305 -0
- data/lib/minitest/unit.rb +5 -8
- data/lib/minitest.rb +30 -13
- data/test/minitest/metametameta.rb +1 -1
- data/test/minitest/test_minitest_assertions.rb +10 -7
- data/test/minitest/test_minitest_benchmark.rb +2 -2
- data/test/minitest/test_minitest_mock.rb +161 -4
- data/test/minitest/test_minitest_reporter.rb +1 -0
- data/test/minitest/test_minitest_spec.rb +22 -14
- data/test/minitest/test_minitest_test.rb +96 -23
- data/test/minitest/test_minitest_test_task.rb +46 -0
- data.tar.gz.sig +0 -0
- metadata +16 -14
- metadata.gz.sig +0 -0
@@ -51,7 +51,7 @@ class TestMinitestMock < Minitest::Test
|
|
51
51
|
@mock.sum
|
52
52
|
end
|
53
53
|
|
54
|
-
assert_equal "mocked method :sum expects 2 arguments, got
|
54
|
+
assert_equal "mocked method :sum expects 2 arguments, got []", e.message
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_return_mock_does_not_raise
|
@@ -210,7 +210,7 @@ class TestMinitestMock < Minitest::Test
|
|
210
210
|
mock.a
|
211
211
|
end
|
212
212
|
|
213
|
-
assert_equal "No more expects available for :a: []", e.message
|
213
|
+
assert_equal "No more expects available for :a: [] {}", e.message
|
214
214
|
end
|
215
215
|
|
216
216
|
def test_same_method_expects_are_verified_when_all_called
|
@@ -252,6 +252,21 @@ class TestMinitestMock < Minitest::Test
|
|
252
252
|
assert_equal exp, e.message
|
253
253
|
end
|
254
254
|
|
255
|
+
def test_handles_kwargs_in_error_message
|
256
|
+
mock = Minitest::Mock.new
|
257
|
+
|
258
|
+
mock.expect :foo, nil, [], kw: true
|
259
|
+
mock.expect :foo, nil, [], kw: false
|
260
|
+
|
261
|
+
mock.foo kw: true
|
262
|
+
|
263
|
+
e = assert_raises(MockExpectationError) { mock.verify }
|
264
|
+
|
265
|
+
exp = "expected foo(:kw=>false) => nil, got [foo(:kw=>true) => nil]"
|
266
|
+
|
267
|
+
assert_equal exp, e.message
|
268
|
+
end
|
269
|
+
|
255
270
|
def test_verify_passes_when_mock_block_returns_true
|
256
271
|
mock = Minitest::Mock.new
|
257
272
|
mock.expect :foo, nil do
|
@@ -270,11 +285,133 @@ class TestMinitestMock < Minitest::Test
|
|
270
285
|
a1 == arg1 && a2 == arg2 && a3 == arg3
|
271
286
|
end
|
272
287
|
|
273
|
-
|
288
|
+
assert_silent do
|
289
|
+
if RUBY_VERSION > "3" then
|
290
|
+
mock.foo arg1, arg2, arg3
|
291
|
+
else
|
292
|
+
mock.foo arg1, arg2, **arg3 # oddity just for ruby 2.7
|
293
|
+
end
|
294
|
+
end
|
274
295
|
|
275
296
|
assert_mock mock
|
276
297
|
end
|
277
298
|
|
299
|
+
def test_mock_block_is_passed_keyword_args__block
|
300
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
301
|
+
mock = Minitest::Mock.new
|
302
|
+
mock.expect :foo, nil do |k1:, k2:, k3:|
|
303
|
+
k1 == arg1 && k2 == arg2 && k3 == arg3
|
304
|
+
end
|
305
|
+
|
306
|
+
mock.foo(k1: arg1, k2: arg2, k3: arg3)
|
307
|
+
|
308
|
+
assert_mock mock
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_mock_block_is_passed_keyword_args__block_bad_missing
|
312
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
313
|
+
mock = Minitest::Mock.new
|
314
|
+
mock.expect :foo, nil do |k1:, k2:, k3:|
|
315
|
+
k1 == arg1 && k2 == arg2 && k3 == arg3
|
316
|
+
end
|
317
|
+
|
318
|
+
e = assert_raises ArgumentError do
|
319
|
+
mock.foo(k1: arg1, k2: arg2)
|
320
|
+
end
|
321
|
+
|
322
|
+
# basically testing ruby ... need ? for ruby < 2.7 :(
|
323
|
+
assert_match(/missing keyword: :?k3/, e.message)
|
324
|
+
end
|
325
|
+
|
326
|
+
def test_mock_block_is_passed_keyword_args__block_bad_extra
|
327
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
328
|
+
mock = Minitest::Mock.new
|
329
|
+
mock.expect :foo, nil do |k1:, k2:|
|
330
|
+
k1 == arg1 && k2 == arg2 && k3 == arg3
|
331
|
+
end
|
332
|
+
|
333
|
+
e = assert_raises ArgumentError do
|
334
|
+
mock.foo(k1: arg1, k2: arg2, k3: arg3)
|
335
|
+
end
|
336
|
+
|
337
|
+
# basically testing ruby ... need ? for ruby < 2.7 :(
|
338
|
+
assert_match(/unknown keyword: :?k3/, e.message)
|
339
|
+
end
|
340
|
+
|
341
|
+
def test_mock_block_is_passed_keyword_args__block_bad_value
|
342
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
343
|
+
mock = Minitest::Mock.new
|
344
|
+
mock.expect :foo, nil do |k1:, k2:, k3:|
|
345
|
+
k1 == arg1 && k2 == arg2 && k3 == arg3
|
346
|
+
end
|
347
|
+
|
348
|
+
e = assert_raises MockExpectationError do
|
349
|
+
mock.foo(k1: arg1, k2: arg2, k3: :BAD!)
|
350
|
+
end
|
351
|
+
|
352
|
+
exp = "mocked method :foo failed block w/ [] {:k1=>:bar, :k2=>[1, 2, 3], :k3=>:BAD!}"
|
353
|
+
assert_equal exp, e.message
|
354
|
+
end
|
355
|
+
|
356
|
+
def test_mock_block_is_passed_keyword_args__args
|
357
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
358
|
+
mock = Minitest::Mock.new
|
359
|
+
mock.expect :foo, nil, k1: arg1, k2: arg2, k3: arg3
|
360
|
+
|
361
|
+
mock.foo(k1: arg1, k2: arg2, k3: arg3)
|
362
|
+
|
363
|
+
assert_mock mock
|
364
|
+
end
|
365
|
+
|
366
|
+
def test_mock_block_is_passed_keyword_args__args_bad_missing
|
367
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
368
|
+
mock = Minitest::Mock.new
|
369
|
+
mock.expect :foo, nil, k1: arg1, k2: arg2, k3: arg3
|
370
|
+
|
371
|
+
e = assert_raises ArgumentError do
|
372
|
+
mock.foo(k1: arg1, k2: arg2)
|
373
|
+
end
|
374
|
+
|
375
|
+
assert_equal "mocked method :foo expects 3 keyword arguments, got %p" % {k1: arg1, k2: arg2}, e.message
|
376
|
+
end
|
377
|
+
|
378
|
+
def test_mock_block_is_passed_keyword_args__args_bad_extra
|
379
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
380
|
+
mock = Minitest::Mock.new
|
381
|
+
mock.expect :foo, nil, k1: arg1, k2: arg2
|
382
|
+
|
383
|
+
e = assert_raises ArgumentError do
|
384
|
+
mock.foo(k1: arg1, k2: arg2, k3: arg3)
|
385
|
+
end
|
386
|
+
|
387
|
+
assert_equal "mocked method :foo expects 2 keyword arguments, got %p" % {k1: arg1, k2: arg2, k3: arg3}, e.message
|
388
|
+
end
|
389
|
+
|
390
|
+
def test_mock_block_is_passed_keyword_args__args_bad_key
|
391
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
392
|
+
mock = Minitest::Mock.new
|
393
|
+
mock.expect :foo, nil, k1: arg1, k2: arg2, k3: arg3
|
394
|
+
|
395
|
+
e = assert_raises MockExpectationError do
|
396
|
+
mock.foo(k1: arg1, k2: arg2, BAD: arg3)
|
397
|
+
end
|
398
|
+
|
399
|
+
assert_includes e.message, "unexpected keywords [:k1, :k2, :k3]"
|
400
|
+
assert_includes e.message, "vs [:k1, :k2, :BAD]"
|
401
|
+
end
|
402
|
+
|
403
|
+
def test_mock_block_is_passed_keyword_args__args_bad_val
|
404
|
+
arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
|
405
|
+
mock = Minitest::Mock.new
|
406
|
+
mock.expect :foo, nil, k1: arg1, k2: arg2, k3: arg3
|
407
|
+
|
408
|
+
e = assert_raises MockExpectationError do
|
409
|
+
mock.foo(k1: arg1, k2: :BAD!, k3: arg3)
|
410
|
+
end
|
411
|
+
|
412
|
+
assert_match(/unexpected keyword arguments.* vs .*:k2=>:BAD!/, e.message)
|
413
|
+
end
|
414
|
+
|
278
415
|
def test_mock_block_is_passed_function_block
|
279
416
|
mock = Minitest::Mock.new
|
280
417
|
block = proc { "bar" }
|
@@ -286,6 +423,13 @@ class TestMinitestMock < Minitest::Test
|
|
286
423
|
assert_mock mock
|
287
424
|
end
|
288
425
|
|
426
|
+
def test_mock_forward_keyword_arguments
|
427
|
+
mock = Minitest::Mock.new
|
428
|
+
mock.expect(:foo, nil) { |bar:| bar == 'bar' }
|
429
|
+
mock.foo(bar: 'bar')
|
430
|
+
assert_mock mock
|
431
|
+
end
|
432
|
+
|
289
433
|
def test_verify_fails_when_mock_block_returns_false
|
290
434
|
mock = Minitest::Mock.new
|
291
435
|
mock.expect :foo, nil do
|
@@ -293,7 +437,7 @@ class TestMinitestMock < Minitest::Test
|
|
293
437
|
end
|
294
438
|
|
295
439
|
e = assert_raises(MockExpectationError) { mock.foo }
|
296
|
-
exp = "mocked method :foo failed block w/ []"
|
440
|
+
exp = "mocked method :foo failed block w/ [] {}"
|
297
441
|
|
298
442
|
assert_equal exp, e.message
|
299
443
|
end
|
@@ -519,6 +663,19 @@ class TestMinitestStub < Minitest::Test
|
|
519
663
|
@tc.assert_equal true, rs
|
520
664
|
end
|
521
665
|
|
666
|
+
def test_mock_with_yield_kwargs
|
667
|
+
mock = Minitest::Mock.new
|
668
|
+
rs = nil
|
669
|
+
|
670
|
+
File.stub :open, true, mock, kw:42 do
|
671
|
+
File.open "foo.txt", "r" do |f, kw:|
|
672
|
+
rs = kw
|
673
|
+
end
|
674
|
+
end
|
675
|
+
|
676
|
+
@tc.assert_equal 42, rs
|
677
|
+
end
|
678
|
+
|
522
679
|
alias test_stub_value__old test_stub_value # TODO: remove/rename
|
523
680
|
|
524
681
|
## Permutation Sets:
|
@@ -505,7 +505,7 @@ describe Minitest::Spec do
|
|
505
505
|
it "needs to verify regexp matches" do
|
506
506
|
@assertion_count += 3 # must_match is 2 assertions
|
507
507
|
|
508
|
-
|
508
|
+
assert_kind_of MatchData, _("blah").must_match(/\w+/)
|
509
509
|
|
510
510
|
assert_triggered "Expected /\\d+/ to match \"blah\"." do
|
511
511
|
_("blah").must_match(/\d+/)
|
@@ -744,6 +744,10 @@ describe Minitest::Spec, :subject do
|
|
744
744
|
end
|
745
745
|
|
746
746
|
class TestMetaStatic < Minitest::Test
|
747
|
+
def assert_method_count expected, klass
|
748
|
+
assert_equal expected, klass.public_instance_methods.grep(/^test_/).count
|
749
|
+
end
|
750
|
+
|
747
751
|
def test_children
|
748
752
|
Minitest::Spec.children.clear # prevents parallel run
|
749
753
|
|
@@ -777,8 +781,8 @@ class TestMetaStatic < Minitest::Test
|
|
777
781
|
end
|
778
782
|
end
|
779
783
|
|
780
|
-
|
781
|
-
|
784
|
+
assert_method_count 1, outer
|
785
|
+
assert_method_count 1, inner
|
782
786
|
end
|
783
787
|
|
784
788
|
def test_it_wont_add_test_methods_to_children
|
@@ -792,14 +796,18 @@ class TestMetaStatic < Minitest::Test
|
|
792
796
|
end
|
793
797
|
end
|
794
798
|
|
795
|
-
|
796
|
-
|
799
|
+
assert_method_count 1, outer
|
800
|
+
assert_method_count 0, inner
|
797
801
|
end
|
798
802
|
end
|
799
803
|
|
800
804
|
class TestMeta < MetaMetaMetaTestCase
|
801
805
|
# do not call parallelize_me! here because specs use register_spec_type globally
|
802
806
|
|
807
|
+
def assert_defined_methods expected, klass
|
808
|
+
assert_equal expected, klass.instance_methods(false).sort.map(&:to_s)
|
809
|
+
end
|
810
|
+
|
803
811
|
def util_structure
|
804
812
|
y = z = nil
|
805
813
|
before_list = []
|
@@ -872,7 +880,7 @@ class TestMeta < MetaMetaMetaTestCase
|
|
872
880
|
end
|
873
881
|
end
|
874
882
|
|
875
|
-
test_name = spec_class.instance_methods.sort.grep(/
|
883
|
+
test_name = spec_class.instance_methods.sort.grep(/test_/).first
|
876
884
|
|
877
885
|
spec = spec_class.new test_name
|
878
886
|
|
@@ -921,9 +929,9 @@ class TestMeta < MetaMetaMetaTestCase
|
|
921
929
|
inner_methods2 = inner_methods1 +
|
922
930
|
%w[test_0002_anonymous test_0003_anonymous]
|
923
931
|
|
924
|
-
|
925
|
-
|
926
|
-
|
932
|
+
assert_defined_methods top_methods, x
|
933
|
+
assert_defined_methods inner_methods1, y
|
934
|
+
assert_defined_methods inner_methods2, z
|
927
935
|
end
|
928
936
|
|
929
937
|
def test_structure_postfix_it
|
@@ -940,8 +948,8 @@ class TestMeta < MetaMetaMetaTestCase
|
|
940
948
|
it "inner-it" do end
|
941
949
|
end
|
942
950
|
|
943
|
-
|
944
|
-
|
951
|
+
assert_defined_methods %w[test_0001_inner-it], y
|
952
|
+
assert_defined_methods %w[test_0001_inner-it], z
|
945
953
|
end
|
946
954
|
|
947
955
|
def test_setup_teardown_behavior
|
@@ -972,9 +980,9 @@ class TestMeta < MetaMetaMetaTestCase
|
|
972
980
|
].sort
|
973
981
|
|
974
982
|
assert_equal test_methods, [x1, x2]
|
975
|
-
|
976
|
-
|
977
|
-
|
983
|
+
assert_defined_methods test_methods, x
|
984
|
+
assert_defined_methods [], y
|
985
|
+
assert_defined_methods [], z
|
978
986
|
end
|
979
987
|
|
980
988
|
def test_structure_subclasses
|
@@ -48,9 +48,11 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
48
48
|
"test/test_autotest.rb:62:in `test_add_exception'"]
|
49
49
|
ex = util_expand_bt ex
|
50
50
|
|
51
|
-
|
51
|
+
Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
|
52
|
+
fu = Minitest.filter_backtrace(bt)
|
52
53
|
|
53
|
-
|
54
|
+
assert_equal ex, fu
|
55
|
+
end
|
54
56
|
end
|
55
57
|
|
56
58
|
def test_filter_backtrace_all_unit
|
@@ -71,8 +73,10 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
71
73
|
bt = util_expand_bt bt
|
72
74
|
|
73
75
|
ex = ["-e:1"]
|
74
|
-
|
75
|
-
|
76
|
+
Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
|
77
|
+
fu = Minitest.filter_backtrace bt
|
78
|
+
assert_equal ex, fu
|
79
|
+
end
|
76
80
|
end
|
77
81
|
|
78
82
|
def test_filter_backtrace__empty
|
@@ -95,24 +99,26 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
95
99
|
end
|
96
100
|
|
97
101
|
expected = clean <<-EOM
|
98
|
-
|
102
|
+
FE
|
99
103
|
|
100
104
|
Finished in 0.00
|
101
105
|
|
102
|
-
1)
|
103
|
-
FakeNamedTestXX#test_this_is_non_ascii_failure_message:
|
104
|
-
RuntimeError: ЁЁЁ
|
105
|
-
FILE:LINE:in `test_this_is_non_ascii_failure_message'
|
106
|
-
|
107
|
-
2) Failure:
|
106
|
+
1) Failure:
|
108
107
|
FakeNamedTestXX#test_this_is_not_ascii_assertion [FILE:LINE]:
|
109
108
|
Expected: \"ЁЁЁ\"
|
110
109
|
Actual: \"ёёё\"
|
111
110
|
|
111
|
+
2) Error:
|
112
|
+
FakeNamedTestXX#test_this_is_non_ascii_failure_message:
|
113
|
+
RuntimeError: ЁЁЁ
|
114
|
+
FILE:LINE:in `test_this_is_non_ascii_failure_message'
|
115
|
+
|
112
116
|
2 runs, 1 assertions, 1 failures, 1 errors, 0 skips
|
113
117
|
EOM
|
114
118
|
|
115
|
-
|
119
|
+
Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
|
120
|
+
assert_report expected
|
121
|
+
end
|
116
122
|
end
|
117
123
|
|
118
124
|
def test_passed_eh_teardown_good
|
@@ -158,11 +164,7 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
158
164
|
end
|
159
165
|
|
160
166
|
def util_expand_bt bt
|
161
|
-
|
162
|
-
bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
|
163
|
-
else
|
164
|
-
bt
|
165
|
-
end
|
167
|
+
bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
|
166
168
|
end
|
167
169
|
end
|
168
170
|
|
@@ -254,7 +256,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
254
256
|
end
|
255
257
|
|
256
258
|
expected = clean <<-EOM
|
257
|
-
E
|
259
|
+
.E
|
258
260
|
|
259
261
|
Finished in 0.00
|
260
262
|
|
@@ -301,7 +303,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
301
303
|
setup_basic_tu
|
302
304
|
|
303
305
|
expected = clean <<-EOM
|
304
|
-
F
|
306
|
+
.F
|
305
307
|
|
306
308
|
Finished in 0.00
|
307
309
|
|
@@ -328,6 +330,10 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
328
330
|
end
|
329
331
|
end
|
330
332
|
|
333
|
+
def test_seed # this is set for THIS run, so I'm not testing it's actual value
|
334
|
+
assert_instance_of Integer, Minitest.seed
|
335
|
+
end
|
336
|
+
|
331
337
|
def test_run_failing_filtered
|
332
338
|
setup_basic_tu
|
333
339
|
|
@@ -485,7 +491,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
485
491
|
end
|
486
492
|
|
487
493
|
expected = clean <<-EOM
|
488
|
-
S
|
494
|
+
.S
|
489
495
|
|
490
496
|
Finished in 0.00
|
491
497
|
|
@@ -512,8 +518,8 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
512
518
|
end
|
513
519
|
|
514
520
|
expected = clean <<-EOM
|
515
|
-
FakeNamedTestXX#test_skip = 0.00 s = S
|
516
521
|
FakeNamedTestXX#test_something = 0.00 s = .
|
522
|
+
FakeNamedTestXX#test_skip = 0.00 s = S
|
517
523
|
|
518
524
|
Finished in 0.00
|
519
525
|
|
@@ -527,6 +533,33 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
527
533
|
assert_report expected, %w[--seed 42 --verbose]
|
528
534
|
end
|
529
535
|
|
536
|
+
def test_run_skip_show_skips
|
537
|
+
@tu =
|
538
|
+
Class.new FakeNamedTest do
|
539
|
+
def test_something
|
540
|
+
assert true
|
541
|
+
end
|
542
|
+
|
543
|
+
def test_skip
|
544
|
+
skip "not yet"
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
expected = clean <<-EOM
|
549
|
+
.S
|
550
|
+
|
551
|
+
Finished in 0.00
|
552
|
+
|
553
|
+
1) Skipped:
|
554
|
+
FakeNamedTestXX#test_skip [FILE:LINE]:
|
555
|
+
not yet
|
556
|
+
|
557
|
+
2 runs, 1 assertions, 0 failures, 0 errors, 1 skips
|
558
|
+
EOM
|
559
|
+
|
560
|
+
assert_report expected, %w[--seed 42 --show-skips]
|
561
|
+
end
|
562
|
+
|
530
563
|
def test_run_with_other_runner
|
531
564
|
@tu =
|
532
565
|
Class.new FakeNamedTest do
|
@@ -627,6 +660,8 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
627
660
|
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
|
628
661
|
EOM
|
629
662
|
|
663
|
+
skip if Minitest.parallel_executor.size < 2 # locks up test runner if 1 CPU
|
664
|
+
|
630
665
|
assert_report(expected) do |reporter|
|
631
666
|
reporter.extend(Module.new {
|
632
667
|
define_method("record") do |result|
|
@@ -805,13 +840,51 @@ class TestMinitestRunnable < Minitest::Test
|
|
805
840
|
end
|
806
841
|
|
807
842
|
def test_spec_marshal_with_exception
|
808
|
-
klass = describe("whatever") {
|
843
|
+
klass = describe("whatever") {
|
844
|
+
it("raises, badly") {
|
845
|
+
raise Class.new(StandardError), "this is bad!"
|
846
|
+
}
|
847
|
+
}
|
848
|
+
|
809
849
|
rm = klass.runnable_methods.first
|
810
850
|
|
811
851
|
# Run the test
|
812
852
|
@tc = klass.new(rm).run
|
813
853
|
|
814
854
|
assert_kind_of Minitest::Result, @tc
|
855
|
+
assert_instance_of Minitest::UnexpectedError, @tc.failure
|
856
|
+
|
857
|
+
msg = @tc.failure.error.message
|
858
|
+
assert_includes msg, "Neutered Exception #<Class:"
|
859
|
+
assert_includes msg, "this is bad!"
|
860
|
+
|
861
|
+
# Pass it over the wire
|
862
|
+
over_the_wire = Marshal.load Marshal.dump @tc
|
863
|
+
|
864
|
+
assert_equal @tc.time, over_the_wire.time
|
865
|
+
assert_equal @tc.name, over_the_wire.name
|
866
|
+
assert_equal @tc.assertions, over_the_wire.assertions
|
867
|
+
assert_equal @tc.failures, over_the_wire.failures
|
868
|
+
assert_equal @tc.klass, over_the_wire.klass
|
869
|
+
end
|
870
|
+
|
871
|
+
def test_spec_marshal_with_exception_nameerror
|
872
|
+
klass = describe("whatever") {
|
873
|
+
it("raises nameerror") {
|
874
|
+
NOPE::does_not_exist
|
875
|
+
}
|
876
|
+
}
|
877
|
+
|
878
|
+
rm = klass.runnable_methods.first
|
879
|
+
|
880
|
+
# Run the test
|
881
|
+
@tc = klass.new(rm).run
|
882
|
+
|
883
|
+
assert_kind_of Minitest::Result, @tc
|
884
|
+
assert_instance_of Minitest::UnexpectedError, @tc.failure
|
885
|
+
|
886
|
+
msg = @tc.failure.error.message
|
887
|
+
assert_includes msg, "uninitialized constant TestMinitestRunnable::NOPE"
|
815
888
|
|
816
889
|
# Pass it over the wire
|
817
890
|
over_the_wire = Marshal.load Marshal.dump @tc
|
@@ -885,7 +958,7 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
885
958
|
random_tests_3 = sample_test_case 1_000
|
886
959
|
|
887
960
|
assert_equal random_tests_1, random_tests_2
|
888
|
-
|
961
|
+
assert_equal random_tests_1, random_tests_3
|
889
962
|
end
|
890
963
|
|
891
964
|
def test_runnable_methods_sorted
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "hoe"
|
3
|
+
|
4
|
+
require "minitest/test_task"
|
5
|
+
|
6
|
+
Hoe.load_plugins # make sure Hoe::Test is loaded
|
7
|
+
|
8
|
+
class TestHoeTest < Minitest::Test
|
9
|
+
PATH = "test/minitest/test_minitest_test_task.rb"
|
10
|
+
|
11
|
+
mt_path = %w[lib test .].join File::PATH_SEPARATOR
|
12
|
+
|
13
|
+
MT_EXPECTED = %W[-I#{mt_path} -w
|
14
|
+
-e '%srequire "#{PATH}"'
|
15
|
+
--].join(" ") + " "
|
16
|
+
|
17
|
+
def test_make_test_cmd_for_minitest
|
18
|
+
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
19
|
+
|
20
|
+
require "minitest/test_task"
|
21
|
+
|
22
|
+
framework = %(require "minitest/autorun"; )
|
23
|
+
|
24
|
+
@tester = Minitest::TestTask.create :test do |t|
|
25
|
+
t.test_globs = [PATH]
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_equal MT_EXPECTED % [framework].join("; "), @tester.make_test_cmd
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_make_test_cmd_for_minitest_prelude
|
32
|
+
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
33
|
+
|
34
|
+
require "minitest/test_task"
|
35
|
+
|
36
|
+
prelude = %(require "other/file")
|
37
|
+
framework = %(require "minitest/autorun"; )
|
38
|
+
|
39
|
+
@tester = Minitest::TestTask.create :test do |t|
|
40
|
+
t.test_prelude = prelude
|
41
|
+
t.test_globs = [PATH]
|
42
|
+
end
|
43
|
+
|
44
|
+
assert_equal MT_EXPECTED % [prelude, framework].join("; "), @tester.make_test_cmd
|
45
|
+
end
|
46
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBBjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTIxMTIyMzIzMTkwNFoXDTIyMTIyMzIzMTkwNFowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -22,14 +22,14 @@ cert_chain:
|
|
22
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
23
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
24
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
AQCKB5jfsuSnKb+t/Wrh3UpdkmX7TrEsjVmERC0pPqzQ5GQJgmEXDD7oMgaKXaAq
|
26
|
+
x2m+KSZDrqk7c8uho5OX6YMqg4KdxehfSLqqTZGoeV78qwf/jpPQZKTf+W9gUSJh
|
27
|
+
zsWpo4K50MP+QtdSbKXZwjAafpQ8hK0MnnZ/aeCsW9ov5vdXpYbf3dpg6ADXRGE7
|
28
|
+
lQY2y1tJ5/chqu6h7dQmnm2ABUqx9O+JcN9hbCYoA5i/EeubUEtFIh2w3SpO6YfB
|
29
|
+
JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
|
30
|
+
YsuyUzsMz6GQA4khyaMgKNSD
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '3.
|
60
|
+
version: '3.23'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '3.
|
67
|
+
version: '3.23'
|
68
68
|
description: |-
|
69
69
|
minitest provides a complete suite of testing facilities supporting
|
70
70
|
TDD, BDD, mocking, and benchmarking.
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/minitest/pride_plugin.rb
|
148
148
|
- lib/minitest/spec.rb
|
149
149
|
- lib/minitest/test.rb
|
150
|
+
- lib/minitest/test_task.rb
|
150
151
|
- lib/minitest/unit.rb
|
151
152
|
- test/minitest/metametameta.rb
|
152
153
|
- test/minitest/test_minitest_assertions.rb
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- test/minitest/test_minitest_reporter.rb
|
156
157
|
- test/minitest/test_minitest_spec.rb
|
157
158
|
- test/minitest/test_minitest_test.rb
|
159
|
+
- test/minitest/test_minitest_test_task.rb
|
158
160
|
homepage: https://github.com/seattlerb/minitest
|
159
161
|
licenses:
|
160
162
|
- MIT
|
@@ -171,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
173
|
requirements:
|
172
174
|
- - ">="
|
173
175
|
- !ruby/object:Gem::Version
|
174
|
-
version: '2.
|
176
|
+
version: '2.6'
|
175
177
|
- - "<"
|
176
178
|
- !ruby/object:Gem::Version
|
177
179
|
version: '4.0'
|
@@ -181,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
183
|
- !ruby/object:Gem::Version
|
182
184
|
version: '0'
|
183
185
|
requirements: []
|
184
|
-
rubygems_version: 3.
|
186
|
+
rubygems_version: 3.3.12
|
185
187
|
signing_key:
|
186
188
|
specification_version: 4
|
187
189
|
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
metadata.gz.sig
CHANGED
Binary file
|