minitest 5.16.2 → 6.0.5
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 +373 -1
- data/Manifest.txt +16 -4
- data/README.rdoc +48 -118
- data/Rakefile +17 -2
- data/bin/minitest +5 -0
- data/design_rationale.rb +21 -19
- data/lib/hoe/minitest.rb +4 -2
- data/lib/minitest/assertions.rb +142 -124
- data/lib/minitest/autorun.rb +3 -11
- data/lib/minitest/benchmark.rb +9 -12
- data/lib/minitest/bisect.rb +304 -0
- data/lib/minitest/complete.rb +56 -0
- data/lib/minitest/compress.rb +94 -0
- data/lib/minitest/error_on_warning.rb +11 -0
- data/lib/minitest/expectations.rb +18 -0
- data/lib/minitest/find_minimal_combination.rb +127 -0
- data/lib/minitest/hell.rb +1 -1
- data/lib/minitest/manual_plugins.rb +4 -0
- data/lib/minitest/parallel.rb +10 -8
- data/lib/minitest/path_expander.rb +432 -0
- data/lib/minitest/pride.rb +2 -2
- data/lib/minitest/pride_plugin.rb +17 -24
- data/lib/minitest/server.rb +49 -0
- data/lib/minitest/server_plugin.rb +88 -0
- data/lib/minitest/spec.rb +27 -46
- data/lib/minitest/sprint.rb +105 -0
- data/lib/minitest/sprint_plugin.rb +39 -0
- data/lib/minitest/test.rb +32 -52
- data/lib/minitest/test_task.rb +68 -42
- data/lib/minitest.rb +361 -215
- data/test/minitest/metametameta.rb +33 -19
- data/test/minitest/test_bisect.rb +249 -0
- data/test/minitest/test_find_minimal_combination.rb +138 -0
- data/test/minitest/test_minitest_assertions.rb +311 -173
- data/test/minitest/test_minitest_benchmark.rb +15 -1
- data/test/minitest/test_minitest_reporter.rb +148 -23
- data/test/minitest/test_minitest_spec.rb +157 -132
- data/test/minitest/test_minitest_test.rb +270 -204
- data/test/minitest/test_minitest_test_task.rb +18 -7
- data/test/minitest/test_path_expander.rb +229 -0
- data/test/minitest/test_server.rb +146 -0
- data.tar.gz.sig +2 -2
- metadata +97 -37
- metadata.gz.sig +0 -0
- data/.autotest +0 -34
- data/lib/minitest/mock.rb +0 -323
- data/lib/minitest/unit.rb +0 -42
- data/test/minitest/test_minitest_mock.rb +0 -1139
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
e
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
warn "NOTE: External encoding #{e} is not UTF-8. Tests WILL fail."
|
|
12
|
-
warn " Run tests with `RUBYOPT=-Eutf-8 rake` to avoid errors."
|
|
13
|
-
warn ""
|
|
14
|
-
warn ""
|
|
15
|
-
end
|
|
1
|
+
require_relative "metametameta"
|
|
2
|
+
|
|
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,48 +21,45 @@ end
|
|
|
24
21
|
class TestMinitestUnit < MetaMetaMetaTestCase
|
|
25
22
|
parallelize_me!
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"#{MINITEST_BASE_DIR}/test.rb:158:in `each'",
|
|
33
|
-
"#{MINITEST_BASE_DIR}/test.rb:139:in `run'",
|
|
34
|
-
"#{MINITEST_BASE_DIR}/test.rb:106:in `run'"]
|
|
24
|
+
MINITEST_BASE_DIR = "./lib/minitest/mini"
|
|
25
|
+
BT_MIDDLE = ["#{MINITEST_BASE_DIR}/test.rb:161:in 'each'",
|
|
26
|
+
"#{MINITEST_BASE_DIR}/test.rb:158:in 'each'",
|
|
27
|
+
"#{MINITEST_BASE_DIR}/test.rb:139:in 'run'",
|
|
28
|
+
"#{MINITEST_BASE_DIR}/test.rb:106:in 'run'"]
|
|
35
29
|
|
|
36
30
|
def test_filter_backtrace
|
|
37
31
|
# this is a semi-lame mix of relative paths.
|
|
38
32
|
# I cheated by making the autotest parts not have ./
|
|
39
|
-
bt = (["lib/autotest.rb:571:in
|
|
40
|
-
"test/test_autotest.rb:62:in
|
|
41
|
-
"#{MINITEST_BASE_DIR}/test.rb:165:in
|
|
33
|
+
bt = (["lib/autotest.rb:571:in 'add_exception'",
|
|
34
|
+
"test/test_autotest.rb:62:in 'test_add_exception'",
|
|
35
|
+
"#{MINITEST_BASE_DIR}/test.rb:165:in '__send__'"] +
|
|
42
36
|
BT_MIDDLE +
|
|
43
37
|
["#{MINITEST_BASE_DIR}/test.rb:29",
|
|
44
38
|
"test/test_autotest.rb:422"])
|
|
45
39
|
bt = util_expand_bt bt
|
|
46
40
|
|
|
47
|
-
ex = ["lib/autotest.rb:571:in
|
|
48
|
-
"test/test_autotest.rb:62:in
|
|
41
|
+
ex = ["lib/autotest.rb:571:in 'add_exception'",
|
|
42
|
+
"test/test_autotest.rb:62:in 'test_add_exception'"]
|
|
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
|
|
56
50
|
end
|
|
57
51
|
|
|
58
52
|
def test_filter_backtrace_all_unit
|
|
59
|
-
bt = (["#{MINITEST_BASE_DIR}/test.rb:165:in
|
|
53
|
+
bt = (["#{MINITEST_BASE_DIR}/test.rb:165:in '__send__'"] +
|
|
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
|
|
|
67
61
|
def test_filter_backtrace_unit_starts
|
|
68
|
-
bt = (["#{MINITEST_BASE_DIR}/test.rb:165:in
|
|
62
|
+
bt = (["#{MINITEST_BASE_DIR}/test.rb:165:in '__send__'"] +
|
|
69
63
|
BT_MIDDLE +
|
|
70
64
|
["#{MINITEST_BASE_DIR}/mini/test.rb:29",
|
|
71
65
|
"-e:1"])
|
|
@@ -94,24 +88,24 @@ 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:
|
|
113
107
|
RuntimeError: ЁЁЁ
|
|
114
|
-
FILE:LINE:in
|
|
108
|
+
FILE:LINE:in 'test_this_is_non_ascii_failure_message'
|
|
115
109
|
|
|
116
110
|
2 runs, 1 assertions, 1 failures, 1 errors, 0 skips
|
|
117
111
|
EOM
|
|
@@ -163,8 +157,26 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
|
163
157
|
refute_predicate test, :skipped?
|
|
164
158
|
end
|
|
165
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
|
+
|
|
166
178
|
def util_expand_bt bt
|
|
167
|
-
bt.map { |f| (
|
|
179
|
+
bt.map { |f| f.start_with?(".") ? File.expand_path(f) : f }
|
|
168
180
|
end
|
|
169
181
|
end
|
|
170
182
|
|
|
@@ -208,15 +220,14 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
208
220
|
def test_class_runnables
|
|
209
221
|
@assertion_count = 0
|
|
210
222
|
|
|
211
|
-
tc = Class.new
|
|
223
|
+
tc = Class.new Minitest::Test
|
|
212
224
|
|
|
213
225
|
assert_equal 1, Minitest::Test.runnables.size
|
|
214
226
|
assert_equal [tc], Minitest::Test.runnables
|
|
215
227
|
end
|
|
216
228
|
|
|
217
229
|
def test_run_test
|
|
218
|
-
@tu =
|
|
219
|
-
Class.new FakeNamedTest do
|
|
230
|
+
@tu = Class.new FakeNamedTest do
|
|
220
231
|
attr_reader :foo
|
|
221
232
|
|
|
222
233
|
def run
|
|
@@ -232,7 +243,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
232
243
|
end
|
|
233
244
|
end
|
|
234
245
|
|
|
235
|
-
expected =
|
|
246
|
+
expected = <<~EOM
|
|
236
247
|
.
|
|
237
248
|
|
|
238
249
|
Finished in 0.00
|
|
@@ -244,8 +255,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
244
255
|
end
|
|
245
256
|
|
|
246
257
|
def test_run_error
|
|
247
|
-
@tu =
|
|
248
|
-
Class.new FakeNamedTest do
|
|
258
|
+
@tu = Class.new FakeNamedTest do
|
|
249
259
|
def test_something
|
|
250
260
|
assert true
|
|
251
261
|
end
|
|
@@ -255,7 +265,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
255
265
|
end
|
|
256
266
|
end
|
|
257
267
|
|
|
258
|
-
expected =
|
|
268
|
+
expected = <<~EOM
|
|
259
269
|
.E
|
|
260
270
|
|
|
261
271
|
Finished in 0.00
|
|
@@ -263,7 +273,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
263
273
|
1) Error:
|
|
264
274
|
FakeNamedTestXX#test_error:
|
|
265
275
|
RuntimeError: unhandled exception
|
|
266
|
-
FILE:LINE:in
|
|
276
|
+
FILE:LINE:in 'test_error'
|
|
267
277
|
|
|
268
278
|
2 runs, 1 assertions, 0 failures, 1 errors, 0 skips
|
|
269
279
|
EOM
|
|
@@ -272,8 +282,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
272
282
|
end
|
|
273
283
|
|
|
274
284
|
def test_run_error_teardown
|
|
275
|
-
@tu =
|
|
276
|
-
Class.new FakeNamedTest do
|
|
285
|
+
@tu = Class.new FakeNamedTest do
|
|
277
286
|
def test_something
|
|
278
287
|
assert true
|
|
279
288
|
end
|
|
@@ -283,7 +292,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
283
292
|
end
|
|
284
293
|
end
|
|
285
294
|
|
|
286
|
-
expected =
|
|
295
|
+
expected = <<~EOM
|
|
287
296
|
E
|
|
288
297
|
|
|
289
298
|
Finished in 0.00
|
|
@@ -291,7 +300,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
291
300
|
1) Error:
|
|
292
301
|
FakeNamedTestXX#test_something:
|
|
293
302
|
RuntimeError: unhandled exception
|
|
294
|
-
FILE:LINE:in
|
|
303
|
+
FILE:LINE:in 'teardown'
|
|
295
304
|
|
|
296
305
|
1 runs, 1 assertions, 0 failures, 1 errors, 0 skips
|
|
297
306
|
EOM
|
|
@@ -302,7 +311,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
302
311
|
def test_run_failing
|
|
303
312
|
setup_basic_tu
|
|
304
313
|
|
|
305
|
-
expected =
|
|
314
|
+
expected = <<~EOM
|
|
306
315
|
.F
|
|
307
316
|
|
|
308
317
|
Finished in 0.00
|
|
@@ -318,8 +327,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
318
327
|
end
|
|
319
328
|
|
|
320
329
|
def setup_basic_tu
|
|
321
|
-
@tu =
|
|
322
|
-
Class.new FakeNamedTest do
|
|
330
|
+
@tu = Class.new FakeNamedTest do
|
|
323
331
|
def test_something
|
|
324
332
|
assert true
|
|
325
333
|
end
|
|
@@ -334,10 +342,24 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
334
342
|
assert_instance_of Integer, Minitest.seed
|
|
335
343
|
end
|
|
336
344
|
|
|
345
|
+
def test_filter_runnable_methods
|
|
346
|
+
cls = Class.new Minitest::Runnable
|
|
347
|
+
def cls.runnable_methods
|
|
348
|
+
%w[ x y z ]
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
assert_equal %w[x y z], cls.filter_runnable_methods
|
|
352
|
+
assert_equal %w[x y], cls.filter_runnable_methods(exclude: "z")
|
|
353
|
+
assert_equal %w[x], cls.filter_runnable_methods(include: "x")
|
|
354
|
+
|
|
355
|
+
assert_empty cls.filter_runnable_methods(exclude: "/./")
|
|
356
|
+
assert_empty cls.filter_runnable_methods(include: "x", exclude: "x")
|
|
357
|
+
end
|
|
358
|
+
|
|
337
359
|
def test_run_failing_filtered
|
|
338
360
|
setup_basic_tu
|
|
339
361
|
|
|
340
|
-
expected =
|
|
362
|
+
expected = <<~EOM
|
|
341
363
|
.
|
|
342
364
|
|
|
343
365
|
Finished in 0.00
|
|
@@ -356,14 +378,14 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
356
378
|
assert a
|
|
357
379
|
end
|
|
358
380
|
end
|
|
359
|
-
Object.const_set
|
|
381
|
+
Object.const_set :Alpha, alpha
|
|
360
382
|
|
|
361
383
|
beta = Class.new FakeNamedTest do
|
|
362
384
|
define_method :test_something do
|
|
363
385
|
assert true
|
|
364
386
|
end
|
|
365
387
|
end
|
|
366
|
-
Object.const_set
|
|
388
|
+
Object.const_set :Beta, beta
|
|
367
389
|
|
|
368
390
|
@tus = [alpha, beta]
|
|
369
391
|
|
|
@@ -374,7 +396,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
374
396
|
end
|
|
375
397
|
|
|
376
398
|
def test_run_filtered_including_suite_name
|
|
377
|
-
expected =
|
|
399
|
+
expected = <<~EOM
|
|
378
400
|
.
|
|
379
401
|
|
|
380
402
|
Finished in 0.00
|
|
@@ -386,7 +408,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
386
408
|
end
|
|
387
409
|
|
|
388
410
|
def test_run_filtered_including_suite_name_string
|
|
389
|
-
expected =
|
|
411
|
+
expected = <<~EOM
|
|
390
412
|
.
|
|
391
413
|
|
|
392
414
|
Finished in 0.00
|
|
@@ -398,7 +420,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
398
420
|
end
|
|
399
421
|
|
|
400
422
|
def test_run_filtered_string_method_only
|
|
401
|
-
expected =
|
|
423
|
+
expected = <<~EOM
|
|
402
424
|
..
|
|
403
425
|
|
|
404
426
|
Finished in 0.00
|
|
@@ -412,7 +434,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
412
434
|
def test_run_failing_excluded
|
|
413
435
|
setup_basic_tu
|
|
414
436
|
|
|
415
|
-
expected =
|
|
437
|
+
expected = <<~EOM
|
|
416
438
|
.
|
|
417
439
|
|
|
418
440
|
Finished in 0.00
|
|
@@ -424,7 +446,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
424
446
|
end
|
|
425
447
|
|
|
426
448
|
def test_run_filtered_excluding_suite_name
|
|
427
|
-
expected =
|
|
449
|
+
expected = <<~EOM
|
|
428
450
|
.
|
|
429
451
|
|
|
430
452
|
Finished in 0.00
|
|
@@ -436,7 +458,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
436
458
|
end
|
|
437
459
|
|
|
438
460
|
def test_run_filtered_excluding_suite_name_string
|
|
439
|
-
expected =
|
|
461
|
+
expected = <<~EOM
|
|
440
462
|
.
|
|
441
463
|
|
|
442
464
|
Finished in 0.00
|
|
@@ -448,7 +470,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
448
470
|
end
|
|
449
471
|
|
|
450
472
|
def test_run_filtered_excluding_string_method_only
|
|
451
|
-
expected =
|
|
473
|
+
expected = <<~EOM
|
|
452
474
|
|
|
453
475
|
|
|
454
476
|
Finished in 0.00
|
|
@@ -460,14 +482,13 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
460
482
|
end
|
|
461
483
|
|
|
462
484
|
def test_run_passing
|
|
463
|
-
@tu =
|
|
464
|
-
Class.new FakeNamedTest do
|
|
485
|
+
@tu = Class.new FakeNamedTest do
|
|
465
486
|
def test_something
|
|
466
487
|
assert true
|
|
467
488
|
end
|
|
468
489
|
end
|
|
469
490
|
|
|
470
|
-
expected =
|
|
491
|
+
expected = <<~EOM
|
|
471
492
|
.
|
|
472
493
|
|
|
473
494
|
Finished in 0.00
|
|
@@ -479,8 +500,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
479
500
|
end
|
|
480
501
|
|
|
481
502
|
def test_run_skip
|
|
482
|
-
@tu =
|
|
483
|
-
Class.new FakeNamedTest do
|
|
503
|
+
@tu = Class.new FakeNamedTest do
|
|
484
504
|
def test_something
|
|
485
505
|
assert true
|
|
486
506
|
end
|
|
@@ -490,7 +510,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
490
510
|
end
|
|
491
511
|
end
|
|
492
512
|
|
|
493
|
-
expected =
|
|
513
|
+
expected = <<~EOM
|
|
494
514
|
.S
|
|
495
515
|
|
|
496
516
|
Finished in 0.00
|
|
@@ -506,8 +526,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
506
526
|
end
|
|
507
527
|
|
|
508
528
|
def test_run_skip_verbose
|
|
509
|
-
@tu =
|
|
510
|
-
Class.new FakeNamedTest do
|
|
529
|
+
@tu = Class.new FakeNamedTest do
|
|
511
530
|
def test_something
|
|
512
531
|
assert true
|
|
513
532
|
end
|
|
@@ -517,7 +536,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
517
536
|
end
|
|
518
537
|
end
|
|
519
538
|
|
|
520
|
-
expected =
|
|
539
|
+
expected = <<~EOM
|
|
521
540
|
FakeNamedTestXX#test_something = 0.00 s = .
|
|
522
541
|
FakeNamedTestXX#test_skip = 0.00 s = S
|
|
523
542
|
|
|
@@ -534,8 +553,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
534
553
|
end
|
|
535
554
|
|
|
536
555
|
def test_run_skip_show_skips
|
|
537
|
-
@tu =
|
|
538
|
-
Class.new FakeNamedTest do
|
|
556
|
+
@tu = Class.new FakeNamedTest do
|
|
539
557
|
def test_something
|
|
540
558
|
assert true
|
|
541
559
|
end
|
|
@@ -545,7 +563,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
545
563
|
end
|
|
546
564
|
end
|
|
547
565
|
|
|
548
|
-
expected =
|
|
566
|
+
expected = <<~EOM
|
|
549
567
|
.S
|
|
550
568
|
|
|
551
569
|
Finished in 0.00
|
|
@@ -561,9 +579,8 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
561
579
|
end
|
|
562
580
|
|
|
563
581
|
def test_run_with_other_runner
|
|
564
|
-
@tu =
|
|
565
|
-
|
|
566
|
-
def self.run reporter, options = {}
|
|
582
|
+
@tu = Class.new FakeNamedTest do
|
|
583
|
+
def self.run_suite reporter, options = {}
|
|
567
584
|
@reporter = reporter
|
|
568
585
|
before_my_suite
|
|
569
586
|
super
|
|
@@ -585,7 +602,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
585
602
|
end
|
|
586
603
|
end
|
|
587
604
|
|
|
588
|
-
expected =
|
|
605
|
+
expected = <<~EOM
|
|
589
606
|
Running wacky! tests
|
|
590
607
|
..
|
|
591
608
|
|
|
@@ -634,8 +651,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
634
651
|
main_latch.release
|
|
635
652
|
}
|
|
636
653
|
|
|
637
|
-
@tu =
|
|
638
|
-
Class.new FakeNamedTest do
|
|
654
|
+
@tu = Class.new FakeNamedTest do
|
|
639
655
|
parallelize_me!
|
|
640
656
|
|
|
641
657
|
test_count.times do |i|
|
|
@@ -652,7 +668,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
652
668
|
end
|
|
653
669
|
end
|
|
654
670
|
|
|
655
|
-
expected =
|
|
671
|
+
expected = <<~EOM
|
|
656
672
|
..
|
|
657
673
|
|
|
658
674
|
Finished in 0.00
|
|
@@ -660,20 +676,20 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
|
660
676
|
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
|
|
661
677
|
EOM
|
|
662
678
|
|
|
663
|
-
skip
|
|
679
|
+
skip unless Minitest.parallel_executor # locks up test runner if 1 CPU
|
|
664
680
|
|
|
665
|
-
assert_report
|
|
666
|
-
reporter.extend
|
|
667
|
-
define_method
|
|
681
|
+
assert_report expected do |reporter|
|
|
682
|
+
reporter.extend Module.new {
|
|
683
|
+
define_method :record do |result|
|
|
668
684
|
super(result)
|
|
669
685
|
wait_latch.release
|
|
670
686
|
end
|
|
671
687
|
|
|
672
|
-
define_method
|
|
688
|
+
define_method :report do
|
|
673
689
|
wait_latch.await
|
|
674
690
|
super()
|
|
675
691
|
end
|
|
676
|
-
}
|
|
692
|
+
}
|
|
677
693
|
end
|
|
678
694
|
assert thread.join
|
|
679
695
|
end
|
|
@@ -684,8 +700,8 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
|
684
700
|
|
|
685
701
|
def test_before_setup
|
|
686
702
|
call_order = []
|
|
687
|
-
|
|
688
|
-
Class.new FakeNamedTest do
|
|
703
|
+
|
|
704
|
+
@tu = Class.new FakeNamedTest do
|
|
689
705
|
define_method :setup do
|
|
690
706
|
super()
|
|
691
707
|
call_order << :setup
|
|
@@ -700,14 +716,13 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
|
700
716
|
|
|
701
717
|
run_tu_with_fresh_reporter
|
|
702
718
|
|
|
703
|
-
expected = [
|
|
719
|
+
expected = %i[before_setup setup]
|
|
704
720
|
assert_equal expected, call_order
|
|
705
721
|
end
|
|
706
722
|
|
|
707
723
|
def test_after_teardown
|
|
708
724
|
call_order = []
|
|
709
|
-
@tu =
|
|
710
|
-
Class.new FakeNamedTest do
|
|
725
|
+
@tu = Class.new FakeNamedTest do
|
|
711
726
|
define_method :teardown do
|
|
712
727
|
super()
|
|
713
728
|
call_order << :teardown
|
|
@@ -722,14 +737,14 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
|
722
737
|
|
|
723
738
|
run_tu_with_fresh_reporter
|
|
724
739
|
|
|
725
|
-
expected = [
|
|
740
|
+
expected = %i[teardown after_teardown]
|
|
726
741
|
assert_equal expected, call_order
|
|
727
742
|
end
|
|
728
743
|
|
|
729
744
|
def test_all_teardowns_are_guaranteed_to_run
|
|
730
745
|
call_order = []
|
|
731
|
-
|
|
732
|
-
Class.new FakeNamedTest do
|
|
746
|
+
|
|
747
|
+
@tu = Class.new FakeNamedTest do
|
|
733
748
|
define_method :after_teardown do
|
|
734
749
|
super()
|
|
735
750
|
call_order << :after_teardown
|
|
@@ -753,7 +768,7 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
|
753
768
|
|
|
754
769
|
run_tu_with_fresh_reporter
|
|
755
770
|
|
|
756
|
-
expected = [
|
|
771
|
+
expected = %i[before_teardown teardown after_teardown]
|
|
757
772
|
assert_equal expected, call_order
|
|
758
773
|
end
|
|
759
774
|
|
|
@@ -780,7 +795,7 @@ class TestMinitestUnitOrder < MetaMetaMetaTestCase
|
|
|
780
795
|
run_tu_with_fresh_reporter
|
|
781
796
|
|
|
782
797
|
# Once for the parent class, once for the child
|
|
783
|
-
expected = [
|
|
798
|
+
expected = %i[setup_method test teardown_method] * 2
|
|
784
799
|
|
|
785
800
|
assert_equal expected, call_order
|
|
786
801
|
end
|
|
@@ -794,39 +809,6 @@ class BetterError < RuntimeError # like better_error w/o infecting RuntimeError
|
|
|
794
809
|
end
|
|
795
810
|
|
|
796
811
|
class TestMinitestRunnable < Minitest::Test
|
|
797
|
-
def setup_marshal klass
|
|
798
|
-
tc = klass.new "whatever"
|
|
799
|
-
tc.assertions = 42
|
|
800
|
-
tc.failures << "a failure"
|
|
801
|
-
|
|
802
|
-
yield tc if block_given?
|
|
803
|
-
|
|
804
|
-
def tc.setup
|
|
805
|
-
@blah = "blah"
|
|
806
|
-
end
|
|
807
|
-
tc.setup
|
|
808
|
-
|
|
809
|
-
@tc = Minitest::Result.from tc
|
|
810
|
-
end
|
|
811
|
-
|
|
812
|
-
def assert_marshal expected_ivars
|
|
813
|
-
new_tc = Marshal.load Marshal.dump @tc
|
|
814
|
-
|
|
815
|
-
ivars = new_tc.instance_variables.map(&:to_s).sort
|
|
816
|
-
assert_equal expected_ivars, ivars
|
|
817
|
-
assert_equal "whatever", new_tc.name
|
|
818
|
-
assert_equal 42, new_tc.assertions
|
|
819
|
-
assert_equal ["a failure"], new_tc.failures
|
|
820
|
-
|
|
821
|
-
yield new_tc if block_given?
|
|
822
|
-
end
|
|
823
|
-
|
|
824
|
-
def test_marshal
|
|
825
|
-
setup_marshal Minitest::Runnable
|
|
826
|
-
|
|
827
|
-
assert_marshal %w[@NAME @assertions @failures @klass @source_location @time]
|
|
828
|
-
end
|
|
829
|
-
|
|
830
812
|
def test_spec_marshal
|
|
831
813
|
klass = describe("whatever") { it("passes") { assert true } }
|
|
832
814
|
rm = klass.runnable_methods.first
|
|
@@ -876,11 +858,11 @@ class TestMinitestRunnable < Minitest::Test
|
|
|
876
858
|
end
|
|
877
859
|
|
|
878
860
|
def test_spec_marshal_with_exception_nameerror
|
|
879
|
-
klass = describe
|
|
880
|
-
it
|
|
861
|
+
klass = describe "whatever" do
|
|
862
|
+
it "raises NameError" do
|
|
881
863
|
NOPE::does_not_exist
|
|
882
|
-
|
|
883
|
-
|
|
864
|
+
end
|
|
865
|
+
end
|
|
884
866
|
|
|
885
867
|
rm = klass.runnable_methods.first
|
|
886
868
|
|
|
@@ -942,17 +924,47 @@ class TestMinitestRunnable < Minitest::Test
|
|
|
942
924
|
assert_equal @tc.failures, over_the_wire.failures
|
|
943
925
|
assert_equal @tc.klass, over_the_wire.klass
|
|
944
926
|
end
|
|
945
|
-
end
|
|
946
927
|
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
928
|
+
def test_spec_marshal_with_exception__worse_error_typeerror
|
|
929
|
+
worse_error_klass = Class.new StandardError do
|
|
930
|
+
# problem #1: anonymous subclass can't marshal, fails sanitize_exception
|
|
931
|
+
def initialize record = nil
|
|
932
|
+
super(record.first)
|
|
933
|
+
end
|
|
951
934
|
end
|
|
952
935
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
936
|
+
klass = describe("whatever") {
|
|
937
|
+
it("raises with NoMethodError") {
|
|
938
|
+
# problem #2: instantiated with a NON-string argument
|
|
939
|
+
#
|
|
940
|
+
# problem #3: arg responds to #first, but it becomes message
|
|
941
|
+
# which gets passed back in via new_exception
|
|
942
|
+
# that passes a string to worse_error_klass#initialize
|
|
943
|
+
# which calls first on it, which raises NoMethodError
|
|
944
|
+
raise worse_error_klass.new(["boom"])
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
rm = klass.runnable_methods.first
|
|
949
|
+
|
|
950
|
+
# Run the test
|
|
951
|
+
@tc = klass.new(rm).run
|
|
952
|
+
|
|
953
|
+
assert_kind_of Minitest::Result, @tc
|
|
954
|
+
assert_instance_of Minitest::UnexpectedError, @tc.failure
|
|
955
|
+
|
|
956
|
+
msg = @tc.failure.error.message.gsub(/0x[A-Fa-f0-9]+/, "0xXXX")
|
|
957
|
+
|
|
958
|
+
assert_equal "Neutered Exception #<Class:0xXXX>: boom", msg
|
|
959
|
+
|
|
960
|
+
# Pass it over the wire
|
|
961
|
+
over_the_wire = Marshal.load Marshal.dump @tc
|
|
962
|
+
|
|
963
|
+
assert_equal @tc.time, over_the_wire.time
|
|
964
|
+
assert_equal @tc.name, over_the_wire.name
|
|
965
|
+
assert_equal @tc.assertions, over_the_wire.assertions
|
|
966
|
+
assert_equal @tc.failures, over_the_wire.failures
|
|
967
|
+
assert_equal @tc.klass, over_the_wire.klass
|
|
956
968
|
end
|
|
957
969
|
end
|
|
958
970
|
|
|
@@ -961,8 +973,6 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
|
961
973
|
# which is not threadsafe. Nearly every method in here is an
|
|
962
974
|
# assertion test so it isn't worth splitting it out further.
|
|
963
975
|
|
|
964
|
-
RUBY18 = !defined? Encoding
|
|
965
|
-
|
|
966
976
|
def setup
|
|
967
977
|
super
|
|
968
978
|
|
|
@@ -975,7 +985,7 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
|
975
985
|
|
|
976
986
|
def teardown
|
|
977
987
|
assert_equal(@assertion_count, @tc.assertions,
|
|
978
|
-
"expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}") if @tc.passed?
|
|
988
|
+
message { "expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}" }) if @tc.passed?
|
|
979
989
|
end
|
|
980
990
|
|
|
981
991
|
def non_verbose
|
|
@@ -987,7 +997,7 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
|
987
997
|
$VERBOSE = orig_verbose
|
|
988
998
|
end
|
|
989
999
|
|
|
990
|
-
def sample_test_case
|
|
1000
|
+
def sample_test_case rand
|
|
991
1001
|
srand rand
|
|
992
1002
|
Class.new FakeNamedTest do
|
|
993
1003
|
100.times do |i|
|
|
@@ -1012,7 +1022,7 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
|
1012
1022
|
@assertion_count = 0
|
|
1013
1023
|
|
|
1014
1024
|
sample_test_case = Class.new FakeNamedTest do
|
|
1015
|
-
def self.
|
|
1025
|
+
def self.run_order; :sorted end
|
|
1016
1026
|
def test_test3; assert "does not matter" end
|
|
1017
1027
|
def test_test2; assert "does not matter" end
|
|
1018
1028
|
def test_test1; assert "does not matter" end
|
|
@@ -1022,14 +1032,14 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
|
1022
1032
|
assert_equal expected, sample_test_case.runnable_methods
|
|
1023
1033
|
end
|
|
1024
1034
|
|
|
1025
|
-
def
|
|
1035
|
+
def test_i_suck_and_my_tests_are_order_dependent_bang_sets_run_order_alpha
|
|
1026
1036
|
@assertion_count = 0
|
|
1027
1037
|
|
|
1028
1038
|
shitty_test_case = Class.new FakeNamedTest
|
|
1029
1039
|
|
|
1030
1040
|
shitty_test_case.i_suck_and_my_tests_are_order_dependent!
|
|
1031
1041
|
|
|
1032
|
-
assert_equal :alpha, shitty_test_case.
|
|
1042
|
+
assert_equal :alpha, shitty_test_case.run_order
|
|
1033
1043
|
end
|
|
1034
1044
|
|
|
1035
1045
|
def test_i_suck_and_my_tests_are_order_dependent_bang_does_not_warn
|
|
@@ -1037,7 +1047,7 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
|
1037
1047
|
|
|
1038
1048
|
shitty_test_case = Class.new FakeNamedTest
|
|
1039
1049
|
|
|
1040
|
-
def shitty_test_case.
|
|
1050
|
+
def shitty_test_case.run_order; :lol end
|
|
1041
1051
|
|
|
1042
1052
|
assert_silent do
|
|
1043
1053
|
shitty_test_case.i_suck_and_my_tests_are_order_dependent!
|
|
@@ -1046,17 +1056,27 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
|
1046
1056
|
|
|
1047
1057
|
def test_autorun_does_not_affect_fork_success_status
|
|
1048
1058
|
@assertion_count = 0
|
|
1049
|
-
skip "windows doesn't have
|
|
1059
|
+
skip "windows doesn't have fork" unless Process.respond_to? :fork
|
|
1050
1060
|
Process.waitpid(fork {})
|
|
1051
1061
|
assert_equal true, $?.success?
|
|
1052
1062
|
end
|
|
1053
1063
|
|
|
1054
1064
|
def test_autorun_does_not_affect_fork_exit_status
|
|
1055
1065
|
@assertion_count = 0
|
|
1056
|
-
skip "windows doesn't have
|
|
1066
|
+
skip "windows doesn't have fork" unless Process.respond_to? :fork
|
|
1057
1067
|
Process.waitpid(fork { exit 42 })
|
|
1058
1068
|
assert_equal 42, $?.exitstatus
|
|
1059
1069
|
end
|
|
1070
|
+
|
|
1071
|
+
def test_autorun_optionally_can_affect_fork_exit_status
|
|
1072
|
+
@assertion_count = 0
|
|
1073
|
+
skip "windows doesn't have fork" unless Process.respond_to? :fork
|
|
1074
|
+
Minitest.allow_fork = true
|
|
1075
|
+
Process.waitpid(fork { exit 42 })
|
|
1076
|
+
refute_equal 42, $?.exitstatus
|
|
1077
|
+
ensure
|
|
1078
|
+
Minitest.allow_fork = false
|
|
1079
|
+
end
|
|
1060
1080
|
end
|
|
1061
1081
|
|
|
1062
1082
|
class TestMinitestGuard < Minitest::Test
|
|
@@ -1072,24 +1092,6 @@ class TestMinitestGuard < Minitest::Test
|
|
|
1072
1092
|
assert self.jruby? "java"
|
|
1073
1093
|
end
|
|
1074
1094
|
|
|
1075
|
-
def test_rubinius_eh
|
|
1076
|
-
assert_output "", /DEPRECATED/ do
|
|
1077
|
-
assert self.class.rubinius? "rbx"
|
|
1078
|
-
end
|
|
1079
|
-
assert_output "", /DEPRECATED/ do
|
|
1080
|
-
assert self.rubinius? "rbx"
|
|
1081
|
-
end
|
|
1082
|
-
end
|
|
1083
|
-
|
|
1084
|
-
def test_maglev_eh
|
|
1085
|
-
assert_output "", /DEPRECATED/ do
|
|
1086
|
-
assert self.class.maglev? "maglev"
|
|
1087
|
-
end
|
|
1088
|
-
assert_output "", /DEPRECATED/ do
|
|
1089
|
-
assert self.maglev? "maglev"
|
|
1090
|
-
end
|
|
1091
|
-
end
|
|
1092
|
-
|
|
1093
1095
|
def test_osx_eh
|
|
1094
1096
|
assert self.class.osx? "darwin"
|
|
1095
1097
|
assert self.osx? "darwin"
|
|
@@ -1114,35 +1116,6 @@ class TestMinitestUnitRecording < MetaMetaMetaTestCase
|
|
|
1114
1116
|
assert_equal expected, recorded
|
|
1115
1117
|
end
|
|
1116
1118
|
|
|
1117
|
-
def test_run_with_bogus_reporter
|
|
1118
|
-
# https://github.com/seattlerb/minitest/issues/659
|
|
1119
|
-
# TODO: remove test for minitest 6
|
|
1120
|
-
@tu = Class.new FakeNamedTest do
|
|
1121
|
-
def test_method
|
|
1122
|
-
assert true
|
|
1123
|
-
end
|
|
1124
|
-
end
|
|
1125
|
-
|
|
1126
|
-
bogus_reporter = Class.new do # doesn't subclass AbstractReporter
|
|
1127
|
-
def start; @success = false; end
|
|
1128
|
-
# def prerecord klass, name; end # doesn't define full API
|
|
1129
|
-
def record result; @success = true; end
|
|
1130
|
-
def report; end
|
|
1131
|
-
def passed?; end
|
|
1132
|
-
def results; end
|
|
1133
|
-
def success?; @success; end
|
|
1134
|
-
end.new
|
|
1135
|
-
|
|
1136
|
-
self.reporter = Minitest::CompositeReporter.new
|
|
1137
|
-
reporter << bogus_reporter
|
|
1138
|
-
|
|
1139
|
-
Minitest::Runnable.runnables.delete @tu
|
|
1140
|
-
|
|
1141
|
-
@tu.run reporter, {}
|
|
1142
|
-
|
|
1143
|
-
assert_predicate bogus_reporter, :success?
|
|
1144
|
-
end
|
|
1145
|
-
|
|
1146
1119
|
def test_record_passing
|
|
1147
1120
|
assert_run_record do
|
|
1148
1121
|
def test_method
|
|
@@ -1204,17 +1177,17 @@ class TestMinitestUnitRecording < MetaMetaMetaTestCase
|
|
|
1204
1177
|
|
|
1205
1178
|
run_tu_with_fresh_reporter
|
|
1206
1179
|
|
|
1207
|
-
exp =
|
|
1180
|
+
exp = <<~EOM
|
|
1208
1181
|
Error:
|
|
1209
1182
|
FakeNamedTestXX#test_method:
|
|
1210
1183
|
AnError: AnError
|
|
1211
|
-
FILE:LINE:in
|
|
1184
|
+
FILE:LINE:in 'test_method'
|
|
1212
1185
|
|
|
1213
1186
|
Error:
|
|
1214
1187
|
FakeNamedTestXX#test_method:
|
|
1215
1188
|
RuntimeError: unhandled exception
|
|
1216
|
-
FILE:LINE:in
|
|
1217
|
-
|
|
1189
|
+
FILE:LINE:in 'teardown'
|
|
1190
|
+
EOM
|
|
1218
1191
|
|
|
1219
1192
|
assert_equal exp.strip, normalize_output(first_reporter.results.first.to_s).strip
|
|
1220
1193
|
end
|
|
@@ -1227,3 +1200,96 @@ class TestMinitestUnitRecording < MetaMetaMetaTestCase
|
|
|
1227
1200
|
end
|
|
1228
1201
|
end
|
|
1229
1202
|
end
|
|
1203
|
+
|
|
1204
|
+
class TestUnexpectedError < Minitest::Test
|
|
1205
|
+
def assert_compress exp, input
|
|
1206
|
+
e = Minitest::UnexpectedError.new RuntimeError.new
|
|
1207
|
+
|
|
1208
|
+
exp = exp.lines.map(&:chomp) if String === exp
|
|
1209
|
+
act = e.compress input
|
|
1210
|
+
|
|
1211
|
+
assert_equal exp, act
|
|
1212
|
+
end
|
|
1213
|
+
|
|
1214
|
+
ACT1 = %w[ a b c b c b c b c d ]
|
|
1215
|
+
|
|
1216
|
+
def test_normal
|
|
1217
|
+
assert_compress <<~EXP, %w[ a b c b c b c b c d ]
|
|
1218
|
+
a
|
|
1219
|
+
+->> 4 cycles of 2 lines:
|
|
1220
|
+
| b
|
|
1221
|
+
| c
|
|
1222
|
+
+-<<
|
|
1223
|
+
d
|
|
1224
|
+
EXP
|
|
1225
|
+
end
|
|
1226
|
+
|
|
1227
|
+
def test_normal2
|
|
1228
|
+
assert_compress <<~EXP, %w[ a b c b c b c b c ]
|
|
1229
|
+
a
|
|
1230
|
+
+->> 4 cycles of 2 lines:
|
|
1231
|
+
| b
|
|
1232
|
+
| c
|
|
1233
|
+
+-<<
|
|
1234
|
+
EXP
|
|
1235
|
+
end
|
|
1236
|
+
|
|
1237
|
+
def test_longer_c_than_b
|
|
1238
|
+
# the extra c in the front makes the overall length longer sorting it first
|
|
1239
|
+
assert_compress <<~EXP, %w[ c a b c b c b c b c b d ]
|
|
1240
|
+
c
|
|
1241
|
+
a
|
|
1242
|
+
b
|
|
1243
|
+
+->> 4 cycles of 2 lines:
|
|
1244
|
+
| c
|
|
1245
|
+
| b
|
|
1246
|
+
+-<<
|
|
1247
|
+
d
|
|
1248
|
+
EXP
|
|
1249
|
+
end
|
|
1250
|
+
|
|
1251
|
+
def test_1_line_cycles
|
|
1252
|
+
assert_compress <<~EXP, %w[ c a b c b c b c b c b b b d ]
|
|
1253
|
+
c
|
|
1254
|
+
a
|
|
1255
|
+
+->> 4 cycles of 2 lines:
|
|
1256
|
+
| b
|
|
1257
|
+
| c
|
|
1258
|
+
+-<<
|
|
1259
|
+
+->> 3 cycles of 1 lines:
|
|
1260
|
+
| b
|
|
1261
|
+
+-<<
|
|
1262
|
+
d
|
|
1263
|
+
EXP
|
|
1264
|
+
end
|
|
1265
|
+
|
|
1266
|
+
def test_sanity3
|
|
1267
|
+
pre = ("aa".."am").to_a
|
|
1268
|
+
mid = ("a".."z").to_a * 67
|
|
1269
|
+
post = ("aa".."am").to_a
|
|
1270
|
+
ary = pre + mid + post
|
|
1271
|
+
|
|
1272
|
+
exp = pre +
|
|
1273
|
+
[" +->> 67 cycles of 26 lines:"] +
|
|
1274
|
+
("a".."z").map { |s| " | #{s}" } +
|
|
1275
|
+
[" +-<<"] +
|
|
1276
|
+
post
|
|
1277
|
+
|
|
1278
|
+
assert_compress exp, ary
|
|
1279
|
+
end
|
|
1280
|
+
|
|
1281
|
+
def test_absurd_patterns
|
|
1282
|
+
assert_compress <<~EXP, %w[ a b c b c a b c b c a b c ]
|
|
1283
|
+
+->> 2 cycles of 5 lines:
|
|
1284
|
+
| a
|
|
1285
|
+
| +->> 2 cycles of 2 lines:
|
|
1286
|
+
| | b
|
|
1287
|
+
| | c
|
|
1288
|
+
| +-<<
|
|
1289
|
+
+-<<
|
|
1290
|
+
a
|
|
1291
|
+
b
|
|
1292
|
+
c
|
|
1293
|
+
EXP
|
|
1294
|
+
end
|
|
1295
|
+
end
|