test-unit 3.1.5 → 3.6.1

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.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/BSDL +24 -0
  3. data/COPYING +41 -41
  4. data/README.md +24 -17
  5. data/Rakefile +21 -24
  6. data/doc/text/getting-started.md +246 -0
  7. data/doc/text/news.md +797 -56
  8. data/lib/test/unit/assertion-failed-error.rb +35 -0
  9. data/lib/test/unit/assertions.rb +542 -220
  10. data/lib/test/unit/attribute.rb +78 -4
  11. data/lib/test/unit/auto-runner-loader.rb +17 -0
  12. data/lib/test/unit/autorunner.rb +175 -78
  13. data/lib/test/unit/code-snippet-fetcher.rb +7 -7
  14. data/lib/test/unit/collector/descendant.rb +1 -0
  15. data/lib/test/unit/collector/dir.rb +4 -2
  16. data/lib/test/unit/collector/load.rb +25 -15
  17. data/lib/test/unit/collector/objectspace.rb +1 -0
  18. data/lib/test/unit/collector.rb +31 -0
  19. data/lib/test/unit/color-scheme.rb +29 -2
  20. data/lib/test/unit/data-sets.rb +127 -0
  21. data/lib/test/unit/data.rb +121 -12
  22. data/lib/test/unit/diff.rb +10 -11
  23. data/lib/test/unit/fixture.rb +77 -27
  24. data/lib/test/unit/notification.rb +9 -7
  25. data/lib/test/unit/omission.rb +34 -31
  26. data/lib/test/unit/pending.rb +12 -11
  27. data/lib/test/unit/priority.rb +7 -5
  28. data/lib/test/unit/runner/console.rb +20 -1
  29. data/lib/test/unit/test-suite-creator.rb +30 -9
  30. data/lib/test/unit/testcase.rb +349 -196
  31. data/lib/test/unit/testresult.rb +7 -0
  32. data/lib/test/unit/testsuite.rb +1 -1
  33. data/lib/test/unit/ui/console/testrunner.rb +171 -60
  34. data/lib/test/unit/ui/emacs/testrunner.rb +5 -5
  35. data/lib/test/unit/ui/testrunnermediator.rb +9 -7
  36. data/lib/test/unit/util/backtracefilter.rb +17 -5
  37. data/lib/test/unit/util/memory-usage.rb +47 -0
  38. data/lib/test/unit/util/observable.rb +2 -2
  39. data/lib/test/unit/util/output.rb +5 -4
  40. data/lib/test/unit/util/procwrapper.rb +4 -4
  41. data/lib/test/unit/version.rb +1 -1
  42. data/lib/test/unit/warning.rb +3 -0
  43. data/lib/test/unit.rb +177 -161
  44. data/lib/test-unit.rb +2 -17
  45. metadata +20 -94
  46. data/GPL +0 -339
  47. data/LGPL +0 -502
  48. data/test/collector/test-descendant.rb +0 -178
  49. data/test/collector/test-load.rb +0 -442
  50. data/test/collector/test_dir.rb +0 -406
  51. data/test/collector/test_objectspace.rb +0 -100
  52. data/test/fixtures/header-label.csv +0 -3
  53. data/test/fixtures/header-label.tsv +0 -3
  54. data/test/fixtures/header.csv +0 -3
  55. data/test/fixtures/header.tsv +0 -3
  56. data/test/fixtures/no-header.csv +0 -2
  57. data/test/fixtures/no-header.tsv +0 -2
  58. data/test/fixtures/plus.csv +0 -3
  59. data/test/run-test.rb +0 -22
  60. data/test/test-assertions.rb +0 -2157
  61. data/test/test-attribute-matcher.rb +0 -38
  62. data/test/test-attribute.rb +0 -123
  63. data/test/test-code-snippet.rb +0 -37
  64. data/test/test-color-scheme.rb +0 -82
  65. data/test/test-color.rb +0 -47
  66. data/test/test-data.rb +0 -281
  67. data/test/test-diff.rb +0 -518
  68. data/test/test-emacs-runner.rb +0 -60
  69. data/test/test-error.rb +0 -26
  70. data/test/test-failure.rb +0 -33
  71. data/test/test-fault-location-detector.rb +0 -163
  72. data/test/test-fixture.rb +0 -659
  73. data/test/test-notification.rb +0 -33
  74. data/test/test-omission.rb +0 -81
  75. data/test/test-pending.rb +0 -70
  76. data/test/test-priority.rb +0 -173
  77. data/test/test-test-case.rb +0 -1171
  78. data/test/test-test-result.rb +0 -113
  79. data/test/test-test-suite-creator.rb +0 -97
  80. data/test/test-test-suite.rb +0 -150
  81. data/test/testunit-test-util.rb +0 -31
  82. data/test/ui/test_testrunmediator.rb +0 -20
  83. data/test/util/test-method-owner-finder.rb +0 -38
  84. data/test/util/test-output.rb +0 -11
  85. data/test/util/test_backtracefilter.rb +0 -41
  86. data/test/util/test_observable.rb +0 -102
  87. data/test/util/test_procwrapper.rb +0 -36
data/test/test-fixture.rb DELETED
@@ -1,659 +0,0 @@
1
- class TestUnitFixture < Test::Unit::TestCase
2
- module EmptyModule
3
- end
4
-
5
- class TestSetup < self
6
- def test_without_option
7
- expected_setup_calls = [:setup,
8
- :custom_setup_method0,
9
- :custom_setup_callback0,
10
- :custom_setup_method1,
11
- :custom_setup_callback1,
12
- :custom_setup_method3,
13
- :custom_setup_callback3]
14
- test_case = assert_setup(expected_setup_calls, [])
15
- assert_inherited_setup(expected_setup_calls, test_case)
16
-
17
- assert_inherited_setup([:setup], nil)
18
- assert_called_fixtures(expected_setup_calls, test_case)
19
- end
20
-
21
- def test_with_before_option
22
- expected_setup_calls = [:custom_setup_callback3,
23
- :custom_setup_method3,
24
- :custom_setup_method0,
25
- :custom_setup_callback0,
26
- :custom_setup_method1,
27
- :custom_setup_callback1,
28
- :setup]
29
- test_case = assert_setup(expected_setup_calls,
30
- [[{:before => :append}],
31
- [{:before => :append}],
32
- [{:before => :prepend}],
33
- [{:before => :prepend}]])
34
- assert_inherited_setup(expected_setup_calls, test_case)
35
-
36
- assert_inherited_setup([:setup], nil)
37
- assert_called_fixtures(expected_setup_calls, test_case)
38
- end
39
-
40
- def test_with_after_option
41
- expected_setup_calls = [:setup,
42
- :custom_setup_callback3,
43
- :custom_setup_method3,
44
- :custom_setup_method0,
45
- :custom_setup_callback0,
46
- :custom_setup_method1,
47
- :custom_setup_callback1]
48
- test_case = assert_setup(expected_setup_calls,
49
- [[{:after => :append}],
50
- [{:after => :append}],
51
- [{:after => :prepend}],
52
- [{:after => :prepend}]])
53
- assert_inherited_setup(expected_setup_calls, test_case)
54
-
55
- assert_inherited_setup([:setup], nil)
56
- assert_called_fixtures(expected_setup_calls, test_case)
57
- end
58
-
59
- def test_with_invalid_option
60
- assert_invalid_setup_option(:unknown => true)
61
- assert_invalid_setup_option(:before => :unknown)
62
- assert_invalid_setup_option(:after => :unknown)
63
- end
64
-
65
- def test_with_option_to_inherited
66
- expected_setup_calls = [:setup]
67
- test_case = assert_setup(expected_setup_calls, nil)
68
- assert_inherited_setup([:setup,
69
- :custom_setup_method0,
70
- :custom_setup_callback0,
71
- :custom_setup_method1,
72
- :custom_setup_callback1,
73
- :custom_setup_method3,
74
- :custom_setup_callback3],
75
- test_case,
76
- [])
77
-
78
- assert_inherited_setup([:setup], nil)
79
- assert_called_fixtures(expected_setup_calls, test_case)
80
- end
81
-
82
- private
83
- def assert_setup_customizable(expected, parent, options)
84
- test_case = Class.new(parent || Test::Unit::TestCase) do
85
- yield(self, :before) if block_given?
86
-
87
- def called_ids
88
- @called_ids ||= []
89
- end
90
-
91
- def called(id)
92
- called_ids << id
93
- end
94
-
95
- def setup
96
- called(:setup)
97
- end
98
-
99
- setup(*(options[0] || [])) if options
100
- def custom_setup_method0
101
- called(:custom_setup_method0)
102
- end
103
-
104
- if options
105
- setup(*(options[0] || [])) do
106
- called(:custom_setup_callback0)
107
- end
108
- end
109
-
110
- def custom_setup_method1
111
- called(:custom_setup_method1)
112
- end
113
- setup(*[:custom_setup_method1, *(options[1] || [])]) if options
114
-
115
- if options
116
- setup(*(options[1] || [])) do
117
- called(:custom_setup_callback1)
118
- end
119
- end
120
-
121
- setup(*(options[2] || [])) if options
122
- def custom_setup_method2
123
- called(:custom_setup_method2)
124
- end
125
- unregister_setup(:custom_setup_method2) if options
126
-
127
- if options
128
- callback = lambda do
129
- called(:custom_setup_callback2)
130
- end
131
- setup(*(options[2] || []), &callback)
132
- unregister_setup(callback)
133
- end
134
-
135
- setup(*(options[3] || [])) if options
136
- def custom_setup_method3
137
- called(:custom_setup_method3)
138
- end
139
-
140
- if options
141
- setup(*(options[3] || [])) do
142
- called(:custom_setup_callback3)
143
- end
144
- end
145
-
146
- def test_nothing
147
- end
148
-
149
- yield(self, :after) if block_given?
150
- end
151
-
152
- assert_called_fixtures(expected, test_case)
153
- test_case
154
- end
155
-
156
- def assert_setup(expected, options)
157
- _test_case = assert_setup_customizable(expected, nil, options)
158
- assert_setup_customizable(expected, nil, options) do |test_case, tag|
159
- test_case.send(:include, EmptyModule) if tag == :before
160
- end
161
- _test_case
162
- end
163
-
164
- def assert_inherited_setup(expected, parent, options=nil)
165
- _test_case = assert_setup_customizable(expected, parent, options)
166
- assert_setup_customizable(expected, parent, options) do |test_case, tag|
167
- test_case.send(:include, EmptyModule) if tag == :before
168
- end
169
- _test_case
170
- end
171
-
172
- def assert_invalid_setup_option(option)
173
- assert_invalid_option(:setup, option)
174
- end
175
- end
176
-
177
- class TestCleanup < self
178
- def test_without_option
179
- expected_cleanup_calls = [:custom_cleanup_callback3,
180
- :custom_cleanup_method3,
181
- :custom_cleanup_callback1,
182
- :custom_cleanup_method1,
183
- :custom_cleanup_callback0,
184
- :custom_cleanup_method0,
185
- :cleanup]
186
- test_case = assert_cleanup(expected_cleanup_calls, [])
187
- assert_inherited_cleanup(expected_cleanup_calls, test_case)
188
-
189
- assert_inherited_cleanup([:cleanup], nil)
190
- assert_called_fixtures(expected_cleanup_calls, test_case)
191
- end
192
-
193
- def test_with_before_option
194
- expected_cleanup_calls = [:custom_cleanup_callback3,
195
- :custom_cleanup_method3,
196
- :custom_cleanup_method0,
197
- :custom_cleanup_callback0,
198
- :custom_cleanup_method1,
199
- :custom_cleanup_callback1,
200
- :cleanup]
201
- test_case = assert_cleanup(expected_cleanup_calls,
202
- [[{:before => :append}],
203
- [{:before => :append}],
204
- [{:before => :prepend}],
205
- [{:before => :prepend}]])
206
- assert_inherited_cleanup(expected_cleanup_calls, test_case)
207
-
208
- assert_inherited_cleanup([:cleanup], nil)
209
- assert_called_fixtures(expected_cleanup_calls, test_case)
210
- end
211
-
212
- def test_with_after_option
213
- expected_cleanup_calls = [:cleanup,
214
- :custom_cleanup_callback3,
215
- :custom_cleanup_method3,
216
- :custom_cleanup_method0,
217
- :custom_cleanup_callback0,
218
- :custom_cleanup_method1,
219
- :custom_cleanup_callback1]
220
- test_case = assert_cleanup(expected_cleanup_calls,
221
- [[{:after => :append}],
222
- [{:after => :append}],
223
- [{:after => :prepend}],
224
- [{:after => :prepend}]])
225
- assert_inherited_cleanup(expected_cleanup_calls, test_case)
226
-
227
- assert_inherited_cleanup([:cleanup], nil)
228
- assert_called_fixtures(expected_cleanup_calls, test_case)
229
- end
230
-
231
- def test_with_invalid_option
232
- assert_invalid_cleanup_option(:unknown => true)
233
- assert_invalid_cleanup_option(:before => :unknown)
234
- assert_invalid_cleanup_option(:after => :unknown)
235
- end
236
-
237
- def test_with_option_to_inherited
238
- expected_cleanup_calls = [:cleanup]
239
- test_case = assert_cleanup(expected_cleanup_calls, nil)
240
- assert_inherited_cleanup([:custom_cleanup_callback3,
241
- :custom_cleanup_method3,
242
- :custom_cleanup_callback1,
243
- :custom_cleanup_method1,
244
- :custom_cleanup_callback0,
245
- :custom_cleanup_method0,
246
- :cleanup],
247
- test_case, [])
248
-
249
- assert_inherited_cleanup([:cleanup], nil)
250
- assert_called_fixtures(expected_cleanup_calls, test_case)
251
- end
252
-
253
- def test_with_exception
254
- test_case = Class.new(Test::Unit::TestCase) do
255
- def called_ids
256
- @called_ids ||= []
257
- end
258
-
259
- def called(id)
260
- called_ids << id
261
- end
262
-
263
- def cleanup
264
- called(:cleanup)
265
- raise "cleanup"
266
- end
267
-
268
- cleanup
269
- def custom_cleanup_method0
270
- called(:custom_cleanup_method0)
271
- raise "custom_cleanup_method0"
272
- end
273
-
274
- cleanup do
275
- called(:custom_cleanup_callback0)
276
- raise "custom_cleanup_callback0"
277
- end
278
-
279
- cleanup
280
- def custom_cleanup_method1
281
- called(:custom_cleanup_method1)
282
- raise "custom_cleanup_method1"
283
- end
284
-
285
- cleanup do
286
- called(:custom_cleanup_callback1)
287
- raise "custom_cleanup_callback1"
288
- end
289
-
290
- def test_nothing
291
- end
292
- end
293
-
294
- assert_called_fixtures([:custom_cleanup_callback1],
295
- test_case)
296
- end
297
-
298
- private
299
- def assert_cleanup_customizable(expected, parent, options)
300
- test_case = Class.new(parent || Test::Unit::TestCase) do
301
- yield(self, :before) if block_given?
302
-
303
- def called_ids
304
- @called_ids ||= []
305
- end
306
-
307
- def called(id)
308
- called_ids << id
309
- end
310
-
311
- def cleanup
312
- called(:cleanup)
313
- end
314
-
315
- cleanup(*(options[0] || [])) if options
316
- def custom_cleanup_method0
317
- called(:custom_cleanup_method0)
318
- end
319
-
320
- if options
321
- cleanup(*(options[0] || [])) do
322
- called(:custom_cleanup_callback0)
323
- end
324
- end
325
-
326
- def custom_cleanup_method1
327
- called(:custom_cleanup_method1)
328
- end
329
- cleanup(*[:custom_cleanup_method1, *(options[1] || [])]) if options
330
-
331
- if options
332
- cleanup(*(options[1] || [])) do
333
- called(:custom_cleanup_callback1)
334
- end
335
- end
336
-
337
- cleanup(*(options[2] || [])) if options
338
- def custom_cleanup_method2
339
- called(:custom_cleanup_method2)
340
- end
341
- unregister_cleanup(:custom_cleanup_method2) if options
342
-
343
- if options
344
- callback = lambda do
345
- called(:custom_cleanup_callback2)
346
- end
347
- cleanup(*(options[2] || []), &callback)
348
- unregister_cleanup(callback)
349
- end
350
-
351
- cleanup(*(options[3] || [])) if options
352
- def custom_cleanup_method3
353
- called(:custom_cleanup_method3)
354
- end
355
-
356
- if options
357
- cleanup(*(options[3] || [])) do
358
- called(:custom_cleanup_callback3)
359
- end
360
- end
361
-
362
- def test_nothing
363
- end
364
-
365
- yield(self, :after) if block_given?
366
- end
367
-
368
- assert_called_fixtures(expected, test_case)
369
- test_case
370
- end
371
-
372
- def assert_cleanup(expected, options)
373
- assert_cleanup_customizable(expected, nil, options)
374
- assert_cleanup_customizable(expected, nil, options) do |test_case, tag|
375
- test_case.send(:include, EmptyModule) if tag == :before
376
- end
377
- end
378
-
379
- def assert_inherited_cleanup(expected, parent, options=nil)
380
- assert_cleanup_customizable(expected, parent, options)
381
- assert_cleanup_customizable(expected, parent, options) do |test_case, tag|
382
- test_case.send(:include, EmptyModule) if tag == :before
383
- end
384
- end
385
-
386
- def assert_invalid_cleanup_option(option)
387
- assert_invalid_option(:cleanup, option)
388
- end
389
- end
390
-
391
- class TestTeardown < self
392
- def test_without_option
393
- expected_teardown_calls = [:custom_teardown_callback3,
394
- :custom_teardown_method3,
395
- :custom_teardown_callback1,
396
- :custom_teardown_method1,
397
- :custom_teardown_callback0,
398
- :custom_teardown_method0,
399
- :teardown]
400
- test_case = assert_teardown(expected_teardown_calls, [])
401
- assert_inherited_teardown(expected_teardown_calls, test_case)
402
-
403
- assert_inherited_teardown([:teardown], nil)
404
- assert_called_fixtures(expected_teardown_calls, test_case)
405
- end
406
-
407
- def test_with_before_option
408
- expected_teardown_calls = [:custom_teardown_callback3,
409
- :custom_teardown_method3,
410
- :custom_teardown_method0,
411
- :custom_teardown_callback0,
412
- :custom_teardown_method1,
413
- :custom_teardown_callback1,
414
- :teardown]
415
- test_case = assert_teardown(expected_teardown_calls,
416
- [[{:before => :append}],
417
- [{:before => :append}],
418
- [{:before => :prepend}],
419
- [{:before => :prepend}]])
420
- assert_inherited_teardown(expected_teardown_calls, test_case)
421
-
422
- assert_inherited_teardown([:teardown], nil)
423
- assert_called_fixtures(expected_teardown_calls, test_case)
424
- end
425
-
426
- def test_with_after_option
427
- expected_teardown_calls = [:teardown,
428
- :custom_teardown_callback3,
429
- :custom_teardown_method3,
430
- :custom_teardown_method0,
431
- :custom_teardown_callback0,
432
- :custom_teardown_method1,
433
- :custom_teardown_callback1]
434
- test_case = assert_teardown(expected_teardown_calls,
435
- [[{:after => :append}],
436
- [{:after => :append}],
437
- [{:after => :prepend}],
438
- [{:after => :prepend}]])
439
- assert_inherited_teardown(expected_teardown_calls, test_case)
440
-
441
- assert_inherited_teardown([:teardown], nil)
442
- assert_called_fixtures(expected_teardown_calls, test_case)
443
- end
444
-
445
- def test_with_invalid_option
446
- assert_invalid_teardown_option(:unknown => true)
447
- assert_invalid_teardown_option(:before => :unknown)
448
- assert_invalid_teardown_option(:after => :unknown)
449
- end
450
-
451
- def test_with_option_to_inherited
452
- expected_teardown_calls = [:teardown]
453
- test_case = assert_teardown(expected_teardown_calls, nil)
454
- assert_inherited_teardown([:custom_teardown_callback3,
455
- :custom_teardown_method3,
456
- :custom_teardown_callback1,
457
- :custom_teardown_method1,
458
- :custom_teardown_callback0,
459
- :custom_teardown_method0,
460
- :teardown],
461
- test_case, [])
462
-
463
- assert_inherited_teardown([:teardown], nil)
464
- assert_called_fixtures(expected_teardown_calls, test_case)
465
- end
466
-
467
- def test_with_exception
468
- test_case = Class.new(Test::Unit::TestCase) do
469
- def called_ids
470
- @called_ids ||= []
471
- end
472
-
473
- def called(id)
474
- called_ids << id
475
- end
476
-
477
- def teardown
478
- called(:teardown)
479
- raise "teardown"
480
- end
481
-
482
- teardown
483
- def custom_teardown_method0
484
- called(:custom_teardown_method0)
485
- raise "custom_teardown_method0"
486
- end
487
-
488
- teardown do
489
- called(:custom_teardown_callback0)
490
- raise "custom_teardown_callback0"
491
- end
492
-
493
- teardown
494
- def custom_teardown_method1
495
- called(:custom_teardown_method1)
496
- raise "custom_teardown_method1"
497
- end
498
-
499
- teardown do
500
- called(:custom_teardown_callback1)
501
- raise "custom_teardown_callback1"
502
- end
503
-
504
- def test_nothing
505
- end
506
- end
507
-
508
- assert_called_fixtures([:custom_teardown_callback1,
509
- :custom_teardown_method1,
510
- :custom_teardown_callback0,
511
- :custom_teardown_method0,
512
- :teardown],
513
- test_case)
514
- end
515
-
516
- def test_nested
517
- called = []
518
- parent_test_case = Class.new(Test::Unit::TestCase) do
519
- teardown do
520
- called << :parent
521
- end
522
- end
523
-
524
- child_test_case = Class.new(parent_test_case) do
525
- teardown do
526
- called << :child
527
- end
528
-
529
- def test_nothing
530
- end
531
- end
532
-
533
- run_test_nothing(child_test_case)
534
- assert_equal([:child, :parent],
535
- called)
536
- end
537
-
538
- private
539
- def assert_teardown_customizable(expected, parent, options)
540
- test_case = Class.new(parent || Test::Unit::TestCase) do
541
- yield(self, :before) if block_given?
542
-
543
- def called_ids
544
- @called_ids ||= []
545
- end
546
-
547
- def called(id)
548
- called_ids << id
549
- end
550
-
551
- def teardown
552
- called(:teardown)
553
- end
554
-
555
- teardown(*(options[0] || [])) if options
556
- def custom_teardown_method0
557
- called(:custom_teardown_method0)
558
- end
559
-
560
- if options
561
- teardown(*(options[0] || [])) do
562
- called(:custom_teardown_callback0)
563
- end
564
- end
565
-
566
- def custom_teardown_method1
567
- called(:custom_teardown_method1)
568
- end
569
- teardown(*[:custom_teardown_method1, *(options[1] || [])]) if options
570
-
571
- if options
572
- teardown(*(options[1] || [])) do
573
- called(:custom_teardown_callback1)
574
- end
575
- end
576
-
577
- teardown(*(options[2] || [])) if options
578
- def custom_teardown_method2
579
- called(:custom_teardown_method2)
580
- end
581
- unregister_teardown(:custom_teardown_method2) if options
582
-
583
- if options
584
- callback = lambda do
585
- called(:custom_teardown_callback2)
586
- end
587
- teardown(*(options[2] || []), &callback)
588
- unregister_teardown(callback)
589
- end
590
-
591
- teardown(*(options[3] || [])) if options
592
- def custom_teardown_method3
593
- called(:custom_teardown_method3)
594
- end
595
-
596
- if options
597
- teardown(*(options[3] || [])) do
598
- called(:custom_teardown_callback3)
599
- end
600
- end
601
-
602
- def test_nothing
603
- end
604
-
605
- yield(self, :after) if block_given?
606
- end
607
-
608
- assert_called_fixtures(expected, test_case)
609
- test_case
610
- end
611
-
612
- def assert_teardown(expected, options)
613
- assert_teardown_customizable(expected, nil, options)
614
- assert_teardown_customizable(expected, nil, options) do |test_case, tag|
615
- test_case.send(:include, EmptyModule) if tag == :before
616
- end
617
- end
618
-
619
- def assert_inherited_teardown(expected, parent, options=nil)
620
- assert_teardown_customizable(expected, parent, options)
621
- assert_teardown_customizable(expected, parent, options) do |test_case, tag|
622
- test_case.send(:include, EmptyModule) if tag == :before
623
- end
624
- end
625
-
626
- def assert_invalid_teardown_option(option)
627
- assert_invalid_option(:teardown, option)
628
- end
629
- end
630
-
631
- private
632
- def run_test_nothing(test_case)
633
- test = test_case.new("test_nothing")
634
- test.run(Test::Unit::TestResult.new) {}
635
- test
636
- end
637
-
638
- def assert_called_fixtures(expected, test_case)
639
- test = run_test_nothing(test_case)
640
- assert_equal(expected, test.called_ids)
641
- end
642
-
643
- def assert_invalid_option(fixture_type, option)
644
- exception = assert_raise(ArgumentError) do
645
- Class.new(Test::Unit::TestCase) do
646
- def test_nothing
647
- end
648
-
649
- send(fixture_type, option)
650
- def fixture
651
- end
652
- end
653
- end
654
- assert_equal("must be {:before => :prepend}, {:before => :append}, " +
655
- "{:after => :prepend} or {:after => :append}" +
656
- ": #{option.inspect}",
657
- exception.message)
658
- end
659
- end
@@ -1,33 +0,0 @@
1
- require 'test/unit'
2
- require 'testunit-test-util'
3
-
4
- class TestUnitNotification < Test::Unit::TestCase
5
- include TestUnitTestUtil
6
-
7
- class TestCase < Test::Unit::TestCase
8
- class << self
9
- def suite
10
- Test::Unit::TestSuite.new(name)
11
- end
12
- end
13
-
14
- def test_notify
15
- notify("1st notify")
16
- notify("2nd notify. Reach here.")
17
- end
18
- end
19
-
20
- def test_notify
21
- result = _run_test("test_notify")
22
- assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
23
- "0 omissions, 2 notifications",
24
- result.to_s)
25
- assert_fault_messages(["1st notify", "2nd notify. Reach here."],
26
- result.notifications)
27
- end
28
-
29
- private
30
- def _run_test(name)
31
- super(TestCase, name)
32
- end
33
- end