test-unit 1.2.3 → 2.0.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.
Files changed (60) hide show
  1. data/History.txt +27 -0
  2. data/Manifest.txt +30 -8
  3. data/README.txt +9 -4
  4. data/Rakefile +16 -1
  5. data/bin/testrb +0 -0
  6. data/lib/test/unit/assertions.rb +148 -48
  7. data/lib/test/unit/attribute.rb +125 -0
  8. data/lib/test/unit/autorunner.rb +101 -71
  9. data/lib/test/unit/collector/descendant.rb +23 -0
  10. data/lib/test/unit/collector/dir.rb +1 -1
  11. data/lib/test/unit/collector/load.rb +135 -0
  12. data/lib/test/unit/color.rb +61 -0
  13. data/lib/test/unit/diff.rb +524 -0
  14. data/lib/test/unit/error.rb +70 -2
  15. data/lib/test/unit/exceptionhandler.rb +39 -0
  16. data/lib/test/unit/failure.rb +63 -4
  17. data/lib/test/unit/fixture.rb +185 -0
  18. data/lib/test/unit/notification.rb +125 -0
  19. data/lib/test/unit/omission.rb +143 -0
  20. data/lib/test/unit/pending.rb +146 -0
  21. data/lib/test/unit/priority.rb +146 -0
  22. data/lib/test/unit/runner/console.rb +46 -0
  23. data/lib/test/unit/runner/emacs.rb +8 -0
  24. data/lib/test/unit/testcase.rb +193 -76
  25. data/lib/test/unit/testresult.rb +37 -28
  26. data/lib/test/unit/testsuite.rb +35 -1
  27. data/lib/test/unit/ui/console/outputlevel.rb +14 -0
  28. data/lib/test/unit/ui/console/testrunner.rb +96 -28
  29. data/lib/test/unit/ui/emacs/testrunner.rb +49 -0
  30. data/lib/test/unit/ui/testrunner.rb +20 -0
  31. data/lib/test/unit/ui/testrunnermediator.rb +28 -19
  32. data/lib/test/unit/ui/testrunnerutilities.rb +2 -7
  33. data/lib/test/unit/util/backtracefilter.rb +2 -1
  34. data/lib/test/unit/version.rb +1 -1
  35. data/test/collector/test_descendant.rb +135 -0
  36. data/test/collector/test_load.rb +333 -0
  37. data/test/run-test.rb +13 -0
  38. data/test/test_assertions.rb +221 -56
  39. data/test/test_attribute.rb +86 -0
  40. data/test/test_color.rb +37 -0
  41. data/test/test_diff.rb +477 -0
  42. data/test/test_emacs_runner.rb +60 -0
  43. data/test/test_fixture.rb +275 -0
  44. data/test/test_notification.rb +33 -0
  45. data/test/test_omission.rb +81 -0
  46. data/test/test_pending.rb +70 -0
  47. data/test/test_priority.rb +89 -0
  48. data/test/test_testcase.rb +160 -5
  49. data/test/test_testresult.rb +61 -52
  50. data/test/testunit_test_util.rb +14 -0
  51. data/test/ui/test_testrunmediator.rb +20 -0
  52. metadata +53 -23
  53. data/lib/test/unit/ui/fox/testrunner.rb +0 -268
  54. data/lib/test/unit/ui/gtk/testrunner.rb +0 -416
  55. data/lib/test/unit/ui/gtk2/testrunner.rb +0 -465
  56. data/lib/test/unit/ui/tk/testrunner.rb +0 -260
  57. data/test/runit/test_assert.rb +0 -402
  58. data/test/runit/test_testcase.rb +0 -91
  59. data/test/runit/test_testresult.rb +0 -144
  60. data/test/runit/test_testsuite.rb +0 -49
@@ -1,260 +0,0 @@
1
- #--
2
- #
3
- # Original Author:: Nathaniel Talbott.
4
- # Author:: Kazuhiro NISHIYAMA.
5
- # Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
6
- # Copyright:: Copyright (c) 2003 Kazuhiro NISHIYAMA. All rights reserved.
7
- # License:: Ruby license.
8
-
9
- require 'tk'
10
- require 'test/unit/ui/testrunnermediator'
11
- require 'test/unit/ui/testrunnerutilities'
12
-
13
- module Test
14
- module Unit
15
- module UI
16
- module Tk
17
-
18
- # Runs a Test::Unit::TestSuite in a Tk UI. Obviously,
19
- # this one requires you to have Tk
20
- # and the Ruby Tk extension installed.
21
- class TestRunner
22
- extend TestRunnerUtilities
23
-
24
- # Creates a new TestRunner for running the passed
25
- # suite.
26
- def initialize(suite, output_level = NORMAL)
27
- if (suite.respond_to?(:suite))
28
- @suite = suite.suite
29
- else
30
- @suite = suite
31
- end
32
- @result = nil
33
-
34
- @red = false
35
- @fault_detail_list = []
36
- @runner = Thread.current
37
- @restart_signal = Class.new(Exception)
38
- @viewer = Thread.start do
39
- @runner.join rescue @runner.run
40
- ::Tk.mainloop
41
- end
42
- @viewer.join rescue nil # wait deadlock to handshake
43
- end
44
-
45
- # Begins the test run.
46
- def start
47
- setup_ui
48
- setup_mediator
49
- attach_to_mediator
50
- start_ui
51
- @result
52
- end
53
-
54
- private
55
- def setup_mediator
56
- @mediator = TestRunnerMediator.new(@suite)
57
- suite_name = @suite.to_s
58
- if ( @suite.kind_of?(Module) )
59
- suite_name = @suite.name
60
- end
61
- @suite_name_entry.value = suite_name
62
- end
63
-
64
- def attach_to_mediator
65
- @run_button.command(method(:run_test))
66
- @fault_list.bind('ButtonPress-1', proc{|y|
67
- fault = @fault_detail_list[@fault_list.nearest(y)]
68
- if fault
69
- show_fault(fault)
70
- end
71
- }, '%y')
72
- @mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
73
- @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
74
- @mediator.add_listener(TestResult::CHANGED, &method(:result_changed))
75
- @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
76
- @mediator.add_listener(TestCase::STARTED, &method(:test_started))
77
- @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
78
- end
79
-
80
- def run_test
81
- @runner.raise(@restart_signal)
82
- end
83
-
84
- def start_ui
85
- @viewer.run
86
- running = false
87
- begin
88
- loop do
89
- if (running ^= true)
90
- @run_button.configure('text'=>'Stop')
91
- @mediator.run_suite
92
- else
93
- @run_button.configure('text'=>'Run')
94
- @viewer.join
95
- break
96
- end
97
- end
98
- rescue @restart_signal
99
- retry
100
- rescue
101
- end
102
- end
103
-
104
- def stop
105
- ::Tk.exit
106
- end
107
-
108
- def reset_ui(count)
109
- @test_total_count = count.to_f
110
- @test_progress_bar.configure('background'=>'green')
111
- @test_progress_bar.place('relwidth'=>(count.zero? ? 0 : 0/count))
112
- @red = false
113
-
114
- @test_count_label.value = 0
115
- @assertion_count_label.value = 0
116
- @failure_count_label.value = 0
117
- @error_count_label.value = 0
118
-
119
- @fault_list.delete(0, 'end')
120
- @fault_detail_list = []
121
- clear_fault
122
- end
123
-
124
- def add_fault(fault)
125
- if ( ! @red )
126
- @test_progress_bar.configure('background'=>'red')
127
- @red = true
128
- end
129
- @fault_detail_list.push fault
130
- @fault_list.insert('end', fault.short_display)
131
- end
132
-
133
- def show_fault(fault)
134
- raw_show_fault(fault.long_display)
135
- end
136
-
137
- def raw_show_fault(string)
138
- @detail_text.value = string
139
- end
140
-
141
- def clear_fault
142
- raw_show_fault("")
143
- end
144
-
145
- def result_changed(result)
146
- @test_count_label.value = result.run_count
147
- @test_progress_bar.place('relwidth'=>result.run_count/@test_total_count)
148
- @assertion_count_label.value = result.assertion_count
149
- @failure_count_label.value = result.failure_count
150
- @error_count_label.value = result.error_count
151
- end
152
-
153
- def started(result)
154
- @result = result
155
- output_status("Started...")
156
- end
157
-
158
- def test_started(test_name)
159
- output_status("Running #{test_name}...")
160
- end
161
-
162
- def finished(elapsed_time)
163
- output_status("Finished in #{elapsed_time} seconds")
164
- end
165
-
166
- def output_status(string)
167
- @status_entry.value = string
168
- end
169
-
170
- def setup_ui
171
- @status_entry = TkVariable.new
172
- l = TkLabel.new(nil, 'textvariable'=>@status_entry, 'relief'=>'sunken')
173
- l.pack('side'=>'bottom', 'fill'=>'x')
174
-
175
- suite_frame = TkFrame.new.pack('fill'=>'x')
176
-
177
- @run_button = TkButton.new(suite_frame, 'text'=>'Run')
178
- @run_button.pack('side'=>'right')
179
-
180
- TkLabel.new(suite_frame, 'text'=>'Suite:').pack('side'=>'left')
181
- @suite_name_entry = TkVariable.new
182
- l = TkLabel.new(suite_frame, 'textvariable'=>@suite_name_entry, 'relief'=>'sunken')
183
- l.pack('side'=>'left', 'fill'=>'x', 'expand'=>true)
184
-
185
- f = TkFrame.new(nil, 'relief'=>'sunken', 'borderwidth'=>3, 'height'=>20).pack('fill'=>'x', 'padx'=>1)
186
- @test_progress_bar = TkFrame.new(f, 'background'=>'green').place('anchor'=>'nw', 'relwidth'=>0.0, 'relheight'=>1.0)
187
-
188
- info_frame = TkFrame.new.pack('fill'=>'x')
189
- @test_count_label = create_count_label(info_frame, 'Tests:')
190
- @assertion_count_label = create_count_label(info_frame, 'Assertions:')
191
- @failure_count_label = create_count_label(info_frame, 'Failures:')
192
- @error_count_label = create_count_label(info_frame, 'Errors:')
193
-
194
- if (::Tk.info('command', TkPanedWindow::TkCommandNames[0]) != "")
195
- # use panedwindow
196
- paned_frame = TkPanedWindow.new("orient"=>"vertical").pack('fill'=>'both', 'expand'=>true)
197
-
198
- fault_list_frame = TkFrame.new(paned_frame)
199
- detail_frame = TkFrame.new(paned_frame)
200
-
201
- paned_frame.add(fault_list_frame, detail_frame)
202
- else
203
- # no panedwindow
204
- paned_frame = nil
205
- fault_list_frame = TkFrame.new.pack('fill'=>'both', 'expand'=>true)
206
- detail_frame = TkFrame.new.pack('fill'=>'both', 'expand'=>true)
207
- end
208
-
209
- TkGrid.rowconfigure(fault_list_frame, 0, 'weight'=>1, 'minsize'=>0)
210
- TkGrid.columnconfigure(fault_list_frame, 0, 'weight'=>1, 'minsize'=>0)
211
-
212
- fault_scrollbar_y = TkScrollbar.new(fault_list_frame)
213
- fault_scrollbar_x = TkScrollbar.new(fault_list_frame)
214
- @fault_list = TkListbox.new(fault_list_frame)
215
- @fault_list.yscrollbar(fault_scrollbar_y)
216
- @fault_list.xscrollbar(fault_scrollbar_x)
217
-
218
- TkGrid.rowconfigure(detail_frame, 0, 'weight'=>1, 'minsize'=>0)
219
- TkGrid.columnconfigure(detail_frame, 0, 'weight'=>1, 'minsize'=>0)
220
-
221
- ::Tk.grid(@fault_list, fault_scrollbar_y, 'sticky'=>'news')
222
- ::Tk.grid(fault_scrollbar_x, 'sticky'=>'news')
223
-
224
- detail_scrollbar_y = TkScrollbar.new(detail_frame)
225
- detail_scrollbar_x = TkScrollbar.new(detail_frame)
226
- @detail_text = TkText.new(detail_frame, 'height'=>10, 'wrap'=>'none') {
227
- bindtags(bindtags - [TkText])
228
- }
229
- @detail_text.yscrollbar(detail_scrollbar_y)
230
- @detail_text.xscrollbar(detail_scrollbar_x)
231
-
232
- ::Tk.grid(@detail_text, detail_scrollbar_y, 'sticky'=>'news')
233
- ::Tk.grid(detail_scrollbar_x, 'sticky'=>'news')
234
-
235
- # rubber-style pane
236
- if paned_frame
237
- ::Tk.update
238
- @height = paned_frame.winfo_height
239
- paned_frame.bind('Configure', proc{|h|
240
- paned_frame.sash_place(0, 0, paned_frame.sash_coord(0)[1] * h / @height)
241
- @height = h
242
- }, '%h')
243
- end
244
- end
245
-
246
- def create_count_label(parent, label)
247
- TkLabel.new(parent, 'text'=>label).pack('side'=>'left', 'expand'=>true)
248
- v = TkVariable.new(0)
249
- TkLabel.new(parent, 'textvariable'=>v).pack('side'=>'left', 'expand'=>true)
250
- v
251
- end
252
- end
253
- end
254
- end
255
- end
256
- end
257
-
258
- if __FILE__ == $0
259
- Test::Unit::UI::Tk::TestRunner.start_command_line_test
260
- end
@@ -1,402 +0,0 @@
1
- # Author:: Masaki Suketa.
2
- # Adapted by:: Nathaniel Talbott.
3
- # Copyright:: Copyright (c) Masaki Suketa. All rights reserved.
4
- # Copyright:: Copyright (c) 2002 Nathaniel Talbott. All rights reserved.
5
- # License:: Ruby license.
6
-
7
- require 'rubyunit'
8
-
9
- module RUNIT
10
- class TargetAssert
11
- include RUNIT::Assert
12
- end
13
-
14
- class TestAssert < RUNIT::TestCase
15
- def setup
16
- @assert = TargetAssert.new
17
- @e = nil
18
- end
19
-
20
- def test_assert
21
- sub_test_assert_pass(true)
22
- sub_test_assert_pass(TRUE)
23
- sub_test_assert_failure(false)
24
- sub_test_assert_failure(FALSE)
25
- sub_test_assert_failure(nil)
26
- sub_test_assert_pass("")
27
- sub_test_assert_pass("ok")
28
- sub_test_assert_pass(0)
29
- sub_test_assert_pass(1)
30
- end
31
-
32
- def test_assert_with_2_argument
33
- assert_no_exception {
34
- assert(true, "3")
35
- }
36
- assert_no_exception {
37
- assert(true)
38
- }
39
- end
40
-
41
- def test_assert_equal_float_0_1
42
- assert_proc = Proc.new {
43
- @assert.assert_equal_float(1.4, 1.35, 0.1)
44
- }
45
- sub_assert_pass(assert_proc)
46
- end
47
-
48
- def test_assert_equal_float_0_5
49
- assert_proc = Proc.new {
50
- @assert.assert_equal_float(1.4, 1.34, 0.5)
51
- }
52
- sub_assert_pass(assert_proc)
53
- end
54
-
55
- def test_assert_equal_float_0
56
- assert_proc = Proc.new {
57
- @assert.assert_equal_float(1.4, 1.4, 0)
58
- }
59
- sub_assert_pass(assert_proc)
60
- end
61
-
62
- def test_assert_equal_float_0_raise
63
- assert_proc = Proc.new {
64
- @assert.assert_equal_float(1.4, 1.34, 0)
65
- }
66
- sub_assert_raise_fail(assert_proc)
67
- end
68
-
69
- def test_assert_equal_float_0_01
70
- assert_proc = Proc.new {
71
- @assert.assert_equal_float(1.4, 1.35, 0.01)
72
- }
73
- sub_assert_raise_fail(assert_proc)
74
- end
75
-
76
- def test_assert_equal_float_0_001
77
- assert_proc = Proc.new {
78
- @assert.assert_equal_float(Math.sqrt(2), 1.414, 0.001)
79
- }
80
- sub_assert_pass(assert_proc)
81
- end
82
-
83
- def test_assert_equal_float_minus_1_0
84
- assert_proc = Proc.new {
85
- @assert.assert_equal_float(1.4, 1.35, -1.0)
86
- }
87
- sub_assert_raise_fail(assert_proc)
88
- end
89
-
90
- def test_assert_fail
91
- except = nil
92
- begin
93
- @assert.assert_fail("failure")
94
- rescue Exception
95
- except = $!
96
- end
97
- assert_not_nil(except)
98
- end
99
-
100
- def sub_test_assert_pass(obj)
101
- assert_proc = Proc.new {
102
- @assert.assert(obj)
103
- }
104
- sub_assert_pass(assert_proc)
105
- end
106
-
107
- def sub_test_assert_failure(obj)
108
- assert_proc = Proc.new {
109
- @assert.assert(obj)
110
- }
111
- sub_assert_raise_fail(assert_proc)
112
- end
113
-
114
- def test_assert_equal
115
- assert_proc = Proc.new {
116
- @assert.assert_equal(2, 2)
117
- }
118
- sub_assert_pass(assert_proc)
119
- assert_proc = Proc.new {
120
- @assert.assert_equal(2, 3)
121
- }
122
- sub_assert_raise_fail(assert_proc)
123
- end
124
-
125
- def test_assert_nil
126
- obj = nil
127
- assert_proc = Proc.new {
128
- @assert.assert_nil(obj)
129
- }
130
- sub_assert_pass(assert_proc)
131
- obj = 'string'
132
- sub_assert_raise_fail(assert_proc)
133
- end
134
-
135
- def test_assert_not_nil
136
- obj = 'string'
137
- assert_proc = Proc.new {
138
- @assert.assert_not_nil(obj)
139
- }
140
- sub_assert_pass(assert_proc)
141
-
142
- obj = nil
143
- sub_assert_raise_fail(assert_proc)
144
- end
145
-
146
- def test_assert_operator
147
- assert_proc = Proc.new {
148
- @assert.assert_operator(2, :<, 3)
149
- }
150
- sub_assert_pass(assert_proc)
151
- assert_proc = Proc.new {
152
- @assert.assert_operator(2, :>, 3)
153
- }
154
- sub_assert_raise_fail(assert_proc)
155
- end
156
-
157
- def test_assert_respond_to
158
- sub_test_assert_respond_to('string', 'sub', 'foo')
159
- sub_test_assert_respond_to('string', :sub, :foo)
160
- end
161
-
162
- def sub_test_assert_respond_to(obj, msg, dummy_msg)
163
- assert_proc = Proc.new {
164
- @assert.assert_respond_to(msg, obj)
165
- }
166
- sub_assert_pass(assert_proc)
167
- assert_proc = Proc.new {
168
- @assert.assert_respond_to(dummy_msg, obj)
169
- }
170
- sub_assert_raise_fail(assert_proc)
171
- end
172
-
173
- def test_assert_send
174
- assert_proc = Proc.new {
175
- ary = []
176
- @assert.assert_send ary, :empty?
177
- }
178
- sub_assert_pass(assert_proc)
179
- assert_proc = Proc.new {
180
- ary = [2,3]
181
- @assert.assert_send ary, :empty?
182
- }
183
- sub_assert_raise_fail(assert_proc)
184
- assert_proc = Proc.new {
185
- str = "abc"
186
- @assert.assert_send str, :sub!, "z", "y"
187
- }
188
- sub_assert_raise_fail(assert_proc)
189
- end
190
-
191
- def test_assert_kind_of
192
- assert_proc = Proc.new {
193
- @assert.assert_kind_of(String, "string")
194
- }
195
- sub_assert_pass(assert_proc)
196
- assert_proc = Proc.new {
197
- @assert.assert_kind_of(Regexp, "string")
198
- }
199
- sub_assert_raise_fail(assert_proc)
200
- end
201
-
202
- def test_assert_instance_of
203
- assert_proc = Proc.new {
204
- @assert.assert_instance_of(String, "string")
205
- }
206
- sub_assert_pass(assert_proc)
207
- assert_proc = Proc.new {
208
- @assert.assert_instance_of(Object, "string")
209
- }
210
- sub_assert_raise_fail(assert_proc)
211
- end
212
-
213
- def test_assert_match
214
- assert_proc = Proc.new{
215
- @assert.assert_match('foostring', /foo/)
216
- }
217
- sub_assert_pass(assert_proc)
218
- assert_proc = Proc.new {
219
- @assert.assert_match('barstring', /foo/)
220
- }
221
- sub_assert_raise_fail(assert_proc)
222
- match = @assert.assert_match('foostring', /foo/)
223
- assert_instance_of(MatchData, match)
224
- assert_equal('foo', match[0])
225
- end
226
-
227
- def test_assert_matches
228
- assert_proc = Proc.new{
229
- @assert.assert_matches('foostring', /foo/)
230
- }
231
- sub_assert_pass(assert_proc)
232
- assert_proc = Proc.new {
233
- @assert.assert_matches('barstring', /foo/)
234
- }
235
- sub_assert_raise_fail(assert_proc)
236
- end
237
-
238
- def test_assert_not_match
239
- assert_proc = Proc.new{
240
- @assert.assert_not_match('barstring', /foo/)
241
- }
242
- sub_assert_pass(assert_proc)
243
- assert_proc = Proc.new {
244
- @assert.assert_not_match('foostring', /foo/)
245
- }
246
- sub_assert_raise_fail(assert_proc)
247
- assert_proc = Proc.new {
248
- @assert.assert_not_match('foobarbaz', /ba.+/)
249
- }
250
- sub_assert_raise_fail(assert_proc)
251
- end
252
-
253
- def test_assert_same
254
- flag = false
255
- e = "foo"
256
- a = e
257
- assert_proc = Proc.new {@assert.assert_same(e, a)}
258
- sub_assert_pass(assert_proc)
259
-
260
- a = "foo"
261
- sub_assert_raise_fail(assert_proc)
262
- end
263
-
264
- def test_assert_exception
265
- assert_proc = Proc.new{
266
- @assert.assert_exception(IOError) {
267
- raise IOError
268
- }
269
- }
270
- sub_assert_pass(assert_proc)
271
-
272
- assert_proc = Proc.new{
273
- @assert.assert_exception(StandardError) {
274
- raise IOError
275
- }
276
- }
277
- sub_assert_raise_fail(assert_proc)
278
-
279
- assert_proc = Proc.new{
280
- @assert.assert_exception(IOError, "Exception") {
281
- raise StandardError
282
- }
283
- }
284
- sub_assert_raise_fail(assert_proc)
285
-
286
- assert_proc = Proc.new {
287
- @assert.assert_exception(StandardError) {
288
- "No Exception raised in this block"
289
- }
290
- }
291
- sub_assert_raise_fail(assert_proc)
292
-
293
- assert_proc = Proc.new {
294
- @assert.assert_exception(StandardError) {
295
- exit(33)
296
- }
297
- }
298
- sub_assert_raise_fail(assert_proc)
299
-
300
- t = @assert.assert_exception(IOError) {
301
- raise IOError
302
- }
303
- assert_instance_of(IOError, t)
304
- t = @assert.assert_exception(NameError) {
305
- non_existent_method
306
- }
307
- assert_instance_of(NameError, t)
308
- t = @assert.assert_exception(SystemExit) {
309
- exit(33)
310
- }
311
- assert_instance_of(SystemExit, t)
312
- end
313
-
314
- def test_assert_no_exception
315
- assert_proc = Proc.new{
316
- @assert.assert_no_exception(IOError, ArgumentError) {
317
- "No Exception raised in this block"
318
- }
319
- }
320
- sub_assert_pass(assert_proc)
321
-
322
- assert_proc = Proc.new{
323
- @assert.assert_no_exception(IOError, ArgumentError) {
324
- raise StandardError, "Standard Error raised"
325
- }
326
- }
327
- sub_assert_raise_error(assert_proc)
328
-
329
- assert_proc = Proc.new{
330
- @assert.assert_no_exception(IOError, ArgumentError) {
331
- raise ArgumentError, "Bad Argument"
332
- }
333
- }
334
- sub_assert_raise_fail(assert_proc)
335
-
336
- assert_proc = Proc.new{
337
- @assert.assert_no_exception {
338
- raise ArgumentError, "Bad Argument"
339
- }
340
- }
341
- sub_assert_raise_fail(assert_proc)
342
-
343
- assert_proc = Proc.new{
344
- @assert.assert_no_exception {
345
- raise NameError, "Bad Name"
346
- }
347
- }
348
- sub_assert_raise_fail(assert_proc)
349
- assert_proc = Proc.new {
350
- @assert.assert_no_exception {
351
- raise NoMemoryError
352
- }
353
- }
354
- sub_assert_raise_fail(assert_proc)
355
- end
356
-
357
- def sub_assert_pass(p)
358
- flag = false
359
- err = nil
360
- begin
361
- p.call
362
- flag = true
363
- rescue
364
- err = $!
365
- flag = false
366
- end
367
- assert(flag, err.to_s)
368
- end
369
-
370
- def sub_assert_raise_fail(p)
371
- flag = false
372
- err = nil
373
- begin
374
- p.call
375
- flag = false
376
- rescue RUNIT::AssertionFailedError
377
- flag = true
378
- err = $!
379
- rescue Exception
380
- flag = false
381
- err = $!
382
- end
383
- assert(flag, err.to_s)
384
- end
385
-
386
- def sub_assert_raise_error(p)
387
- flag = false
388
- err = nil
389
- begin
390
- p.call
391
- flag = false
392
- rescue RUNIT::AssertionFailedError
393
- flag = false
394
- err = $!
395
- rescue Exception
396
- flag = true
397
- err = $!
398
- end
399
- assert(flag, err.to_s)
400
- end
401
- end
402
- end