test-unit 3.0.6 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +14 -0
- data/lib/test/unit/fixture.rb +55 -23
- data/lib/test/unit/version.rb +1 -1
- data/test/test-fixture.rb +28 -1
- metadata +26 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f581555a5f5e042d125194d870c79a4e8fd4c78e
|
4
|
+
data.tar.gz: a35bda12604b51db52009764c5439e657c3964a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90dd03711e6fe149f451de04c211ec5248a63cb8915a551444920f4b5f0a06f361af028613ac178f05b7f268461d06a3b465b90bf9cd62d51d368aa45deded4c
|
7
|
+
data.tar.gz: bfc59126ae597c329b5819a91556ce55710bba21f2a443838f596fe31d4f6366715a2eb533abcbd8c4e7ca016046d9ac04c12d8b53953241a359da7303ddd3e6
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.0.7 - 2014-11-14 {#version-3-0-7}
|
4
|
+
|
5
|
+
It's a minor update release.
|
6
|
+
|
7
|
+
### Fixes
|
8
|
+
|
9
|
+
* Fixed a bug that teardown blocks aren't called with sub class to
|
10
|
+
parent class order.
|
11
|
+
[GitHub#85][Reported by TOMITA Masahiro]
|
12
|
+
|
13
|
+
### Thanks
|
14
|
+
|
15
|
+
* TOMITA Masahiro
|
16
|
+
|
3
17
|
## 3.0.6 - 2014-11-09 {#version-3-0-6}
|
4
18
|
|
5
19
|
It's a minor update release.
|
data/lib/test/unit/fixture.rb
CHANGED
@@ -41,15 +41,25 @@ module Test
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def before_callbacks(type)
|
44
|
-
|
45
|
-
|
44
|
+
prepend_callbacks = []
|
45
|
+
append_callbacks = []
|
46
|
+
target_test_cases.each do |ancestor|
|
47
|
+
prepend_callbacks << ancestor.fixture[type].before_prepend_callbacks
|
48
|
+
append_callbacks << ancestor.fixture[type].before_append_callbacks
|
46
49
|
end
|
50
|
+
|
51
|
+
merge_callbacks(prepend_callbacks, append_callbacks)
|
47
52
|
end
|
48
53
|
|
49
54
|
def after_callbacks(type)
|
50
|
-
|
51
|
-
|
55
|
+
prepend_callbacks = []
|
56
|
+
append_callbacks = []
|
57
|
+
target_test_cases.each do |ancestor|
|
58
|
+
prepend_callbacks << ancestor.fixture[type].after_prepend_callbacks
|
59
|
+
append_callbacks << ancestor.fixture[type].after_append_callbacks
|
52
60
|
end
|
61
|
+
|
62
|
+
merge_callbacks(prepend_callbacks, append_callbacks)
|
53
63
|
end
|
54
64
|
|
55
65
|
private
|
@@ -65,13 +75,26 @@ module Test
|
|
65
75
|
end
|
66
76
|
interested_ancestors.reverse
|
67
77
|
end
|
78
|
+
|
79
|
+
def merge_callbacks(prepend_callbacks, append_callbacks)
|
80
|
+
all_callbacks = []
|
81
|
+
prepend_callbacks.reverse_each do |callbacks|
|
82
|
+
all_callbacks.concat(callbacks)
|
83
|
+
end
|
84
|
+
append_callbacks.each do |callbacks|
|
85
|
+
all_callbacks.concat(callbacks)
|
86
|
+
end
|
87
|
+
all_callbacks
|
88
|
+
end
|
68
89
|
end
|
69
90
|
|
70
91
|
class HookPoint
|
71
92
|
def initialize(default_options)
|
72
93
|
@default_options = default_options
|
73
|
-
@
|
74
|
-
@
|
94
|
+
@before_prepend_callbacks = []
|
95
|
+
@before_append_callbacks = []
|
96
|
+
@after_prepend_callbacks = []
|
97
|
+
@after_append_callbacks = []
|
75
98
|
@unregistered_callbacks = []
|
76
99
|
end
|
77
100
|
|
@@ -89,27 +112,27 @@ module Test
|
|
89
112
|
end
|
90
113
|
before_how = options[:before]
|
91
114
|
after_how = options[:after]
|
92
|
-
|
93
|
-
@before_callbacks = add_callback(@before_callbacks,
|
94
|
-
method_name_or_callback,
|
95
|
-
before_how)
|
96
|
-
else
|
97
|
-
@after_callbacks = add_callback(@after_callbacks,
|
98
|
-
method_name_or_callback,
|
99
|
-
after_how)
|
100
|
-
end
|
115
|
+
add_callback(method_name_or_callback, before_how, after_how)
|
101
116
|
end
|
102
117
|
|
103
118
|
def unregister(method_name_or_callback)
|
104
119
|
@unregistered_callbacks << method_name_or_callback
|
105
120
|
end
|
106
121
|
|
107
|
-
def
|
108
|
-
@
|
122
|
+
def before_prepend_callbacks
|
123
|
+
@before_prepend_callbacks - @unregistered_callbacks
|
124
|
+
end
|
125
|
+
|
126
|
+
def before_append_callbacks
|
127
|
+
@before_append_callbacks - @unregistered_callbacks
|
109
128
|
end
|
110
129
|
|
111
|
-
def
|
112
|
-
@
|
130
|
+
def after_prepend_callbacks
|
131
|
+
@after_prepend_callbacks - @unregistered_callbacks
|
132
|
+
end
|
133
|
+
|
134
|
+
def after_append_callbacks
|
135
|
+
@after_append_callbacks - @unregistered_callbacks
|
113
136
|
end
|
114
137
|
|
115
138
|
private
|
@@ -122,12 +145,21 @@ module Test
|
|
122
145
|
[:prepend, :append].include?(options[key])
|
123
146
|
end
|
124
147
|
|
125
|
-
def add_callback(
|
126
|
-
case
|
148
|
+
def add_callback(method_name_or_callback, before_how, after_how)
|
149
|
+
case before_how
|
127
150
|
when :prepend
|
128
|
-
|
151
|
+
@before_prepend_callbacks =
|
152
|
+
[method_name_or_callback] | @before_prepend_callbacks
|
129
153
|
when :append
|
130
|
-
|
154
|
+
@before_append_callbacks |= [method_name_or_callback]
|
155
|
+
else
|
156
|
+
case after_how
|
157
|
+
when :prepend
|
158
|
+
@after_prepend_callbacks =
|
159
|
+
[method_name_or_callback] | @after_prepend_callbacks
|
160
|
+
when :append
|
161
|
+
@after_append_callbacks |= [method_name_or_callback]
|
162
|
+
end
|
131
163
|
end
|
132
164
|
end
|
133
165
|
end
|
data/lib/test/unit/version.rb
CHANGED
data/test/test-fixture.rb
CHANGED
@@ -513,6 +513,28 @@ class TestUnitFixture < Test::Unit::TestCase
|
|
513
513
|
test_case)
|
514
514
|
end
|
515
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
|
+
|
516
538
|
private
|
517
539
|
def assert_teardown_customizable(expected, parent, options)
|
518
540
|
test_case = Class.new(parent || Test::Unit::TestCase) do
|
@@ -607,9 +629,14 @@ class TestUnitFixture < Test::Unit::TestCase
|
|
607
629
|
end
|
608
630
|
|
609
631
|
private
|
610
|
-
def
|
632
|
+
def run_test_nothing(test_case)
|
611
633
|
test = test_case.new("test_nothing")
|
612
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)
|
613
640
|
assert_equal(expected, test.called_ids)
|
614
641
|
end
|
615
642
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: power_assert
|
@@ -234,44 +234,44 @@ signing_key:
|
|
234
234
|
specification_version: 4
|
235
235
|
summary: An xUnit family unit testing framework for Ruby.
|
236
236
|
test_files:
|
237
|
+
- test/test-test-case.rb
|
237
238
|
- test/test-assertions.rb
|
238
|
-
- test/test-color.rb
|
239
239
|
- test/test-code-snippet.rb
|
240
240
|
- test/test-test-suite-creator.rb
|
241
|
+
- test/test-fault-location-detector.rb
|
242
|
+
- test/test-omission.rb
|
241
243
|
- test/test-test-result.rb
|
244
|
+
- test/collector/test-descendant.rb
|
245
|
+
- test/collector/test_dir.rb
|
246
|
+
- test/collector/test-load.rb
|
247
|
+
- test/collector/test_objectspace.rb
|
248
|
+
- test/test-color.rb
|
249
|
+
- test/test-attribute-matcher.rb
|
242
250
|
- test/test-error.rb
|
243
|
-
- test/test-
|
244
|
-
- test/run-test.rb
|
251
|
+
- test/test-diff.rb
|
245
252
|
- test/test-pending.rb
|
246
|
-
- test/test-
|
247
|
-
- test/test-attribute-matcher.rb
|
248
|
-
- test/testunit-test-util.rb
|
249
|
-
- test/test-data.rb
|
250
|
-
- test/ui/test_testrunmediator.rb
|
251
|
-
- test/util/test-method-owner-finder.rb
|
252
|
-
- test/util/test-output.rb
|
253
|
-
- test/util/test_observable.rb
|
253
|
+
- test/test-emacs-runner.rb
|
254
254
|
- test/util/test_backtracefilter.rb
|
255
255
|
- test/util/test_procwrapper.rb
|
256
|
-
- test/test-
|
257
|
-
- test/
|
258
|
-
- test/test-
|
256
|
+
- test/util/test-output.rb
|
257
|
+
- test/util/test_observable.rb
|
258
|
+
- test/util/test-method-owner-finder.rb
|
259
|
+
- test/test-data.rb
|
260
|
+
- test/fixtures/no-header.tsv
|
261
|
+
- test/fixtures/header-label.csv
|
259
262
|
- test/fixtures/no-header.csv
|
260
263
|
- test/fixtures/header-label.tsv
|
261
264
|
- test/fixtures/plus.csv
|
262
|
-
- test/fixtures/no-header.tsv
|
263
|
-
- test/fixtures/header-label.csv
|
264
265
|
- test/fixtures/header.csv
|
265
266
|
- test/fixtures/header.tsv
|
266
|
-
- test/collector/test-descendant.rb
|
267
|
-
- test/collector/test_objectspace.rb
|
268
|
-
- test/collector/test-load.rb
|
269
|
-
- test/collector/test_dir.rb
|
270
|
-
- test/test-priority.rb
|
271
267
|
- test/test-test-suite.rb
|
272
|
-
- test/test-
|
273
|
-
- test/test-
|
268
|
+
- test/test-color-scheme.rb
|
269
|
+
- test/test-priority.rb
|
274
270
|
- test/test-attribute.rb
|
275
|
-
- test/test
|
271
|
+
- test/run-test.rb
|
272
|
+
- test/test-fixture.rb
|
276
273
|
- test/test-notification.rb
|
274
|
+
- test/test-failure.rb
|
275
|
+
- test/testunit-test-util.rb
|
276
|
+
- test/ui/test_testrunmediator.rb
|
277
277
|
has_rdoc:
|