minitest 5.23.1 → 5.25.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +64 -0
- data/lib/hoe/minitest.rb +2 -1
- data/lib/minitest/assertions.rb +64 -69
- data/lib/minitest/autorun.rb +0 -7
- data/lib/minitest/benchmark.rb +6 -9
- data/lib/minitest/compress.rb +10 -10
- data/lib/minitest/error_on_warning.rb +3 -3
- data/lib/minitest/mock.rb +35 -17
- data/lib/minitest/parallel.rb +4 -4
- data/lib/minitest/pride_plugin.rb +10 -14
- data/lib/minitest/spec.rb +13 -12
- data/lib/minitest/test.rb +10 -22
- data/lib/minitest/test_task.rb +16 -10
- data/lib/minitest.rb +181 -143
- data/test/minitest/metametameta.rb +6 -9
- data/test/minitest/test_minitest_assertions.rb +115 -115
- data/test/minitest/test_minitest_benchmark.rb +1 -1
- data/test/minitest/test_minitest_mock.rb +138 -68
- data/test/minitest/test_minitest_reporter.rb +17 -21
- data/test/minitest/test_minitest_spec.rb +54 -39
- data/test/minitest/test_minitest_test.rb +80 -99
- data/test/minitest/test_minitest_test_task.rb +18 -9
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
@@ -1,21 +1,18 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require "pathname"
|
4
1
|
require "minitest/metametameta"
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
warn ""
|
15
|
-
end
|
3
|
+
e = Encoding.default_external
|
4
|
+
if e != Encoding::UTF_8 then
|
5
|
+
warn ""
|
6
|
+
warn ""
|
7
|
+
warn "NOTE: External encoding #{e} is not UTF-8. Tests WILL fail."
|
8
|
+
warn " Run tests with `RUBYOPT=-Eutf-8 rake` to avoid errors."
|
9
|
+
warn ""
|
10
|
+
warn ""
|
16
11
|
end
|
17
12
|
|
18
13
|
class Minitest::Runnable
|
14
|
+
attr_reader :gc_stats # only needed if running w/ minitest-gcstats
|
15
|
+
|
19
16
|
def whatever # faked for testing
|
20
17
|
assert true
|
21
18
|
end
|
@@ -24,10 +21,7 @@ end
|
|
24
21
|
class TestMinitestUnit < MetaMetaMetaTestCase
|
25
22
|
parallelize_me!
|
26
23
|
|
27
|
-
|
28
|
-
basedir = Pathname.new(File.expand_path "lib/minitest") + "mini"
|
29
|
-
basedir = basedir.relative_path_from(pwd).to_s
|
30
|
-
MINITEST_BASE_DIR = basedir[/\A\./] ? basedir : "./#{basedir}"
|
24
|
+
MINITEST_BASE_DIR = "./lib/minitest/mini"
|
31
25
|
BT_MIDDLE = ["#{MINITEST_BASE_DIR}/test.rb:161:in 'each'",
|
32
26
|
"#{MINITEST_BASE_DIR}/test.rb:158:in 'each'",
|
33
27
|
"#{MINITEST_BASE_DIR}/test.rb:139:in 'run'",
|
@@ -49,7 +43,7 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
49
43
|
ex = util_expand_bt ex
|
50
44
|
|
51
45
|
Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
|
52
|
-
fu = Minitest.filter_backtrace
|
46
|
+
fu = Minitest.filter_backtrace bt
|
53
47
|
|
54
48
|
assert_equal ex, fu
|
55
49
|
end
|
@@ -60,7 +54,7 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
60
54
|
BT_MIDDLE +
|
61
55
|
["#{MINITEST_BASE_DIR}/test.rb:29"])
|
62
56
|
ex = bt.clone
|
63
|
-
fu = Minitest.filter_backtrace
|
57
|
+
fu = Minitest.filter_backtrace bt
|
64
58
|
assert_equal ex, fu
|
65
59
|
end
|
66
60
|
|
@@ -94,19 +88,19 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
94
88
|
end
|
95
89
|
|
96
90
|
def test_this_is_non_ascii_failure_message
|
97
|
-
|
91
|
+
raise "ЁЁЁ".dup.force_encoding(Encoding::BINARY)
|
98
92
|
end
|
99
93
|
end
|
100
94
|
|
101
|
-
expected =
|
95
|
+
expected = <<~EOM
|
102
96
|
FE
|
103
97
|
|
104
98
|
Finished in 0.00
|
105
99
|
|
106
100
|
1) Failure:
|
107
101
|
FakeNamedTestXX#test_this_is_not_ascii_assertion [FILE:LINE]:
|
108
|
-
Expected:
|
109
|
-
Actual:
|
102
|
+
Expected: "ЁЁЁ"
|
103
|
+
Actual: "ёёё"
|
110
104
|
|
111
105
|
2) Error:
|
112
106
|
FakeNamedTestXX#test_this_is_non_ascii_failure_message:
|
@@ -164,7 +158,7 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
164
158
|
end
|
165
159
|
|
166
160
|
def util_expand_bt bt
|
167
|
-
bt.map { |f| (
|
161
|
+
bt.map { |f| f.start_with?(".") ? File.expand_path(f) : f }
|
168
162
|
end
|
169
163
|
end
|
170
164
|
|
@@ -208,15 +202,14 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
208
202
|
def test_class_runnables
|
209
203
|
@assertion_count = 0
|
210
204
|
|
211
|
-
tc = Class.new
|
205
|
+
tc = Class.new Minitest::Test
|
212
206
|
|
213
207
|
assert_equal 1, Minitest::Test.runnables.size
|
214
208
|
assert_equal [tc], Minitest::Test.runnables
|
215
209
|
end
|
216
210
|
|
217
211
|
def test_run_test
|
218
|
-
@tu =
|
219
|
-
Class.new FakeNamedTest do
|
212
|
+
@tu = Class.new FakeNamedTest do
|
220
213
|
attr_reader :foo
|
221
214
|
|
222
215
|
def run
|
@@ -232,7 +225,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
232
225
|
end
|
233
226
|
end
|
234
227
|
|
235
|
-
expected =
|
228
|
+
expected = <<~EOM
|
236
229
|
.
|
237
230
|
|
238
231
|
Finished in 0.00
|
@@ -244,8 +237,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
244
237
|
end
|
245
238
|
|
246
239
|
def test_run_error
|
247
|
-
@tu =
|
248
|
-
Class.new FakeNamedTest do
|
240
|
+
@tu = Class.new FakeNamedTest do
|
249
241
|
def test_something
|
250
242
|
assert true
|
251
243
|
end
|
@@ -255,7 +247,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
255
247
|
end
|
256
248
|
end
|
257
249
|
|
258
|
-
expected =
|
250
|
+
expected = <<~EOM
|
259
251
|
.E
|
260
252
|
|
261
253
|
Finished in 0.00
|
@@ -263,7 +255,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
263
255
|
1) Error:
|
264
256
|
FakeNamedTestXX#test_error:
|
265
257
|
RuntimeError: unhandled exception
|
266
|
-
FILE:LINE:in
|
258
|
+
FILE:LINE:in 'test_error'
|
267
259
|
|
268
260
|
2 runs, 1 assertions, 0 failures, 1 errors, 0 skips
|
269
261
|
EOM
|
@@ -272,8 +264,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
272
264
|
end
|
273
265
|
|
274
266
|
def test_run_error_teardown
|
275
|
-
@tu =
|
276
|
-
Class.new FakeNamedTest do
|
267
|
+
@tu = Class.new FakeNamedTest do
|
277
268
|
def test_something
|
278
269
|
assert true
|
279
270
|
end
|
@@ -283,7 +274,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
283
274
|
end
|
284
275
|
end
|
285
276
|
|
286
|
-
expected =
|
277
|
+
expected = <<~EOM
|
287
278
|
E
|
288
279
|
|
289
280
|
Finished in 0.00
|
@@ -291,7 +282,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
291
282
|
1) Error:
|
292
283
|
FakeNamedTestXX#test_something:
|
293
284
|
RuntimeError: unhandled exception
|
294
|
-
FILE:LINE:in
|
285
|
+
FILE:LINE:in 'teardown'
|
295
286
|
|
296
287
|
1 runs, 1 assertions, 0 failures, 1 errors, 0 skips
|
297
288
|
EOM
|
@@ -302,7 +293,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
302
293
|
def test_run_failing
|
303
294
|
setup_basic_tu
|
304
295
|
|
305
|
-
expected =
|
296
|
+
expected = <<~EOM
|
306
297
|
.F
|
307
298
|
|
308
299
|
Finished in 0.00
|
@@ -318,8 +309,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
318
309
|
end
|
319
310
|
|
320
311
|
def setup_basic_tu
|
321
|
-
@tu =
|
322
|
-
Class.new FakeNamedTest do
|
312
|
+
@tu = Class.new FakeNamedTest do
|
323
313
|
def test_something
|
324
314
|
assert true
|
325
315
|
end
|
@@ -337,7 +327,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
337
327
|
def test_run_failing_filtered
|
338
328
|
setup_basic_tu
|
339
329
|
|
340
|
-
expected =
|
330
|
+
expected = <<~EOM
|
341
331
|
.
|
342
332
|
|
343
333
|
Finished in 0.00
|
@@ -356,14 +346,14 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
356
346
|
assert a
|
357
347
|
end
|
358
348
|
end
|
359
|
-
Object.const_set
|
349
|
+
Object.const_set :Alpha, alpha
|
360
350
|
|
361
351
|
beta = Class.new FakeNamedTest do
|
362
352
|
define_method :test_something do
|
363
353
|
assert true
|
364
354
|
end
|
365
355
|
end
|
366
|
-
Object.const_set
|
356
|
+
Object.const_set :Beta, beta
|
367
357
|
|
368
358
|
@tus = [alpha, beta]
|
369
359
|
|
@@ -374,7 +364,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
374
364
|
end
|
375
365
|
|
376
366
|
def test_run_filtered_including_suite_name
|
377
|
-
expected =
|
367
|
+
expected = <<~EOM
|
378
368
|
.
|
379
369
|
|
380
370
|
Finished in 0.00
|
@@ -386,7 +376,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
386
376
|
end
|
387
377
|
|
388
378
|
def test_run_filtered_including_suite_name_string
|
389
|
-
expected =
|
379
|
+
expected = <<~EOM
|
390
380
|
.
|
391
381
|
|
392
382
|
Finished in 0.00
|
@@ -398,7 +388,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
398
388
|
end
|
399
389
|
|
400
390
|
def test_run_filtered_string_method_only
|
401
|
-
expected =
|
391
|
+
expected = <<~EOM
|
402
392
|
..
|
403
393
|
|
404
394
|
Finished in 0.00
|
@@ -412,7 +402,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
412
402
|
def test_run_failing_excluded
|
413
403
|
setup_basic_tu
|
414
404
|
|
415
|
-
expected =
|
405
|
+
expected = <<~EOM
|
416
406
|
.
|
417
407
|
|
418
408
|
Finished in 0.00
|
@@ -424,7 +414,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
424
414
|
end
|
425
415
|
|
426
416
|
def test_run_filtered_excluding_suite_name
|
427
|
-
expected =
|
417
|
+
expected = <<~EOM
|
428
418
|
.
|
429
419
|
|
430
420
|
Finished in 0.00
|
@@ -436,7 +426,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
436
426
|
end
|
437
427
|
|
438
428
|
def test_run_filtered_excluding_suite_name_string
|
439
|
-
expected =
|
429
|
+
expected = <<~EOM
|
440
430
|
.
|
441
431
|
|
442
432
|
Finished in 0.00
|
@@ -448,7 +438,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
448
438
|
end
|
449
439
|
|
450
440
|
def test_run_filtered_excluding_string_method_only
|
451
|
-
expected =
|
441
|
+
expected = <<~EOM
|
452
442
|
|
453
443
|
|
454
444
|
Finished in 0.00
|
@@ -460,14 +450,13 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
460
450
|
end
|
461
451
|
|
462
452
|
def test_run_passing
|
463
|
-
@tu =
|
464
|
-
Class.new FakeNamedTest do
|
453
|
+
@tu = Class.new FakeNamedTest do
|
465
454
|
def test_something
|
466
455
|
assert true
|
467
456
|
end
|
468
457
|
end
|
469
458
|
|
470
|
-
expected =
|
459
|
+
expected = <<~EOM
|
471
460
|
.
|
472
461
|
|
473
462
|
Finished in 0.00
|
@@ -479,8 +468,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
479
468
|
end
|
480
469
|
|
481
470
|
def test_run_skip
|
482
|
-
@tu =
|
483
|
-
Class.new FakeNamedTest do
|
471
|
+
@tu = Class.new FakeNamedTest do
|
484
472
|
def test_something
|
485
473
|
assert true
|
486
474
|
end
|
@@ -490,7 +478,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
490
478
|
end
|
491
479
|
end
|
492
480
|
|
493
|
-
expected =
|
481
|
+
expected = <<~EOM
|
494
482
|
.S
|
495
483
|
|
496
484
|
Finished in 0.00
|
@@ -506,8 +494,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
506
494
|
end
|
507
495
|
|
508
496
|
def test_run_skip_verbose
|
509
|
-
@tu =
|
510
|
-
Class.new FakeNamedTest do
|
497
|
+
@tu = Class.new FakeNamedTest do
|
511
498
|
def test_something
|
512
499
|
assert true
|
513
500
|
end
|
@@ -517,7 +504,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
517
504
|
end
|
518
505
|
end
|
519
506
|
|
520
|
-
expected =
|
507
|
+
expected = <<~EOM
|
521
508
|
FakeNamedTestXX#test_something = 0.00 s = .
|
522
509
|
FakeNamedTestXX#test_skip = 0.00 s = S
|
523
510
|
|
@@ -534,8 +521,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
534
521
|
end
|
535
522
|
|
536
523
|
def test_run_skip_show_skips
|
537
|
-
@tu =
|
538
|
-
Class.new FakeNamedTest do
|
524
|
+
@tu = Class.new FakeNamedTest do
|
539
525
|
def test_something
|
540
526
|
assert true
|
541
527
|
end
|
@@ -545,7 +531,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
545
531
|
end
|
546
532
|
end
|
547
533
|
|
548
|
-
expected =
|
534
|
+
expected = <<~EOM
|
549
535
|
.S
|
550
536
|
|
551
537
|
Finished in 0.00
|
@@ -561,8 +547,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
561
547
|
end
|
562
548
|
|
563
549
|
def test_run_with_other_runner
|
564
|
-
@tu =
|
565
|
-
Class.new FakeNamedTest do
|
550
|
+
@tu = Class.new FakeNamedTest do
|
566
551
|
def self.run reporter, options = {}
|
567
552
|
@reporter = reporter
|
568
553
|
before_my_suite
|
@@ -585,7 +570,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
585
570
|
end
|
586
571
|
end
|
587
572
|
|
588
|
-
expected =
|
573
|
+
expected = <<~EOM
|
589
574
|
Running wacky! tests
|
590
575
|
..
|
591
576
|
|
@@ -634,8 +619,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
634
619
|
main_latch.release
|
635
620
|
}
|
636
621
|
|
637
|
-
@tu =
|
638
|
-
Class.new FakeNamedTest do
|
622
|
+
@tu = Class.new FakeNamedTest do
|
639
623
|
parallelize_me!
|
640
624
|
|
641
625
|
test_count.times do |i|
|
@@ -652,7 +636,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
652
636
|
end
|
653
637
|
end
|
654
638
|
|
655
|
-
expected =
|
639
|
+
expected = <<~EOM
|
656
640
|
..
|
657
641
|
|
658
642
|
Finished in 0.00
|
@@ -662,18 +646,18 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
662
646
|
|
663
647
|
skip if Minitest.parallel_executor.size < 2 # locks up test runner if 1 CPU
|
664
648
|
|
665
|
-
assert_report
|
666
|
-
reporter.extend
|
667
|
-
define_method
|
649
|
+
assert_report expected do |reporter|
|
650
|
+
reporter.extend Module.new {
|
651
|
+
define_method :record do |result|
|
668
652
|
super(result)
|
669
653
|
wait_latch.release
|
670
654
|
end
|
671
655
|
|
672
|
-
define_method
|
656
|
+
define_method :report do
|
673
657
|
wait_latch.await
|
674
658
|
super()
|
675
659
|
end
|
676
|
-
}
|
660
|
+
}
|
677
661
|
end
|
678
662
|
assert thread.join
|
679
663
|
end
|
@@ -684,8 +668,8 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
684
668
|
|
685
669
|
def test_before_setup
|
686
670
|
call_order = []
|
687
|
-
|
688
|
-
Class.new FakeNamedTest do
|
671
|
+
|
672
|
+
@tu = Class.new FakeNamedTest do
|
689
673
|
define_method :setup do
|
690
674
|
super()
|
691
675
|
call_order << :setup
|
@@ -700,14 +684,13 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
700
684
|
|
701
685
|
run_tu_with_fresh_reporter
|
702
686
|
|
703
|
-
expected = [
|
687
|
+
expected = %i[before_setup setup]
|
704
688
|
assert_equal expected, call_order
|
705
689
|
end
|
706
690
|
|
707
691
|
def test_after_teardown
|
708
692
|
call_order = []
|
709
|
-
@tu =
|
710
|
-
Class.new FakeNamedTest do
|
693
|
+
@tu = Class.new FakeNamedTest do
|
711
694
|
define_method :teardown do
|
712
695
|
super()
|
713
696
|
call_order << :teardown
|
@@ -722,14 +705,14 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
722
705
|
|
723
706
|
run_tu_with_fresh_reporter
|
724
707
|
|
725
|
-
expected = [
|
708
|
+
expected = %i[teardown after_teardown]
|
726
709
|
assert_equal expected, call_order
|
727
710
|
end
|
728
711
|
|
729
712
|
def test_all_teardowns_are_guaranteed_to_run
|
730
713
|
call_order = []
|
731
|
-
|
732
|
-
Class.new FakeNamedTest do
|
714
|
+
|
715
|
+
@tu = Class.new FakeNamedTest do
|
733
716
|
define_method :after_teardown do
|
734
717
|
super()
|
735
718
|
call_order << :after_teardown
|
@@ -753,7 +736,7 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
753
736
|
|
754
737
|
run_tu_with_fresh_reporter
|
755
738
|
|
756
|
-
expected = [
|
739
|
+
expected = %i[before_teardown teardown after_teardown]
|
757
740
|
assert_equal expected, call_order
|
758
741
|
end
|
759
742
|
|
@@ -780,7 +763,7 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
780
763
|
run_tu_with_fresh_reporter
|
781
764
|
|
782
765
|
# Once for the parent class, once for the child
|
783
|
-
expected = [
|
766
|
+
expected = %i[setup_method test teardown_method] * 2
|
784
767
|
|
785
768
|
assert_equal expected, call_order
|
786
769
|
end
|
@@ -813,6 +796,7 @@ class TestMinitestRunnable < Minitest::Test
|
|
813
796
|
new_tc = Marshal.load Marshal.dump @tc
|
814
797
|
|
815
798
|
ivars = new_tc.instance_variables.map(&:to_s).sort
|
799
|
+
ivars.delete "@gc_stats" # only needed if running w/ minitest-gcstats
|
816
800
|
assert_equal expected_ivars, ivars
|
817
801
|
assert_equal "whatever", new_tc.name
|
818
802
|
assert_equal 42, new_tc.assertions
|
@@ -876,11 +860,11 @@ class TestMinitestRunnable < Minitest::Test
|
|
876
860
|
end
|
877
861
|
|
878
862
|
def test_spec_marshal_with_exception_nameerror
|
879
|
-
klass = describe
|
880
|
-
it
|
863
|
+
klass = describe "whatever" do
|
864
|
+
it "raises NameError" do
|
881
865
|
NOPE::does_not_exist
|
882
|
-
|
883
|
-
|
866
|
+
end
|
867
|
+
end
|
884
868
|
|
885
869
|
rm = klass.runnable_methods.first
|
886
870
|
|
@@ -944,10 +928,9 @@ class TestMinitestRunnable < Minitest::Test
|
|
944
928
|
end
|
945
929
|
|
946
930
|
def test_spec_marshal_with_exception__worse_error_typeerror
|
947
|
-
worse_error_klass = Class.new
|
948
|
-
# problem #1: anonymous subclass can'
|
949
|
-
def initialize
|
950
|
-
|
931
|
+
worse_error_klass = Class.new StandardError do
|
932
|
+
# problem #1: anonymous subclass can't marshal, fails sanitize_exception
|
933
|
+
def initialize record = nil
|
951
934
|
super(record.first)
|
952
935
|
end
|
953
936
|
end
|
@@ -1004,8 +987,6 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
1004
987
|
# which is not threadsafe. Nearly every method in here is an
|
1005
988
|
# assertion test so it isn't worth splitting it out further.
|
1006
989
|
|
1007
|
-
RUBY18 = !defined? Encoding
|
1008
|
-
|
1009
990
|
def setup
|
1010
991
|
super
|
1011
992
|
|
@@ -1030,7 +1011,7 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
1030
1011
|
$VERBOSE = orig_verbose
|
1031
1012
|
end
|
1032
1013
|
|
1033
|
-
def sample_test_case
|
1014
|
+
def sample_test_case rand
|
1034
1015
|
srand rand
|
1035
1016
|
Class.new FakeNamedTest do
|
1036
1017
|
100.times do |i|
|
@@ -1089,21 +1070,21 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
1089
1070
|
|
1090
1071
|
def test_autorun_does_not_affect_fork_success_status
|
1091
1072
|
@assertion_count = 0
|
1092
|
-
skip "windows doesn't have fork" unless Process.respond_to?
|
1073
|
+
skip "windows doesn't have fork" unless Process.respond_to? :fork
|
1093
1074
|
Process.waitpid(fork {})
|
1094
1075
|
assert_equal true, $?.success?
|
1095
1076
|
end
|
1096
1077
|
|
1097
1078
|
def test_autorun_does_not_affect_fork_exit_status
|
1098
1079
|
@assertion_count = 0
|
1099
|
-
skip "windows doesn't have fork" unless Process.respond_to?
|
1080
|
+
skip "windows doesn't have fork" unless Process.respond_to? :fork
|
1100
1081
|
Process.waitpid(fork { exit 42 })
|
1101
1082
|
assert_equal 42, $?.exitstatus
|
1102
1083
|
end
|
1103
1084
|
|
1104
1085
|
def test_autorun_optionally_can_affect_fork_exit_status
|
1105
1086
|
@assertion_count = 0
|
1106
|
-
skip "windows doesn't have fork" unless Process.respond_to?
|
1087
|
+
skip "windows doesn't have fork" unless Process.respond_to? :fork
|
1107
1088
|
Minitest.allow_fork = true
|
1108
1089
|
Process.waitpid(fork { exit 42 })
|
1109
1090
|
refute_equal 42, $?.exitstatus
|
@@ -1179,7 +1160,7 @@ class TestMinitestUnitRecording < MetaMetaMetaTestCase
|
|
1179
1160
|
bogus_reporter = Class.new do # doesn't subclass AbstractReporter
|
1180
1161
|
def start; @success = false; end
|
1181
1162
|
# def prerecord klass, name; end # doesn't define full API
|
1182
|
-
def record
|
1163
|
+
def record _result; @success = true; end
|
1183
1164
|
def report; end
|
1184
1165
|
def passed?; end
|
1185
1166
|
def results; end
|
@@ -1257,7 +1238,7 @@ class TestMinitestUnitRecording < MetaMetaMetaTestCase
|
|
1257
1238
|
|
1258
1239
|
run_tu_with_fresh_reporter
|
1259
1240
|
|
1260
|
-
exp =
|
1241
|
+
exp = <<~EOM
|
1261
1242
|
Error:
|
1262
1243
|
FakeNamedTestXX#test_method:
|
1263
1244
|
AnError: AnError
|
@@ -1267,7 +1248,7 @@ class TestMinitestUnitRecording < MetaMetaMetaTestCase
|
|
1267
1248
|
FakeNamedTestXX#test_method:
|
1268
1249
|
RuntimeError: unhandled exception
|
1269
1250
|
FILE:LINE:in 'teardown'
|
1270
|
-
|
1251
|
+
EOM
|
1271
1252
|
|
1272
1253
|
assert_equal exp.strip, normalize_output(first_reporter.results.first.to_s).strip
|
1273
1254
|
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "hoe"
|
5
|
+
rescue LoadError => e
|
6
|
+
warn e.message
|
7
|
+
return
|
8
|
+
end
|
3
9
|
|
4
10
|
require "minitest/test_task"
|
5
11
|
|
@@ -8,11 +14,16 @@ Hoe.load_plugins # make sure Hoe::Test is loaded
|
|
8
14
|
class TestHoeTest < Minitest::Test
|
9
15
|
PATH = "test/minitest/test_minitest_test_task.rb"
|
10
16
|
|
11
|
-
|
17
|
+
def util_cmd_string *prelude_framework
|
18
|
+
mt_path = %w[lib test .].join File::PATH_SEPARATOR
|
19
|
+
mt_expected = "-I%s -w -e '%srequire %p' -- "
|
12
20
|
|
13
|
-
|
14
|
-
|
15
|
-
|
21
|
+
mt_expected % [mt_path, prelude_framework.join("; "), PATH]
|
22
|
+
end
|
23
|
+
|
24
|
+
def util_exp_cmd
|
25
|
+
@tester.make_test_cmd.sub(/ -- .+/, " -- ")
|
26
|
+
end
|
16
27
|
|
17
28
|
def test_make_test_cmd_for_minitest
|
18
29
|
skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
|
@@ -25,8 +36,7 @@ class TestHoeTest < Minitest::Test
|
|
25
36
|
t.test_globs = [PATH]
|
26
37
|
end
|
27
38
|
|
28
|
-
assert_equal
|
29
|
-
.sub(/ -- .+/, " -- ")
|
39
|
+
assert_equal util_cmd_string(framework), util_exp_cmd
|
30
40
|
end
|
31
41
|
|
32
42
|
def test_make_test_cmd_for_minitest_prelude
|
@@ -42,7 +52,6 @@ class TestHoeTest < Minitest::Test
|
|
42
52
|
t.test_globs = [PATH]
|
43
53
|
end
|
44
54
|
|
45
|
-
assert_equal
|
46
|
-
.sub(/ -- .+/, " -- ")
|
55
|
+
assert_equal util_cmd_string(prelude, framework), util_exp_cmd
|
47
56
|
end
|
48
57
|
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.25.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
|
30
30
|
deKfBjgVAq7EYHu1AczzlUly
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2024-
|
32
|
+
date: 2024-12-04 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
|
-
rubygems_version: 3.5.
|
190
|
+
rubygems_version: 3.5.23
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
metadata.gz.sig
CHANGED
Binary file
|