test-unit 2.1.2 → 2.2.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.
- data/History.txt +43 -1
- data/Manifest.txt +1 -1
- data/html/index.html +57 -24
- data/html/index.html.ja +49 -25
- data/html/test-unit.css +3 -3
- data/lib/test/unit/assertions.rb +493 -40
- data/lib/test/unit/autorunner.rb +24 -0
- data/lib/test/unit/collector.rb +6 -4
- data/lib/test/unit/collector/load.rb +48 -5
- data/lib/test/unit/fixture.rb +12 -3
- data/lib/test/unit/testsuite.rb +11 -3
- data/lib/test/unit/ui/console/testrunner.rb +42 -8
- data/lib/test/unit/version.rb +1 -1
- data/test/run-test.rb +7 -0
- data/test/{test_assertions.rb → test-assertions.rb} +717 -65
- data/test/test-fixture.rb +37 -0
- data/test/test-testcase.rb +11 -3
- metadata +5 -6
data/test/test-fixture.rb
CHANGED
@@ -129,6 +129,43 @@ class TestUnitFixture < Test::Unit::TestCase
|
|
129
129
|
assert_called_fixtures(expected_teardown_calls, test_case)
|
130
130
|
end
|
131
131
|
|
132
|
+
def test_teardown_with_exception
|
133
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
134
|
+
def called_ids
|
135
|
+
@called_ids ||= []
|
136
|
+
end
|
137
|
+
|
138
|
+
def called(id)
|
139
|
+
called_ids << id
|
140
|
+
end
|
141
|
+
|
142
|
+
def teardown
|
143
|
+
called(:teardown)
|
144
|
+
raise "teardown"
|
145
|
+
end
|
146
|
+
|
147
|
+
teardown
|
148
|
+
def custom_teardown_method0
|
149
|
+
called(:custom_teardown_method0)
|
150
|
+
raise "custom_teardown_method0"
|
151
|
+
end
|
152
|
+
|
153
|
+
teardown
|
154
|
+
def custom_teardown_method1
|
155
|
+
called(:custom_teardown_method1)
|
156
|
+
raise "custom_teardown_method1"
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_nothing
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
assert_called_fixtures([:custom_teardown_method1,
|
164
|
+
:custom_teardown_method0,
|
165
|
+
:teardown],
|
166
|
+
test_case)
|
167
|
+
end
|
168
|
+
|
132
169
|
private
|
133
170
|
def assert_called_fixtures(expected, test_case)
|
134
171
|
test = test_case.new("test_nothing")
|
data/test/test-testcase.rb
CHANGED
@@ -284,8 +284,15 @@ module Test
|
|
284
284
|
def test_startup_shutdown
|
285
285
|
called = []
|
286
286
|
test_case = Class.new(TestCase) do
|
287
|
-
@@called = called
|
288
287
|
class << self
|
288
|
+
def called
|
289
|
+
@@called
|
290
|
+
end
|
291
|
+
|
292
|
+
def called=(called)
|
293
|
+
@@called = called
|
294
|
+
end
|
295
|
+
|
289
296
|
def startup
|
290
297
|
@@called << :startup
|
291
298
|
end
|
@@ -294,13 +301,14 @@ module Test
|
|
294
301
|
@@called << :shutdown
|
295
302
|
end
|
296
303
|
end
|
304
|
+
self.called = called
|
297
305
|
|
298
306
|
def setup
|
299
|
-
|
307
|
+
self.class.called << :setup
|
300
308
|
end
|
301
309
|
|
302
310
|
def teardown
|
303
|
-
|
311
|
+
self.class.called << :teardown
|
304
312
|
end
|
305
313
|
|
306
314
|
def test1
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 2.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kouhei Sutou
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2011-02-14 00:00:00 +09:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- test/collector/test_dir.rb
|
157
157
|
- test/collector/test_objectspace.rb
|
158
158
|
- test/run-test.rb
|
159
|
+
- test/test-assertions.rb
|
159
160
|
- test/test-attribute.rb
|
160
161
|
- test/test-color-scheme.rb
|
161
162
|
- test/test-color.rb
|
@@ -167,7 +168,6 @@ files:
|
|
167
168
|
- test/test-pending.rb
|
168
169
|
- test/test-priority.rb
|
169
170
|
- test/test-testcase.rb
|
170
|
-
- test/test_assertions.rb
|
171
171
|
- test/test_error.rb
|
172
172
|
- test/test_failure.rb
|
173
173
|
- test/test_testresult.rb
|
@@ -227,4 +227,3 @@ test_files:
|
|
227
227
|
- test/util/test_observable.rb
|
228
228
|
- test/util/test_procwrapper.rb
|
229
229
|
- test/test_error.rb
|
230
|
-
- test/test_assertions.rb
|