test-unit 3.4.4 → 3.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/Rakefile +0 -9
  4. data/doc/text/getting-started.md +1 -1
  5. data/doc/text/news.md +54 -1
  6. data/lib/test/unit/assertion-failed-error.rb +35 -0
  7. data/lib/test/unit/assertions.rb +93 -17
  8. data/lib/test/unit/autorunner.rb +13 -1
  9. data/lib/test/unit/collector/descendant.rb +1 -0
  10. data/lib/test/unit/collector/dir.rb +4 -2
  11. data/lib/test/unit/collector/load.rb +2 -0
  12. data/lib/test/unit/collector/objectspace.rb +1 -0
  13. data/lib/test/unit/collector.rb +31 -0
  14. data/lib/test/unit/testcase.rb +34 -1
  15. data/lib/test/unit/testsuite.rb +1 -1
  16. data/lib/test/unit/util/memory-usage.rb +47 -0
  17. data/lib/test/unit/version.rb +1 -1
  18. data/lib/test/unit.rb +4 -4
  19. metadata +6 -83
  20. data/test/collector/test-descendant.rb +0 -182
  21. data/test/collector/test-load.rb +0 -475
  22. data/test/collector/test_dir.rb +0 -407
  23. data/test/collector/test_objectspace.rb +0 -102
  24. data/test/fixtures/header-label.csv +0 -3
  25. data/test/fixtures/header-label.tsv +0 -3
  26. data/test/fixtures/header.csv +0 -3
  27. data/test/fixtures/header.tsv +0 -3
  28. data/test/fixtures/no-header.csv +0 -2
  29. data/test/fixtures/no-header.tsv +0 -2
  30. data/test/fixtures/plus.csv +0 -3
  31. data/test/run-test.rb +0 -22
  32. data/test/test-assertions.rb +0 -2281
  33. data/test/test-attribute-matcher.rb +0 -38
  34. data/test/test-attribute.rb +0 -123
  35. data/test/test-code-snippet.rb +0 -79
  36. data/test/test-color-scheme.rb +0 -123
  37. data/test/test-color.rb +0 -47
  38. data/test/test-data.rb +0 -419
  39. data/test/test-diff.rb +0 -518
  40. data/test/test-emacs-runner.rb +0 -60
  41. data/test/test-error.rb +0 -26
  42. data/test/test-failure.rb +0 -33
  43. data/test/test-fault-location-detector.rb +0 -163
  44. data/test/test-fixture.rb +0 -713
  45. data/test/test-notification.rb +0 -33
  46. data/test/test-omission.rb +0 -81
  47. data/test/test-pending.rb +0 -70
  48. data/test/test-priority.rb +0 -184
  49. data/test/test-test-case.rb +0 -1284
  50. data/test/test-test-result.rb +0 -113
  51. data/test/test-test-suite-creator.rb +0 -97
  52. data/test/test-test-suite.rb +0 -151
  53. data/test/testunit-test-util.rb +0 -33
  54. data/test/ui/test_testrunmediator.rb +0 -20
  55. data/test/util/test-method-owner-finder.rb +0 -38
  56. data/test/util/test-output.rb +0 -11
  57. data/test/util/test_backtracefilter.rb +0 -52
  58. data/test/util/test_observable.rb +0 -102
  59. data/test/util/test_procwrapper.rb +0 -36
data/lib/test/unit.rb CHANGED
@@ -324,14 +324,14 @@ module Test # :nodoc:
324
324
  # Set true when Test::Unit has run. If set to true Test::Unit
325
325
  # will not automatically run at exit.
326
326
  #
327
- # @deprecated Use Test::Unit::AutoRunner.need_auto_run= instead.
327
+ # @deprecated Use {Test::Unit::AutoRunner.need_auto_run=} instead.
328
328
  def run=(have_run)
329
329
  AutoRunner.need_auto_run = (not have_run)
330
330
  end
331
331
 
332
332
  # Already tests have run?
333
333
  #
334
- # @deprecated Use Test::Unit::AutoRunner.need_auto_run? instead.
334
+ # @deprecated Use {Test::Unit::AutoRunner.need_auto_run?} instead.
335
335
  def run?
336
336
  not AutoRunner.need_auto_run?
337
337
  end
@@ -339,7 +339,7 @@ module Test # :nodoc:
339
339
  # @api private
340
340
  @@at_start_hooks = []
341
341
 
342
- # Regsiter a hook that is run before running tests.
342
+ # Register a hook that is run before running tests.
343
343
  # To register multiple hooks, call this method multiple times.
344
344
  #
345
345
  # Here is an example test case:
@@ -425,7 +425,7 @@ module Test # :nodoc:
425
425
  # @api private
426
426
  @@at_exit_hooks = []
427
427
 
428
- # Regsiter a hook that is run after running tests.
428
+ # Register a hook that is run after running tests.
429
429
  # To register multiple hooks, call this method multiple times.
430
430
  #
431
431
  # Here is an example test case:
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.4.4
4
+ version: 3.4.8
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: 2021-06-04 00:00:00.000000000 Z
12
+ date: 2021-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert
@@ -159,6 +159,7 @@ files:
159
159
  - lib/test/unit/ui/testrunnerutilities.rb
160
160
  - lib/test/unit/ui/xml/testrunner.rb
161
161
  - lib/test/unit/util/backtracefilter.rb
162
+ - lib/test/unit/util/memory-usage.rb
162
163
  - lib/test/unit/util/method-owner-finder.rb
163
164
  - lib/test/unit/util/observable.rb
164
165
  - lib/test/unit/util/output.rb
@@ -170,46 +171,6 @@ files:
170
171
  - sample/test_adder.rb
171
172
  - sample/test_subtracter.rb
172
173
  - sample/test_user.rb
173
- - test/collector/test-descendant.rb
174
- - test/collector/test-load.rb
175
- - test/collector/test_dir.rb
176
- - test/collector/test_objectspace.rb
177
- - test/fixtures/header-label.csv
178
- - test/fixtures/header-label.tsv
179
- - test/fixtures/header.csv
180
- - test/fixtures/header.tsv
181
- - test/fixtures/no-header.csv
182
- - test/fixtures/no-header.tsv
183
- - test/fixtures/plus.csv
184
- - test/run-test.rb
185
- - test/test-assertions.rb
186
- - test/test-attribute-matcher.rb
187
- - test/test-attribute.rb
188
- - test/test-code-snippet.rb
189
- - test/test-color-scheme.rb
190
- - test/test-color.rb
191
- - test/test-data.rb
192
- - test/test-diff.rb
193
- - test/test-emacs-runner.rb
194
- - test/test-error.rb
195
- - test/test-failure.rb
196
- - test/test-fault-location-detector.rb
197
- - test/test-fixture.rb
198
- - test/test-notification.rb
199
- - test/test-omission.rb
200
- - test/test-pending.rb
201
- - test/test-priority.rb
202
- - test/test-test-case.rb
203
- - test/test-test-result.rb
204
- - test/test-test-suite-creator.rb
205
- - test/test-test-suite.rb
206
- - test/testunit-test-util.rb
207
- - test/ui/test_testrunmediator.rb
208
- - test/util/test-method-owner-finder.rb
209
- - test/util/test-output.rb
210
- - test/util/test_backtracefilter.rb
211
- - test/util/test_observable.rb
212
- - test/util/test_procwrapper.rb
213
174
  homepage: http://test-unit.github.io/
214
175
  licenses:
215
176
  - Ruby
@@ -217,6 +178,8 @@ licenses:
217
178
  - PSFL
218
179
  metadata:
219
180
  source_code_uri: https://github.com/test-unit/test-unit
181
+ documentation_uri: https://test-unit.github.io/test-unit/en/
182
+ bug_tracker_uri: https://github.com/test-unit/test-unit/issues
220
183
  post_install_message:
221
184
  rdoc_options: []
222
185
  require_paths:
@@ -236,44 +199,4 @@ rubygems_version: 3.3.0.dev
236
199
  signing_key:
237
200
  specification_version: 4
238
201
  summary: An xUnit family unit testing framework for Ruby.
239
- test_files:
240
- - test/collector/test-descendant.rb
241
- - test/collector/test-load.rb
242
- - test/collector/test_dir.rb
243
- - test/collector/test_objectspace.rb
244
- - test/fixtures/header-label.csv
245
- - test/fixtures/header-label.tsv
246
- - test/fixtures/header.csv
247
- - test/fixtures/header.tsv
248
- - test/fixtures/no-header.csv
249
- - test/fixtures/no-header.tsv
250
- - test/fixtures/plus.csv
251
- - test/run-test.rb
252
- - test/test-assertions.rb
253
- - test/test-attribute-matcher.rb
254
- - test/test-attribute.rb
255
- - test/test-code-snippet.rb
256
- - test/test-color-scheme.rb
257
- - test/test-color.rb
258
- - test/test-data.rb
259
- - test/test-diff.rb
260
- - test/test-emacs-runner.rb
261
- - test/test-error.rb
262
- - test/test-failure.rb
263
- - test/test-fault-location-detector.rb
264
- - test/test-fixture.rb
265
- - test/test-notification.rb
266
- - test/test-omission.rb
267
- - test/test-pending.rb
268
- - test/test-priority.rb
269
- - test/test-test-case.rb
270
- - test/test-test-result.rb
271
- - test/test-test-suite-creator.rb
272
- - test/test-test-suite.rb
273
- - test/testunit-test-util.rb
274
- - test/ui/test_testrunmediator.rb
275
- - test/util/test-method-owner-finder.rb
276
- - test/util/test-output.rb
277
- - test/util/test_backtracefilter.rb
278
- - test/util/test_observable.rb
279
- - test/util/test_procwrapper.rb
202
+ test_files: []
@@ -1,182 +0,0 @@
1
- require 'test/unit'
2
- require 'test/unit/collector/descendant'
3
-
4
- class TestUnitCollectorDescendant < Test::Unit::TestCase
5
- def setup
6
- @previous_descendants = Test::Unit::TestCase::DESCENDANTS.dup
7
- Test::Unit::TestCase::DESCENDANTS.clear
8
- end
9
-
10
- def teardown
11
- Test::Unit::TestCase::DESCENDANTS.replace(@previous_descendants)
12
- end
13
-
14
- private
15
- def assert_collect(expected, *collect_args)
16
- collector = Test::Unit::Collector::Descendant.new
17
- yield(collector) if block_given?
18
- assert_equal(expected, collector.send(:collect, *collect_args))
19
- end
20
-
21
- def default_name
22
- Test::Unit::Collector::Descendant::NAME
23
- end
24
-
25
- def empty_suite(name=nil)
26
- Test::Unit::TestSuite.new(name || default_name)
27
- end
28
-
29
- class TestCollect < self
30
- def setup
31
- super
32
-
33
- @test_case1 = Class.new(Test::Unit::TestCase) do
34
- self.test_order = :alphabetic
35
-
36
- def self.name
37
- "test-case1"
38
- end
39
-
40
- def test_1
41
- end
42
-
43
- def test_2
44
- end
45
- end
46
-
47
- @test_case2 = Class.new(Test::Unit::TestCase) do
48
- self.test_order = :alphabetic
49
-
50
- def self.name
51
- "test-case2"
52
- end
53
-
54
- def test_0
55
- end
56
- end
57
-
58
- @no_test_case = Class.new do
59
- def self.name
60
- "no-test-case"
61
- end
62
-
63
- def test_4
64
- end
65
- end
66
- end
67
-
68
- def test_basic
69
- assert_collect(full_suite("name"), "name")
70
-
71
- assert_collect(full_suite("name"), "name") do |collector|
72
- collector.filter = []
73
- end
74
- end
75
-
76
- def test_filtered
77
- assert_collect(empty_suite) do |collector|
78
- collector.filter = Proc.new {false}
79
- end
80
-
81
- assert_collect(full_suite) do |collector|
82
- collector.filter = Proc.new {true}
83
- end
84
-
85
- assert_collect(full_suite) do |collector|
86
- collector.filter = Proc.new {nil}
87
- end
88
-
89
- assert_collect(empty_suite) do |collector|
90
- collector.filter = [Proc.new {false}, Proc.new {true}]
91
- end
92
-
93
- assert_collect(empty_suite) do |collector|
94
- collector.filter = [Proc.new {true}, Proc.new {false}]
95
- end
96
-
97
- assert_collect(empty_suite) do |collector|
98
- collector.filter = [Proc.new {nil}, Proc.new {false}]
99
- end
100
-
101
- assert_collect(full_suite) do |collector|
102
- collector.filter = [Proc.new {nil}, Proc.new {true}]
103
- end
104
-
105
- expected = empty_suite
106
- suite1 = Test::Unit::TestSuite.new(@test_case1.name)
107
- suite1 << @test_case1.new("test_1")
108
- suite2 = Test::Unit::TestSuite.new(@test_case2.name)
109
- suite2 << @test_case2.new("test_0")
110
- expected << suite1 << suite2
111
- assert_collect(expected) do |collector|
112
- collector.filter = Proc.new do |test|
113
- ['test_1', 'test_0'].include?(test.method_name)
114
- end
115
- end
116
-
117
- suite1 = Test::Unit::TestSuite.new(@test_case1.name)
118
- suite1 << @test_case1.new("test_1")
119
- suite2 = Test::Unit::TestSuite.new(@test_case2.name)
120
- suite2 << @test_case2.new("test_0")
121
- assert_collect(empty_suite) do |collector|
122
- filters = [Proc.new {|test| test.method_name == 'test_1' ? true : nil},
123
- Proc.new {|test| test.method_name == 'test_0' ? true : nil},
124
- Proc.new {false}]
125
- collector.filter = filters
126
- end
127
- end
128
-
129
- private
130
- def full_suite(name=nil)
131
- sub_suite1 = Test::Unit::TestSuite.new(@test_case1.name)
132
- sub_suite1 << @test_case1.new('test_1')
133
- sub_suite1 << @test_case1.new('test_2')
134
-
135
- sub_suite2 = Test::Unit::TestSuite.new(@test_case2.name)
136
- sub_suite2 << @test_case2.new('test_0')
137
-
138
- suite = empty_suite(name)
139
- suite << sub_suite1
140
- suite << sub_suite2
141
- suite
142
- end
143
- end
144
-
145
- class TestModule < self
146
- def test_included_in_child
147
- tests = Module.new do
148
- def test_in_module
149
- end
150
- end
151
-
152
- parent_test_case = Class.new(Test::Unit::TestCase) do
153
- class << self
154
- def name
155
- "Parent"
156
- end
157
- end
158
- end
159
-
160
- child_test_case = Class.new(parent_test_case) do
161
- include tests
162
-
163
- class << self
164
- def name
165
- "Child"
166
- end
167
- end
168
- end
169
-
170
- child_suite = Test::Unit::TestSuite.new(child_test_case.name)
171
- child_suite << child_test_case.new("test_in_module")
172
-
173
- parent_suite = Test::Unit::TestSuite.new(parent_test_case.name)
174
- parent_suite << child_suite
175
-
176
- suite = empty_suite("all")
177
- suite << parent_suite
178
-
179
- assert_collect(suite, "all")
180
- end
181
- end
182
- end