minitest_tu_shim 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
File without changes
@@ -1,3 +1,15 @@
1
+ === 1.3.3 / 2013-08-29
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added assert_block because rails 3 and other old libs still use it.
6
+
7
+ * 3 bug fixes:
8
+
9
+ * Cleaned up 1.9.3 warnings.
10
+ * Minor fixes to tests to get them happy for minitest changes.
11
+ * Updated tests to work with new minitest output and methods
12
+
1
13
  === 1.3.2 / 2010-03-27
2
14
 
3
15
  * 2 bug fixes:
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ $TESTING_MINIUNIT = true
5
5
  require 'rubygems'
6
6
  require 'hoe'
7
7
 
8
- Hoe.add_include_dirs "../../minitest/dev/lib", "lib"
8
+ Hoe.add_include_dirs "../../minitest/4.7.5/lib"
9
9
 
10
10
  require 'test/unit/testcase'
11
11
 
@@ -14,9 +14,7 @@ Hoe.plugin :perforce, :email # can't do minitest, so no seattlerb wrapper
14
14
  Hoe.spec 'minitest_tu_shim' do
15
15
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
16
16
 
17
- self.rubyforge_name = "bfts"
18
-
19
- extra_deps << ['minitest', ">= #{MiniTest::Unit::VERSION}"]
17
+ dependency "minitest", "~> 4.0"
20
18
  end
21
19
 
22
20
  # vim: syntax=ruby
@@ -34,6 +34,15 @@ module Test::Unit
34
34
  tu_deprecate :assert_not_nil, :refute_nil # 2009-06-01
35
35
  tu_deprecate :assert_not_same, :refute_same # 2009-06-01
36
36
 
37
+ ##
38
+ # Fails unless the block returns a true value.
39
+
40
+ def assert_block msg = nil
41
+ warn "NOTE: MiniTest::Unit::TestCase#assert_block is deprecated, use assert. It will be removed on 2013-01-01. Called from #{caller.first}"
42
+ msg = message(msg) { "Expected block to return true value" }
43
+ assert yield, msg
44
+ end
45
+
37
46
  def assert_nothing_raised _ = :ignored # 2009-06-01
38
47
  self.class.tu_deprecation_warning :assert_nothing_raised
39
48
  self._assertions += 1
@@ -15,7 +15,7 @@ class Module # define deprecation api
15
15
  def tu_deprecate old, new
16
16
  class_eval <<-EOM
17
17
  def #{old} *args, &block
18
- cls, clr = self.class, caller.first
18
+ clr = caller.first
19
19
  self.class.tu_deprecation_warning #{old.inspect}, #{new.inspect}, clr
20
20
  #{new}(*args, &block)
21
21
  end
@@ -12,7 +12,7 @@ module Test::Unit # was ::Mini::Test, but rails' horrid code forced my hand
12
12
 
13
13
  class TestCase < ::MiniTest::Unit::TestCase
14
14
 
15
- VERSION = '1.3.2'
15
+ VERSION = '1.3.3'
16
16
 
17
17
  tu_deprecate :method_name, :name # 2009-06-01
18
18
 
@@ -1,17 +1,15 @@
1
1
  require 'stringio'
2
- require 'minitest/unit'
3
-
4
- MiniTest::Unit.autorun
2
+ require 'minitest/autorun'
3
+ require 'test/unit'
5
4
 
6
5
  class TestMiniTest < MiniTest::Unit::TestCase
7
-
8
6
  def setup
9
7
  srand 42
10
8
  MiniTest::Unit::TestCase.reset
11
9
  @tu = MiniTest::Unit.new
12
10
  @output = StringIO.new("")
11
+ MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
13
12
  MiniTest::Unit.output = @output
14
- assert_equal [0, 0], @tu.run_test_suites
15
13
  end
16
14
 
17
15
  def teardown
@@ -27,26 +25,6 @@ class TestMiniTest < MiniTest::Unit::TestCase
27
25
  "./lib/mini/test.rb:139:in `run'",
28
26
  "./lib/mini/test.rb:106:in `run'"]
29
27
 
30
- # def test_filter_backtrace
31
- # # this is a semi-lame mix of relative paths.
32
- # # I cheated by making the autotest parts not have ./
33
- # bt = (["lib/autotest.rb:571:in `add_exception'",
34
- # "test/test_autotest.rb:62:in `test_add_exception'",
35
- # "./lib/mini/test.rb:165:in `__send__'"] +
36
- # BT_MIDDLE +
37
- # ["./lib/mini/test.rb:29",
38
- # "test/test_autotest.rb:422"])
39
- # bt = util_expand_bt bt
40
-
41
- # ex = ["lib/autotest.rb:571:in `add_exception'",
42
- # "test/test_autotest.rb:62:in `test_add_exception'"]
43
- # ex = util_expand_bt ex
44
-
45
- # fu = MiniTest::filter_backtrace(bt)
46
-
47
- # assert_equal ex, fu
48
- # end
49
-
50
28
  def util_expand_bt bt
51
29
  if RUBY_VERSION =~ /^1\.9/ then
52
30
  bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
@@ -64,19 +42,6 @@ class TestMiniTest < MiniTest::Unit::TestCase
64
42
  assert_equal ex, fu
65
43
  end
66
44
 
67
- # def test_filter_backtrace_unit_starts
68
- # bt = (["./lib/mini/test.rb:165:in `__send__'"] +
69
- # BT_MIDDLE +
70
- # ["./lib/mini/test.rb:29",
71
- # "-e:1"])
72
-
73
- # bt = util_expand_bt bt
74
-
75
- # ex = ["-e:1"]
76
- # fu = MiniTest::filter_backtrace(bt)
77
- # assert_equal ex, fu
78
- # end
79
-
80
45
  def test_class_puke_with_assertion_failed
81
46
  exception = MiniTest::Assertion.new "Oh no!"
82
47
  exception.set_backtrace ["unhappy"]
@@ -109,9 +74,7 @@ class TestMiniTest < MiniTest::Unit::TestCase
109
74
  end
110
75
  end
111
76
 
112
- Object.const_set(:ATestCase, tc)
113
-
114
- assert_equal [1, 1], @tu.run_test_suites
77
+ assert_equal [1, 1], @tu._run_suite(tc, "test")
115
78
  end
116
79
 
117
80
  def test_run_failing # TODO: add error test
@@ -133,20 +96,21 @@ class TestMiniTest < MiniTest::Unit::TestCase
133
96
 
134
97
  @tu.run
135
98
 
136
- expected = "Loaded suite blah
137
- Started
99
+ expected = "Run options:
100
+
101
+ # Running tests:
102
+
138
103
  F.
139
- Finished in 0.00
104
+
105
+ Finished tests in 0.00s, 0.00 tests/s, 0.00 assertions/s.
140
106
 
141
107
  1) Failure:
142
- test_failure(ATestCase) [FILE:LINE]:
108
+ ATestCase#test_failure [FILE:LINE]:
143
109
  Failed assertion, no message given.
144
110
 
145
111
  2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
146
-
147
- Test run options:
148
112
  "
149
- util_assert_report expected
113
+ assert_report expected
150
114
  end
151
115
 
152
116
  def test_run_error
@@ -168,21 +132,22 @@ Test run options:
168
132
 
169
133
  @tu.run
170
134
 
171
- expected = "Loaded suite blah
172
- Started
135
+ expected = "Run options:
136
+
137
+ # Running tests:
138
+
173
139
  E.
174
- Finished in 0.00
140
+
141
+ Finished tests in 0.00s, 0.00 tests/s, 0.00 assertions/s.
175
142
 
176
143
  1) Error:
177
- test_error(ATestCase):
144
+ ATestCase#test_error:
178
145
  RuntimeError: unhandled exception
179
146
  FILE:LINE:in `test_error'
180
147
 
181
148
  2 tests, 1 assertions, 0 failures, 1 errors, 0 skips
182
-
183
- Test run options:
184
149
  "
185
- util_assert_report expected
150
+ assert_report expected
186
151
  end
187
152
 
188
153
  def test_run_error_teardown
@@ -200,21 +165,22 @@ Test run options:
200
165
 
201
166
  @tu.run
202
167
 
203
- expected = "Loaded suite blah
204
- Started
168
+ expected = "Run options:
169
+
170
+ # Running tests:
171
+
205
172
  E
206
- Finished in 0.00
173
+
174
+ Finished tests in 0.00s, 0.00 tests/s, 0.00 assertions/s.
207
175
 
208
176
  1) Error:
209
- test_something(ATestCase):
177
+ ATestCase#test_something:
210
178
  RuntimeError: unhandled exception
211
179
  FILE:LINE:in `teardown'
212
180
 
213
181
  1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
214
-
215
- Test run options:
216
182
  "
217
- util_assert_report expected
183
+ assert_report expected
218
184
  end
219
185
 
220
186
  def test_run_skip
@@ -234,38 +200,42 @@ Test run options:
234
200
 
235
201
  Object.const_set(:ATestCase, tc)
236
202
 
237
- @tu.run
203
+ @tu.run %w[--seed 42 --verbose]
204
+
205
+ expected = "Run options:
206
+
207
+ # Running tests:
238
208
 
239
- expected = "Loaded suite blah
240
- Started
241
- S.
242
- Finished in 0.00
209
+ ATestCase#test_skip = 0.00 s = S
210
+ ATestCase#test_something = 0.00 s = .
211
+
212
+
213
+ Finished tests in 0.00s, 0.00 tests/s, 0.00 assertions/s.
243
214
 
244
215
  1) Skipped:
245
- test_skip(ATestCase) [FILE:LINE]:
216
+ ATestCase#test_skip [FILE:LINE]:
246
217
  not yet
247
218
 
248
219
  2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
249
-
250
- Test run options:
251
220
  "
252
- util_assert_report expected
221
+ assert_report expected
253
222
  end
254
223
 
255
- def util_assert_report expected = nil
256
- expected ||= "Loaded suite blah
257
- Started
224
+ def assert_report expected = nil
225
+ expected ||= "Run options:
226
+
227
+ # Running tests:
228
+
258
229
  .
259
- Finished in 0.00
260
230
 
261
- 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
231
+ Finished tests in 0.00s, 0.00 tests/s, 0.00 assertions/s.
262
232
 
263
- Test run options:
233
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
264
234
  "
265
- output = @output.string.sub(/Finished in .*/, "Finished in 0.00")
235
+ output = @output.string.gsub(/\d+\.\d+/, "0.00")
266
236
  output.sub!(/Loaded suite .*/, 'Loaded suite blah')
267
237
  output.sub!(/[\w\/\.]+:\d+/, 'FILE:LINE')
268
- output.gsub!(/(Test run options:).+/, '\1')
238
+ output.gsub!(/(Run options:).+/, '\1')
269
239
  assert_equal(expected, output)
270
240
  end
271
241
 
@@ -288,7 +258,7 @@ Test run options:
288
258
 
289
259
  @tu.run(%w(-n /something/))
290
260
 
291
- util_assert_report
261
+ assert_report
292
262
  end
293
263
 
294
264
  def test_run_passing
@@ -302,7 +272,7 @@ Test run options:
302
272
 
303
273
  @tu.run
304
274
 
305
- util_assert_report
275
+ assert_report
306
276
  end
307
277
  end
308
278
 
@@ -344,9 +314,11 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
344
314
  methods = MiniTest::Assertions.public_instance_methods
345
315
  methods.map! { |m| m.to_s } if Symbol === methods.first
346
316
 
347
- ignores = %w(assert_block assert_no_match assert_not_equal assert_not_nil
348
- assert_not_same assert_nothing_thrown assert_raise
349
- assert_nothing_raised assert_raises assert_throws assert_send)
317
+ ignores = %w(assert_no_match assert_not_equal
318
+ assert_not_nil assert_not_same assert_nothing_thrown
319
+ assert_output assert_raise assert_nothing_raised
320
+ assert_raises assert_throws assert_send
321
+ assert_silent assert_block)
350
322
  asserts = methods.grep(/^assert/).sort - ignores
351
323
  refutes = methods.grep(/^refute/).sort - ignores
352
324
 
@@ -372,20 +344,6 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
372
344
  end
373
345
  end
374
346
 
375
- def test_assert_block
376
- @tc.assert_block do
377
- true
378
- end
379
- end
380
-
381
- def test_assert_block_triggered
382
- util_assert_triggered 'Expected block to return true value.' do
383
- @tc.assert_block do
384
- false
385
- end
386
- end
387
- end
388
-
389
347
  def test_assert_empty
390
348
  @assertion_count = 2
391
349
 
@@ -405,7 +363,7 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
405
363
  end
406
364
 
407
365
  def test_assert_equal_different
408
- util_assert_triggered "Expected 1, not 2." do
366
+ util_assert_triggered "Expected: 1\n Actual: 2" do
409
367
  @tc.assert_equal 1, 2
410
368
  end
411
369
  end
@@ -415,7 +373,7 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
415
373
  end
416
374
 
417
375
  def test_assert_in_delta_triggered
418
- util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to be < 1.0e-06.' do
376
+ util_assert_triggered 'Expected |0.0 - 0.001| (0.001) to be <= 1.0e-06.' do
419
377
  @tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
420
378
  end
421
379
  end
@@ -435,7 +393,7 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
435
393
  end
436
394
 
437
395
  def test_assert_in_epsilon_triggered
438
- util_assert_triggered 'Expected 10000 - 9990 (10) to be < 9.99.' do
396
+ util_assert_triggered 'Expected |10000 - 9990| (10) to be <= 9.99.' do
439
397
  @tc.assert_in_epsilon 10000, 9990
440
398
  end
441
399
  end
@@ -479,13 +437,13 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
479
437
 
480
438
  def test_assert_match
481
439
  @assertion_count = 2
482
- @tc.assert_match "blah blah blah", /\w+/
440
+ @tc.assert_match(/\w+/, "blah blah blah")
483
441
  end
484
442
 
485
443
  def test_assert_match_triggered
486
444
  @assertion_count = 2
487
- util_assert_triggered 'Expected "blah blah blah" to match /\d+/.' do
488
- @tc.assert_match "blah blah blah", /\d+/
445
+ util_assert_triggered 'Expected /\d+/ to match "blah blah blah".' do
446
+ @tc.assert_match(/\d+/, "blah blah blah")
489
447
  end
490
448
  end
491
449
 
@@ -522,15 +480,18 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
522
480
  end
523
481
  end
524
482
 
525
- expected = "<[RuntimeError]> exception expected, not
483
+ expected = "[RuntimeError] exception expected, not
526
484
  Class: <SyntaxError>
527
485
  Message: <\"icky\">
528
486
  ---Backtrace---
529
487
  FILE:LINE:in `test_assert_raises_triggered_different'
530
- ---------------.
531
- Expected [RuntimeError] to include SyntaxError."
488
+ ---------------"
489
+
490
+ actual = e.message.
491
+ gsub(/[\w\/\.]+:\d+/, 'FILE:LINE').
492
+ gsub(/block .\d+ levels. in /, '')
532
493
 
533
- assert_equal expected, expected.gsub(/[\w\/\.]+:\d+/, 'FILE:LINE')
494
+ assert_equal expected, actual
534
495
  end
535
496
 
536
497
  def test_assert_raises_triggered_none
@@ -717,17 +678,17 @@ Expected [RuntimeError] to include SyntaxError."
717
678
  end
718
679
 
719
680
  def test_refute_in_delta_triggered
720
- util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to not be < 0.1.' do
681
+ util_assert_triggered 'Expected |0.0 - 0.001| (0.001) to not be <= 0.1.' do
721
682
  @tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
722
683
  end
723
684
  end
724
685
 
725
686
  def test_refute_in_epsilon
726
- @tc.refute_in_epsilon 10000, 9990
687
+ @tc.refute_in_epsilon 10000, 9989
727
688
  end
728
689
 
729
690
  def test_refute_in_epsilon_triggered
730
- util_assert_triggered 'Expected 10000 - 9991 (9) to not be < 10.0.' do
691
+ util_assert_triggered 'Expected |10000 - 9991| (9) to not be <= 10.0.' do
731
692
  @tc.refute_in_epsilon 10000, 9991
732
693
  fail
733
694
  end
@@ -773,14 +734,14 @@ Expected [RuntimeError] to include SyntaxError."
773
734
  def test_refute_match
774
735
  @assertion_count = 2
775
736
 
776
- @tc.refute_match "blah blah blah", /\d+/
737
+ @tc.refute_match(/\d+/, "blah blah blah")
777
738
  end
778
739
 
779
740
  def test_refute_match_triggered
780
741
  @assertion_count = 2
781
742
 
782
- util_assert_triggered 'Expected "blah blah blah" to not match /\w+/.' do
783
- @tc.refute_match "blah blah blah", /\w+/
743
+ util_assert_triggered 'Expected /\w+/ to not match "blah blah blah".' do
744
+ @tc.refute_match(/\w+/, "blah blah blah")
784
745
  end
785
746
  end
786
747
 
@@ -840,7 +801,7 @@ Expected [RuntimeError] to include SyntaxError."
840
801
 
841
802
  msg = e.message.sub(/(---Backtrace---).*/m, '\1')
842
803
  msg.gsub!(/\(oid=[-0-9]+\)/, '(oid=N)')
843
- msg.gsub!(/(Test run options:).+/, '\1')
804
+ msg.gsub!(/(Run options:).+/, '\1')
844
805
 
845
806
  assert_equal expected, msg
846
807
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest_tu_shim
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 29
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 3
8
- - 2
9
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Ryan Davis
@@ -35,49 +36,51 @@ cert_chain:
35
36
  FBHgymkyj/AOSqKRIpXPhjC6
36
37
  -----END CERTIFICATE-----
37
38
 
38
- date: 2010-03-27 00:00:00 -07:00
39
- default_executable:
39
+ date: 2013-08-29 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  prerelease: false
44
44
  requirement: &id001 !ruby/object:Gem::Requirement
45
+ none: false
45
46
  requirements:
46
- - - ">="
47
+ - - ~>
47
48
  - !ruby/object:Gem::Version
49
+ hash: 27
48
50
  segments:
49
- - 1
50
- - 6
51
+ - 4
51
52
  - 0
52
- version: 1.6.0
53
+ version: "4.0"
53
54
  type: :runtime
54
55
  version_requirements: *id001
55
56
  - !ruby/object:Gem::Dependency
56
- name: rubyforge
57
+ name: rdoc
57
58
  prerelease: false
58
59
  requirement: &id002 !ruby/object:Gem::Requirement
60
+ none: false
59
61
  requirements:
60
- - - ">="
62
+ - - ~>
61
63
  - !ruby/object:Gem::Version
64
+ hash: 27
62
65
  segments:
63
- - 2
66
+ - 4
64
67
  - 0
65
- - 3
66
- version: 2.0.3
68
+ version: "4.0"
67
69
  type: :development
68
70
  version_requirements: *id002
69
71
  - !ruby/object:Gem::Dependency
70
72
  name: hoe
71
73
  prerelease: false
72
74
  requirement: &id003 !ruby/object:Gem::Requirement
75
+ none: false
73
76
  requirements:
74
- - - ">="
77
+ - - ~>
75
78
  - !ruby/object:Gem::Version
79
+ hash: 9
76
80
  segments:
77
- - 2
78
- - 6
79
- - 0
80
- version: 2.6.0
81
+ - 3
82
+ - 7
83
+ version: "3.7"
81
84
  type: :development
82
85
  version_requirements: *id003
83
86
  description: |-
@@ -106,10 +109,10 @@ files:
106
109
  - lib/test/unit/error.rb
107
110
  - lib/test/unit/testcase.rb
108
111
  - test/test_mini_test.rb
109
- has_rdoc: true
112
+ - .gemtest
110
113
  homepage: http://rubyforge.org/projects/bfts
111
- licenses: []
112
-
114
+ licenses:
115
+ - MIT
113
116
  post_install_message:
114
117
  rdoc_options:
115
118
  - --main
@@ -117,23 +120,27 @@ rdoc_options:
117
120
  require_paths:
118
121
  - lib
119
122
  required_ruby_version: !ruby/object:Gem::Requirement
123
+ none: false
120
124
  requirements:
121
125
  - - ">="
122
126
  - !ruby/object:Gem::Version
127
+ hash: 3
123
128
  segments:
124
129
  - 0
125
130
  version: "0"
126
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
+ none: false
127
133
  requirements:
128
134
  - - ">="
129
135
  - !ruby/object:Gem::Version
136
+ hash: 3
130
137
  segments:
131
138
  - 0
132
139
  version: "0"
133
140
  requirements: []
134
141
 
135
- rubyforge_project: bfts
136
- rubygems_version: 1.3.6
142
+ rubyforge_project: minitest_tu_shim
143
+ rubygems_version: 1.8.25
137
144
  signing_key:
138
145
  specification_version: 3
139
146
  summary: minitest_tu_shim bridges the gap between the small and fast minitest and ruby's huge and slow test/unit.
metadata.gz.sig CHANGED
Binary file