test-unit 3.3.1 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,8 +26,8 @@ module Test
26
26
  # returned, making it very easy to use the proc
27
27
  # itself as the listener_key:
28
28
  #
29
- # listener = add_listener("Channel") { ... }
30
- # remove_listener("Channel", listener)
29
+ # listener = add_listener("Channel") { ... }
30
+ # remove_listener("Channel", listener)
31
31
  def add_listener(channel_name, listener_key=NOTHING, &listener) # :yields: value
32
32
  unless(block_given?)
33
33
  raise ArgumentError.new("No callback was passed as a listener")
@@ -7,10 +7,11 @@ module Test
7
7
  # error as string.
8
8
  #
9
9
  # Example:
10
- # capture_output do
11
- # puts("stdout")
12
- # warn("stderr")
13
- # end # -> ["stdout\n", "stderr\n"]
10
+ #
11
+ # capture_output do
12
+ # puts("stdout")
13
+ # warn("stderr")
14
+ # end # -> ["stdout\n", "stderr\n"]
14
15
  def capture_output
15
16
  require 'stringio'
16
17
 
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.3.1"
3
+ VERSION = "3.3.6"
4
4
  end
5
5
  end
@@ -20,7 +20,9 @@ class TestUnitCollectorLoad < Test::Unit::TestCase
20
20
 
21
21
  setup
22
22
  def setup_top_level_test_cases
23
- @test_case1 = @test_dir + "test_case1.rb"
23
+ @test_case1_base_name = "test_case1.rb"
24
+
25
+ @test_case1 = @test_dir + @test_case1_base_name
24
26
  @test_case2 = @test_dir + "test_case2.rb"
25
27
  @no_load_test_case3 = @test_dir + "case3.rb"
26
28
 
@@ -66,10 +68,25 @@ EOT
66
68
  @sub_test_dir = @test_dir + "sub"
67
69
  @sub_test_dir.mkpath
68
70
 
71
+ @sub_test_case1 = @sub_test_dir + @test_case1_base_name
69
72
  @sub_test_case4 = @sub_test_dir + "test_case4.rb"
70
73
  @no_load_sub_test_case5 = @sub_test_dir + "case5.rb"
71
74
  @sub_test_case6 = @sub_test_dir + "test_case6.rb"
72
75
 
76
+ @sub_test_case1.open("w") do |test_case|
77
+ test_case.puts(<<-TEST_CASE)
78
+ module #{@temporary_test_cases_module_name}
79
+ class SubTestCase1 < Test::Unit::TestCase
80
+ def test1_1
81
+ end
82
+
83
+ def test1_2
84
+ end
85
+ end
86
+ end
87
+ TEST_CASE
88
+ end
89
+
73
90
  @sub_test_case4.open("w") do |test_case|
74
91
  test_case.puts(<<-EOT)
75
92
  module #{@temporary_test_cases_module_name}
@@ -271,6 +288,9 @@ EOT
271
288
 
272
289
  def test_simple_collect
273
290
  assert_collect([:suite, {:name => @sub_test_dir.basename.to_s},
291
+ [:suite, {:name => _test_case_name("SubTestCase1")},
292
+ [:test, {:name => "test1_1"}],
293
+ [:test, {:name => "test1_2"}]],
274
294
  [:suite, {:name => _test_case_name("SubTestCase4")},
275
295
  [:test, {:name => "test4_1"}],
276
296
  [:test, {:name => "test4_2"}]],
@@ -302,6 +322,9 @@ EOT
302
322
  [:suite, {:name => _test_case_name("TestCase2")},
303
323
  [:test, {:name => "test2"}]],
304
324
  [:suite, {:name => @sub_test_dir.basename.to_s},
325
+ [:suite, {:name => _test_case_name("SubTestCase1")},
326
+ [:test, {:name => "test1_1"}],
327
+ [:test, {:name => "test1_2"}]],
305
328
  [:suite, {:name => _test_case_name("SubTestCase4")},
306
329
  [:test, {:name => "test4_1"}],
307
330
  [:test, {:name => "test4_2"}]],
@@ -356,6 +379,9 @@ EOT
356
379
  [:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
357
380
  [:test, {:name => "test5_1"}],
358
381
  [:test, {:name => "test5_2"}]],
382
+ [:suite, {:name => _test_case_name("SubTestCase1")},
383
+ [:test, {:name => "test1_1"}],
384
+ [:test, {:name => "test1_2"}]],
359
385
  [:suite, {:name => _test_case_name("SubTestCase4")},
360
386
  [:test, {:name => "test4_1"}],
361
387
  [:test, {:name => "test4_2"}]],
@@ -370,7 +396,11 @@ EOT
370
396
  assert_collect([:suite, {:name => "."},
371
397
  [:suite, {:name => _test_case_name("TestCase1")},
372
398
  [:test, {:name => "test1_1"}],
373
- [:test, {:name => "test1_2"}]]]) do |collector|
399
+ [:test, {:name => "test1_2"}]],
400
+ [:suite, {:name => @sub_test_dir.basename.to_s},
401
+ [:suite, {:name => _test_case_name("SubTestCase1")},
402
+ [:test, {:name => "test1_1"}],
403
+ [:test, {:name => "test1_2"}]]]]) do |collector|
374
404
  collector.filter = Proc.new do |test|
375
405
  !/\Atest1/.match(test.method_name).nil?
376
406
  end
@@ -381,6 +411,9 @@ EOT
381
411
  test_dirs = [@sub_test_dir.to_s, @sub2_test_dir.to_s]
382
412
  assert_collect([:suite, {:name => "[#{test_dirs.join(', ')}]"},
383
413
  [:suite, {:name => @sub_test_dir.basename.to_s},
414
+ [:suite, {:name => _test_case_name("SubTestCase1")},
415
+ [:test, {:name => "test1_1"}],
416
+ [:test, {:name => "test1_2"}]],
384
417
  [:suite, {:name => _test_case_name("SubTestCase4")},
385
418
  [:test, {:name => "test4_1"}],
386
419
  [:test, {:name => "test4_2"}]],
@@ -289,14 +289,19 @@ EOM
289
289
  end
290
290
 
291
291
  def test_same_inspected_objects
292
- now = Time.now
293
- now_without_usec = Time.at(now.to_i)
292
+ same_inspected_class = Class.new do
293
+ def inspect
294
+ "inspected"
295
+ end
296
+ end
297
+ object1 = same_inspected_class.new
298
+ object2 = same_inspected_class.new
294
299
  message = <<-EOM.chomp
295
- <#{now.inspect}> expected but was
296
- <#{now.inspect}>.
300
+ <inspected> expected but was
301
+ <inspected>.
297
302
  EOM
298
303
  check_fail(message) do
299
- assert_equal(now, now_without_usec)
304
+ assert_equal(object1, object2)
300
305
  end
301
306
  end
302
307
 
@@ -104,7 +104,7 @@ class TestUnitPriority < Test::Unit::TestCase
104
104
 
105
105
  class TestClassName < self
106
106
  def test_colon
107
- assert_escaped_name("Test__Priority", "Test::Priority")
107
+ assert_escaped_name("Test_colon__colon_Priority", "Test::Priority")
108
108
  end
109
109
 
110
110
  def test_space
@@ -119,6 +119,18 @@ class TestUnitPriority < Test::Unit::TestCase
119
119
  assert_escaped_name("test_priority", "test\/priority")
120
120
  end
121
121
 
122
+ def test_question
123
+ assert_escaped_name("#question.predicate", "#question?")
124
+ end
125
+
126
+ def test_exclamation
127
+ assert_escaped_name("#exclamation.destructive", "#exclamation!")
128
+ end
129
+
130
+ def test_equal
131
+ assert_escaped_name("#equal.equal", "#equal=")
132
+ end
133
+
122
134
  def assert_escaped_name(expected, class_name)
123
135
  checker = Checker.new(nil)
124
136
  escaped_class_name = checker.send(:escape_class_name, class_name)
@@ -148,19 +160,18 @@ class TestUnitPriority < Test::Unit::TestCase
148
160
  end
149
161
 
150
162
  def test_question
151
- assert_escaped_name("test_question.predicate", "test_question?")
163
+ assert_escaped_name("test_colon__#question.predicate_case",
164
+ "test: #question? case")
152
165
  end
153
166
 
154
167
  def test_exclamation
155
- assert_escaped_name("test_exclamation.destructive", "test_exclamation!")
168
+ assert_escaped_name("test_colon__#exclamation.destructive_case",
169
+ "test: #exclamation! case")
156
170
  end
157
171
 
158
172
  def test_equal
159
- assert_escaped_name("test_equal.equal", "test_equal=")
160
- end
161
-
162
- def test_colon_and_space
163
- assert_escaped_name("test_colon__have_space", "test: have space")
173
+ assert_escaped_name("test_colon__#equal.equal_case",
174
+ "test: #equal= case")
164
175
  end
165
176
 
166
177
  def assert_escaped_name(expected, test_method_name)
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.3.1
4
+ version: 3.3.6
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: 2019-03-26 00:00:00.000000000 Z
12
+ date: 2020-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert
@@ -231,49 +231,48 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  - !ruby/object:Gem::Version
232
232
  version: '0'
233
233
  requirements: []
234
- rubyforge_project:
235
- rubygems_version: 2.7.6
234
+ rubygems_version: 3.2.0.pre1
236
235
  signing_key:
237
236
  specification_version: 4
238
237
  summary: An xUnit family unit testing framework for Ruby.
239
238
  test_files:
240
- - test/test-code-snippet.rb
241
- - test/test-fault-location-detector.rb
242
- - test/test-attribute.rb
243
- - test/test-priority.rb
244
- - test/test-color-scheme.rb
245
- - test/test-failure.rb
246
- - test/test-color.rb
247
- - test/ui/test_testrunmediator.rb
248
- - test/test-attribute-matcher.rb
249
- - test/test-test-suite.rb
250
- - test/test-test-suite-creator.rb
251
- - test/test-diff.rb
252
- - test/test-emacs-runner.rb
253
- - test/test-data.rb
239
+ - test/collector/test-descendant.rb
240
+ - test/collector/test-load.rb
241
+ - test/collector/test_dir.rb
242
+ - test/collector/test_objectspace.rb
243
+ - test/fixtures/header-label.csv
244
+ - test/fixtures/header-label.tsv
254
245
  - test/fixtures/header.csv
255
246
  - test/fixtures/header.tsv
247
+ - test/fixtures/no-header.csv
256
248
  - test/fixtures/no-header.tsv
257
249
  - test/fixtures/plus.csv
258
- - test/fixtures/no-header.csv
259
- - test/fixtures/header-label.tsv
260
- - test/fixtures/header-label.csv
250
+ - test/run-test.rb
261
251
  - test/test-assertions.rb
262
- - test/test-test-result.rb
263
- - test/testunit-test-util.rb
264
- - test/collector/test-load.rb
265
- - test/collector/test_dir.rb
266
- - test/collector/test_objectspace.rb
267
- - test/collector/test-descendant.rb
252
+ - test/test-attribute-matcher.rb
253
+ - test/test-attribute.rb
254
+ - test/test-code-snippet.rb
255
+ - test/test-color-scheme.rb
256
+ - test/test-color.rb
257
+ - test/test-data.rb
258
+ - test/test-diff.rb
259
+ - test/test-emacs-runner.rb
268
260
  - test/test-error.rb
269
- - test/run-test.rb
270
- - test/test-pending.rb
261
+ - test/test-failure.rb
262
+ - test/test-fault-location-detector.rb
271
263
  - test/test-fixture.rb
272
- - test/util/test-output.rb
273
- - test/util/test-method-owner-finder.rb
274
- - test/util/test_observable.rb
275
- - test/util/test_procwrapper.rb
276
- - test/util/test_backtracefilter.rb
277
264
  - test/test-notification.rb
278
265
  - test/test-omission.rb
266
+ - test/test-pending.rb
267
+ - test/test-priority.rb
279
268
  - test/test-test-case.rb
269
+ - test/test-test-result.rb
270
+ - test/test-test-suite-creator.rb
271
+ - test/test-test-suite.rb
272
+ - test/testunit-test-util.rb
273
+ - test/ui/test_testrunmediator.rb
274
+ - test/util/test-method-owner-finder.rb
275
+ - test/util/test-output.rb
276
+ - test/util/test_backtracefilter.rb
277
+ - test/util/test_observable.rb
278
+ - test/util/test_procwrapper.rb