minitest_tu_shim 1.3.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/.autotest +47 -0
- data/History.txt +5 -0
- data/Manifest.txt +12 -0
- data/README.txt +54 -0
- data/Rakefile +20 -0
- data/bin/use_minitest +23 -0
- data/lib/test/unit/assertions.rb +53 -0
- data/lib/test/unit/deprecate.rb +24 -0
- data/lib/test/unit/error.rb +11 -0
- data/lib/test/unit/testcase.rb +25 -0
- data/lib/test/unit.rb +4 -0
- data/test/test_mini_test.rb +851 -0
- metadata +87 -0
data/.autotest
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
Autotest.add_hook :initialize do |at|
|
6
|
+
at.extra_class_map["MiniSpec"] = "test/test_mini_spec.rb"
|
7
|
+
at.extra_class_map["TestMiniTestTestCase"] = "test/test_mini_test.rb"
|
8
|
+
|
9
|
+
at.libs << ":../../minitest/dev/lib"
|
10
|
+
|
11
|
+
at.add_exception 'coverage.info'
|
12
|
+
at.add_exception 'coverage'
|
13
|
+
end
|
14
|
+
|
15
|
+
# require 'autotest/rcov'
|
16
|
+
# Autotest::RCov.command = 'rcov_info'
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
# require 'autotest/restart'
|
21
|
+
|
22
|
+
# Autotest.add_hook :initialize do |at|
|
23
|
+
# at.extra_files << "../../ParseTree/dev/test/pt_testcase.rb"
|
24
|
+
# at.libs << ":../../ParseTree/dev/lib:../../ParseTree/dev/test:../../sexp_processor/dev/lib"
|
25
|
+
# at.add_exception 'unit'
|
26
|
+
# at.add_exception 'coverage'
|
27
|
+
# at.add_exception '.diff'
|
28
|
+
# at.add_exception 'coverage.info'
|
29
|
+
|
30
|
+
# at.unit_diff = "unit_diff -u -b"
|
31
|
+
|
32
|
+
# at.add_mapping(/^lib\/.*\.y$/) do |f, _|
|
33
|
+
# at.files_matching %r%^test/.*#{File.basename(f, '.y').gsub '_', '_?'}.rb$%
|
34
|
+
# end
|
35
|
+
|
36
|
+
# at.add_mapping(/pt_testcase.rb/) do |f, _|
|
37
|
+
# at.files_matching(/test_.*rb$/)
|
38
|
+
# end
|
39
|
+
|
40
|
+
# %w(TestEnvironment TestStackState).each do |klass|
|
41
|
+
# at.extra_class_map[klass] = "test/test_ruby_parser_extras.rb"
|
42
|
+
# end
|
43
|
+
|
44
|
+
# %w(TestRubyParser TestParseTree).each do |klass| # HACK
|
45
|
+
# at.extra_class_map[klass] = "test/test_ruby_parser.rb"
|
46
|
+
# end
|
47
|
+
# end
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
= minitest_tu_shim
|
2
|
+
|
3
|
+
* http://rubyforge.org/projects/bfts
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
minitest_te_shim bridges the gap between the small and fast minitest
|
8
|
+
and ruby's huge and slow test/unit.
|
9
|
+
|
10
|
+
== FEATURES/PROBLEMS:
|
11
|
+
|
12
|
+
* Fully test/unit compatible assertions.
|
13
|
+
* Allows test/unit to be required, firing up an autorunner.
|
14
|
+
* Incompatible at the runner level. Does not replicate test/unit's internals.
|
15
|
+
|
16
|
+
== HOW TO USE:
|
17
|
+
|
18
|
+
+ sudo gem install minitest_tu_shim
|
19
|
+
+ sudo use_minitest yes
|
20
|
+
+ there is no step 3.
|
21
|
+
|
22
|
+
== REQUIREMENTS:
|
23
|
+
|
24
|
+
+ minitest
|
25
|
+
+ Ruby 1.8, maybe even 1.6 or lower. No magic is involved.
|
26
|
+
|
27
|
+
== INSTALL:
|
28
|
+
|
29
|
+
+ sudo gem install minitest_tu_shim
|
30
|
+
|
31
|
+
== LICENSE:
|
32
|
+
|
33
|
+
(The MIT License)
|
34
|
+
|
35
|
+
Copyright (c) Ryan Davis, Seattle.rb
|
36
|
+
|
37
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
38
|
+
a copy of this software and associated documentation files (the
|
39
|
+
'Software'), to deal in the Software without restriction, including
|
40
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
41
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
42
|
+
permit persons to whom the Software is furnished to do so, subject to
|
43
|
+
the following conditions:
|
44
|
+
|
45
|
+
The above copyright notice and this permission notice shall be
|
46
|
+
included in all copies or substantial portions of the Software.
|
47
|
+
|
48
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
49
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
50
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
51
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
52
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
53
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
54
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
$TESTING_MINIUNIT = true
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'hoe'
|
7
|
+
|
8
|
+
Hoe.add_include_dirs "../../minitest/dev/lib", "lib"
|
9
|
+
|
10
|
+
require 'test/unit/testcase'
|
11
|
+
|
12
|
+
Hoe.new('minitest_tu_shim', Test::Unit::TestCase::VERSION) do |shim|
|
13
|
+
shim.rubyforge_name = "bfts"
|
14
|
+
|
15
|
+
shim.developer('Ryan Davis', 'ryand-ruby@zenspider.com')
|
16
|
+
|
17
|
+
shim.extra_deps << 'minitest'
|
18
|
+
end
|
19
|
+
|
20
|
+
# vim: syntax=Ruby
|
data/bin/use_minitest
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
use_miniunit = ARGV.shift
|
6
|
+
sitelib = Config::CONFIG["sitelibdir"]
|
7
|
+
projdir = File.dirname(File.dirname(File.expand_path(__FILE__)))
|
8
|
+
minidir = File.join(projdir, "lib")
|
9
|
+
|
10
|
+
case use_miniunit
|
11
|
+
when /^y/ then
|
12
|
+
File.symlink File.join(minidir, "minitest"), File.join(sitelib, "minitest")
|
13
|
+
File.symlink File.join(minidir, "test"), File.join(sitelib, "test")
|
14
|
+
puts "Added links to #{sitelib}"
|
15
|
+
when /^n/ then
|
16
|
+
File.unlink File.join(sitelib, "minitest")
|
17
|
+
File.unlink File.join(sitelib, "test")
|
18
|
+
puts "Removed links from #{sitelib}"
|
19
|
+
else
|
20
|
+
pgm = File.basename __FILE__
|
21
|
+
puts "usage: #{pgm} (yes|no)"
|
22
|
+
exit 1
|
23
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
require 'test/unit/deprecate'
|
3
|
+
|
4
|
+
module Test; end
|
5
|
+
module Test::Unit # patch up bastards that that extend improperly.
|
6
|
+
if defined? Assertions then
|
7
|
+
warn "ARGH! someone defined Test::Unit::Assertions rather than requiring"
|
8
|
+
CRAP_ASSERTIONS = Assertions
|
9
|
+
remove_const :Assertions
|
10
|
+
|
11
|
+
# this will break on junit and rubinius... *sigh*
|
12
|
+
ObjectSpace.each_object(Module) do |offender|
|
13
|
+
offender.send :include, ::MiniTest::Assertions if offender < CRAP_ASSERTIONS
|
14
|
+
end rescue nil
|
15
|
+
|
16
|
+
Test::Unit::TestCase.send :include, CRAP_ASSERTIONS
|
17
|
+
end
|
18
|
+
|
19
|
+
Assertions = ::MiniTest::Assertions
|
20
|
+
|
21
|
+
module Assertions
|
22
|
+
def self.included mod
|
23
|
+
mod.send :include, Test::Unit::CRAP_ASSERTIONS
|
24
|
+
end if defined? Test::Unit::CRAP_ASSERTIONS
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module Test::Unit
|
29
|
+
module Assertions # deprecations
|
30
|
+
tu_deprecate :assert_nothing_thrown, :assert_nothing_raised # 2009-06-01
|
31
|
+
tu_deprecate :assert_raise, :assert_raises # 2010-06-01
|
32
|
+
tu_deprecate :assert_not_equal, :refute_equal # 2009-06-01
|
33
|
+
tu_deprecate :assert_no_match, :refute_match # 2009-06-01
|
34
|
+
tu_deprecate :assert_not_nil, :refute_nil # 2009-06-01
|
35
|
+
tu_deprecate :assert_not_same, :refute_same # 2009-06-01
|
36
|
+
|
37
|
+
def assert_nothing_raised _ = :ignored # 2009-06-01
|
38
|
+
self.class.tu_deprecation_warning :assert_nothing_raised
|
39
|
+
self._assertions += 1
|
40
|
+
yield
|
41
|
+
rescue => e
|
42
|
+
raise MiniTest::Assertion, exception_details(e, "Exception raised:")
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_message(user_message, template_message, *args) # 2009-06-01
|
46
|
+
self.class.tu_deprecation_warning :build_message
|
47
|
+
user_message ||= ''
|
48
|
+
user_message += ' ' unless user_message.empty?
|
49
|
+
msg = template_message.split(/<\?>/).zip(args.map { |o| o.inspect })
|
50
|
+
user_message + msg.join
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Module # define deprecation api
|
2
|
+
DEPS = Hash.new { |h,k| h[k] = {} }
|
3
|
+
|
4
|
+
def tu_deprecation_warning old, new = nil, kaller = nil
|
5
|
+
kaller ||= caller[1]
|
6
|
+
unless DEPS[old][kaller] then
|
7
|
+
msg = "#{self}##{old} deprecated. "
|
8
|
+
msg += new ? "Use ##{new}" : "No replacement is provided"
|
9
|
+
msg += ". From #{kaller}."
|
10
|
+
warn msg
|
11
|
+
end
|
12
|
+
DEPS[old][kaller] = true
|
13
|
+
end
|
14
|
+
|
15
|
+
def tu_deprecate old, new
|
16
|
+
class_eval <<-EOM
|
17
|
+
def #{old} *args, &block
|
18
|
+
cls, clr = self.class, caller.first
|
19
|
+
self.class.tu_deprecation_warning #{old.inspect}, #{new.inspect}, clr
|
20
|
+
#{new}(*args, &block)
|
21
|
+
end
|
22
|
+
EOM
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
require 'test/unit/deprecate'
|
3
|
+
|
4
|
+
module Test; end
|
5
|
+
module Test::Unit # was ::Mini::Test, but rails' horrid code forced my hand
|
6
|
+
if defined? TestCase then
|
7
|
+
warn "ARGH! someone defined Test::Unit::TestCase rather than requiring"
|
8
|
+
remove_const :TestCase
|
9
|
+
end
|
10
|
+
|
11
|
+
AssertionFailedError = ::MiniTest::Assertion
|
12
|
+
|
13
|
+
class TestCase < ::MiniTest::Unit::TestCase
|
14
|
+
|
15
|
+
VERSION = '1.3.0'
|
16
|
+
|
17
|
+
tu_deprecate :method_name, :name # 2009-06-01
|
18
|
+
|
19
|
+
def self.test_order # 2009-06-01
|
20
|
+
:sorted
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'test/unit/assertions' # brings in deprecated methods
|
data/lib/test/unit.rb
ADDED
@@ -0,0 +1,851 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
require 'minitest/unit'
|
3
|
+
|
4
|
+
MiniTest::Unit.autorun
|
5
|
+
|
6
|
+
class TestMiniTest < MiniTest::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
srand 42
|
10
|
+
MiniTest::Unit::TestCase.reset
|
11
|
+
@tu = MiniTest::Unit.new
|
12
|
+
@output = StringIO.new("")
|
13
|
+
MiniTest::Unit.output = @output
|
14
|
+
assert_equal [0, 0], @tu.run_test_suites
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
MiniTest::Unit.output = $stdout
|
19
|
+
Object.send :remove_const, :ATestCase if defined? ATestCase
|
20
|
+
end
|
21
|
+
|
22
|
+
BT_MIDDLE = ["./lib/mini/test.rb:165:in `run_test_suites'",
|
23
|
+
"./lib/mini/test.rb:161:in `each'",
|
24
|
+
"./lib/mini/test.rb:161:in `run_test_suites'",
|
25
|
+
"./lib/mini/test.rb:158:in `each'",
|
26
|
+
"./lib/mini/test.rb:158:in `run_test_suites'",
|
27
|
+
"./lib/mini/test.rb:139:in `run'",
|
28
|
+
"./lib/mini/test.rb:106:in `run'"]
|
29
|
+
|
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
|
+
def util_expand_bt bt
|
51
|
+
if RUBY_VERSION =~ /^1\.9/ then
|
52
|
+
bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
|
53
|
+
else
|
54
|
+
bt
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_filter_backtrace_all_unit
|
59
|
+
bt = (["./lib/mini/test.rb:165:in `__send__'"] +
|
60
|
+
BT_MIDDLE +
|
61
|
+
["./lib/mini/test.rb:29"])
|
62
|
+
ex = bt.clone
|
63
|
+
fu = MiniTest::filter_backtrace(bt)
|
64
|
+
assert_equal ex, fu
|
65
|
+
end
|
66
|
+
|
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
|
+
def test_class_puke_with_assertion_failed
|
81
|
+
exception = MiniTest::Assertion.new "Oh no!"
|
82
|
+
exception.set_backtrace ["unhappy"]
|
83
|
+
assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception)
|
84
|
+
assert_equal 1, @tu.failures
|
85
|
+
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_class_puke_with_failure_and_flunk_in_backtrace
|
89
|
+
exception = begin
|
90
|
+
MiniTest::Unit::TestCase.new('fake tc').flunk
|
91
|
+
rescue MiniTest::Assertion => failure
|
92
|
+
failure
|
93
|
+
end
|
94
|
+
assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception)
|
95
|
+
refute @tu.report.any?{|line| line =~ /in .flunk/}
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_class_puke_with_non_failure_exception
|
99
|
+
exception = Exception.new("Oh no again!")
|
100
|
+
assert_equal 'E', @tu.puke('SomeClass', 'method_name', exception)
|
101
|
+
assert_equal 1, @tu.errors
|
102
|
+
assert_match(/^Exception.*Oh no again!/m, @tu.report.first)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_class_run_test_suites
|
106
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
107
|
+
def test_something
|
108
|
+
assert true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
Object.const_set(:ATestCase, tc)
|
113
|
+
|
114
|
+
assert_equal [1, 1], @tu.run_test_suites
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_run_failing # TODO: add error test
|
118
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
119
|
+
def test_something
|
120
|
+
assert true
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_failure
|
124
|
+
assert false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
Object.const_set(:ATestCase, tc)
|
129
|
+
|
130
|
+
@tu.run
|
131
|
+
|
132
|
+
expected = "Loaded suite blah
|
133
|
+
Started
|
134
|
+
F.
|
135
|
+
Finished in 0.00
|
136
|
+
|
137
|
+
1) Failure:
|
138
|
+
test_failure(ATestCase) [FILE:LINE]:
|
139
|
+
Failed assertion, no message given.
|
140
|
+
|
141
|
+
2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
|
142
|
+
"
|
143
|
+
util_assert_report expected
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_run_error
|
147
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
148
|
+
def test_something
|
149
|
+
assert true
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_error
|
153
|
+
raise "unhandled exception"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
Object.const_set(:ATestCase, tc)
|
158
|
+
|
159
|
+
@tu.run
|
160
|
+
|
161
|
+
expected = "Loaded suite blah
|
162
|
+
Started
|
163
|
+
E.
|
164
|
+
Finished in 0.00
|
165
|
+
|
166
|
+
1) Error:
|
167
|
+
test_error(ATestCase):
|
168
|
+
RuntimeError: unhandled exception
|
169
|
+
FILE:LINE:in `test_error'
|
170
|
+
|
171
|
+
2 tests, 1 assertions, 0 failures, 1 errors, 0 skips
|
172
|
+
"
|
173
|
+
util_assert_report expected
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_run_error_teardown
|
177
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
178
|
+
def test_something
|
179
|
+
assert true
|
180
|
+
end
|
181
|
+
|
182
|
+
def teardown
|
183
|
+
raise "unhandled exception"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
Object.const_set(:ATestCase, tc)
|
188
|
+
|
189
|
+
@tu.run
|
190
|
+
|
191
|
+
expected = "Loaded suite blah
|
192
|
+
Started
|
193
|
+
E
|
194
|
+
Finished in 0.00
|
195
|
+
|
196
|
+
1) Error:
|
197
|
+
test_something(ATestCase):
|
198
|
+
RuntimeError: unhandled exception
|
199
|
+
FILE:LINE:in `teardown'
|
200
|
+
|
201
|
+
1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
|
202
|
+
"
|
203
|
+
util_assert_report expected
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_run_skip
|
207
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
208
|
+
def test_something
|
209
|
+
assert true
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_skip
|
213
|
+
skip "not yet"
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
Object.const_set(:ATestCase, tc)
|
218
|
+
|
219
|
+
@tu.run
|
220
|
+
|
221
|
+
expected = "Loaded suite blah
|
222
|
+
Started
|
223
|
+
S.
|
224
|
+
Finished in 0.00
|
225
|
+
|
226
|
+
1) Skipped:
|
227
|
+
test_skip(ATestCase) [FILE:LINE]:
|
228
|
+
not yet
|
229
|
+
|
230
|
+
2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
|
231
|
+
"
|
232
|
+
util_assert_report expected
|
233
|
+
end
|
234
|
+
|
235
|
+
def util_assert_report expected = nil
|
236
|
+
expected ||= "Loaded suite blah
|
237
|
+
Started
|
238
|
+
.
|
239
|
+
Finished in 0.00
|
240
|
+
|
241
|
+
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
|
242
|
+
"
|
243
|
+
output = @output.string.sub(/Finished in .*/, "Finished in 0.00")
|
244
|
+
output.sub!(/Loaded suite .*/, 'Loaded suite blah')
|
245
|
+
output.sub!(/[\w\/\.]+:\d+/, 'FILE:LINE')
|
246
|
+
assert_equal(expected, output)
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_run_failing_filtered
|
250
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
251
|
+
def test_something
|
252
|
+
assert true
|
253
|
+
end
|
254
|
+
|
255
|
+
def test_failure
|
256
|
+
assert false
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
Object.const_set(:ATestCase, tc)
|
261
|
+
|
262
|
+
@tu.run(%w(-n /something/))
|
263
|
+
|
264
|
+
util_assert_report
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_run_passing
|
268
|
+
tc = Class.new(MiniTest::Unit::TestCase) do
|
269
|
+
def test_something
|
270
|
+
assert true
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
Object.const_set(:ATestCase, tc)
|
275
|
+
|
276
|
+
@tu.run
|
277
|
+
|
278
|
+
util_assert_report
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
class TestMiniTestTestCase < MiniTest::Unit::TestCase
|
283
|
+
def setup
|
284
|
+
MiniTest::Unit::TestCase.reset
|
285
|
+
|
286
|
+
@tc = MiniTest::Unit::TestCase.new 'fake tc'
|
287
|
+
@zomg = "zomg ponies!"
|
288
|
+
@assertion_count = 1
|
289
|
+
end
|
290
|
+
|
291
|
+
def teardown
|
292
|
+
assert_equal(@assertion_count, @tc._assertions,
|
293
|
+
"expected #{@assertion_count} assertions to be fired during the test, not #{@tc._assertions}") if @tc._assertions
|
294
|
+
Object.send :remove_const, :ATestCase if defined? ATestCase
|
295
|
+
end
|
296
|
+
|
297
|
+
def test_class_inherited
|
298
|
+
@assertion_count = 0
|
299
|
+
|
300
|
+
Object.const_set(:ATestCase, Class.new(MiniTest::Unit::TestCase))
|
301
|
+
|
302
|
+
assert_equal [ATestCase], MiniTest::Unit::TestCase.test_suites
|
303
|
+
end
|
304
|
+
|
305
|
+
def test_class_test_suites
|
306
|
+
@assertion_count = 0
|
307
|
+
|
308
|
+
Object.const_set(:ATestCase, Class.new(MiniTest::Unit::TestCase))
|
309
|
+
|
310
|
+
assert_equal 1, MiniTest::Unit::TestCase.test_suites.size
|
311
|
+
assert_equal [ATestCase], MiniTest::Unit::TestCase.test_suites
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_class_asserts_match_refutes
|
315
|
+
@assertion_count = 0
|
316
|
+
|
317
|
+
methods = MiniTest::Assertions.public_instance_methods
|
318
|
+
methods.map! { |m| m.to_s } if Symbol === methods.first
|
319
|
+
|
320
|
+
ignores = %w(assert_block assert_no_match assert_not_equal assert_not_nil
|
321
|
+
assert_not_same assert_nothing_thrown assert_raise
|
322
|
+
assert_nothing_raised assert_raises assert_throws assert_send)
|
323
|
+
asserts = methods.grep(/^assert/).sort - ignores
|
324
|
+
refutes = methods.grep(/^refute/).sort - ignores
|
325
|
+
|
326
|
+
assert_empty refutes.map { |n| n.sub(/^refute/, 'assert') } - asserts
|
327
|
+
assert_empty asserts.map { |n| n.sub(/^assert/, 'refute') } - refutes
|
328
|
+
end
|
329
|
+
|
330
|
+
def test_assert
|
331
|
+
@assertion_count = 2
|
332
|
+
|
333
|
+
@tc.assert_equal true, @tc.assert(true), "returns true on success"
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_assert__triggered
|
337
|
+
util_assert_triggered "Failed assertion, no message given." do
|
338
|
+
@tc.assert false
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
def test_assert__triggered_message
|
343
|
+
util_assert_triggered @zomg do
|
344
|
+
@tc.assert false, @zomg
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
def test_assert_block
|
349
|
+
@tc.assert_block do
|
350
|
+
true
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
def test_assert_block_triggered
|
355
|
+
util_assert_triggered 'Expected block to return true value.' do
|
356
|
+
@tc.assert_block do
|
357
|
+
false
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_assert_empty
|
363
|
+
@assertion_count = 2
|
364
|
+
|
365
|
+
@tc.assert_empty []
|
366
|
+
end
|
367
|
+
|
368
|
+
def test_assert_empty_triggered
|
369
|
+
@assertion_count = 2
|
370
|
+
|
371
|
+
util_assert_triggered "Expected [1] to be empty." do
|
372
|
+
@tc.assert_empty [1]
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
def test_assert_equal
|
377
|
+
@tc.assert_equal 1, 1
|
378
|
+
end
|
379
|
+
|
380
|
+
def test_assert_equal_different
|
381
|
+
util_assert_triggered "Expected 1, not 2." do
|
382
|
+
@tc.assert_equal 1, 2
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
def test_assert_in_delta
|
387
|
+
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.1
|
388
|
+
end
|
389
|
+
|
390
|
+
def test_assert_in_delta_triggered
|
391
|
+
util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to be < 1.0e-06.' do
|
392
|
+
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
|
393
|
+
end
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_assert_in_epsilon
|
397
|
+
@assertion_count = 8
|
398
|
+
|
399
|
+
@tc.assert_in_epsilon 10000, 9991
|
400
|
+
@tc.assert_in_epsilon 9991, 10000
|
401
|
+
@tc.assert_in_epsilon 1.0, 1.001
|
402
|
+
@tc.assert_in_epsilon 1.001, 1.0
|
403
|
+
|
404
|
+
@tc.assert_in_epsilon 10000, 9999.1, 0.0001
|
405
|
+
@tc.assert_in_epsilon 9999.1, 10000, 0.0001
|
406
|
+
@tc.assert_in_epsilon 1.0, 1.0001, 0.0001
|
407
|
+
@tc.assert_in_epsilon 1.0001, 1.0, 0.0001
|
408
|
+
end
|
409
|
+
|
410
|
+
def test_assert_in_epsilon_triggered
|
411
|
+
util_assert_triggered 'Expected 10000 - 9990 (10) to be < 9.99.' do
|
412
|
+
@tc.assert_in_epsilon 10000, 9990
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
def test_assert_includes
|
417
|
+
@assertion_count = 2
|
418
|
+
|
419
|
+
@tc.assert_includes [true], true
|
420
|
+
end
|
421
|
+
|
422
|
+
def test_assert_includes_triggered
|
423
|
+
@assertion_count = 4
|
424
|
+
|
425
|
+
e = @tc.assert_raises MiniTest::Assertion do
|
426
|
+
@tc.assert_includes [true], false
|
427
|
+
end
|
428
|
+
|
429
|
+
expected = "Expected [true] to include false."
|
430
|
+
assert_equal expected, e.message
|
431
|
+
end
|
432
|
+
|
433
|
+
def test_assert_instance_of
|
434
|
+
@tc.assert_instance_of String, "blah"
|
435
|
+
end
|
436
|
+
|
437
|
+
def test_assert_instance_of_triggered
|
438
|
+
util_assert_triggered 'Expected "blah" to be an instance of Array, not String.' do
|
439
|
+
@tc.assert_instance_of Array, "blah"
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
def test_assert_kind_of
|
444
|
+
@tc.assert_kind_of String, "blah"
|
445
|
+
end
|
446
|
+
|
447
|
+
def test_assert_kind_of_triggered
|
448
|
+
util_assert_triggered 'Expected "blah" to be a kind of Array, not String.' do
|
449
|
+
@tc.assert_kind_of Array, "blah"
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
def test_assert_match
|
454
|
+
@assertion_count = 2
|
455
|
+
@tc.assert_match "blah blah blah", /\w+/
|
456
|
+
end
|
457
|
+
|
458
|
+
def test_assert_match_triggered
|
459
|
+
@assertion_count = 2
|
460
|
+
util_assert_triggered 'Expected /\d+/ to match "blah blah blah".' do
|
461
|
+
@tc.assert_match "blah blah blah", /\d+/
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
def test_assert_nil
|
466
|
+
@tc.assert_nil nil
|
467
|
+
end
|
468
|
+
|
469
|
+
def test_assert_nil_triggered
|
470
|
+
util_assert_triggered 'Expected 42 to be nil.' do
|
471
|
+
@tc.assert_nil 42
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
def test_assert_operator
|
476
|
+
@tc.assert_operator 2, :>, 1
|
477
|
+
end
|
478
|
+
|
479
|
+
def test_assert_operator_triggered
|
480
|
+
util_assert_triggered "Expected 2 to be < 1." do
|
481
|
+
@tc.assert_operator 2, :<, 1
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
def test_assert_raises
|
486
|
+
@assertion_count = 2
|
487
|
+
|
488
|
+
@tc.assert_raises RuntimeError do
|
489
|
+
raise "blah"
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
def test_assert_raises_triggered_different
|
494
|
+
@assertion_count = 2
|
495
|
+
|
496
|
+
e = assert_raises MiniTest::Assertion do
|
497
|
+
@tc.assert_raises RuntimeError do
|
498
|
+
raise SyntaxError, "icky"
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
expected = "<[RuntimeError]> exception expected, not
|
503
|
+
Class: <SyntaxError>
|
504
|
+
Message: <\"icky\">
|
505
|
+
---Backtrace---
|
506
|
+
FILE:LINE:in `test_assert_raises_triggered_different'
|
507
|
+
---------------.
|
508
|
+
Expected [RuntimeError] to include SyntaxError."
|
509
|
+
|
510
|
+
assert_equal expected, expected.gsub(/[\w\/\.]+:\d+/, 'FILE:LINE')
|
511
|
+
end
|
512
|
+
|
513
|
+
def test_assert_raises_triggered_none
|
514
|
+
e = assert_raises MiniTest::Assertion do
|
515
|
+
@tc.assert_raises MiniTest::Assertion do
|
516
|
+
# do nothing
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
expected = "MiniTest::Assertion expected but nothing was raised."
|
521
|
+
|
522
|
+
assert_equal expected, e.message
|
523
|
+
end
|
524
|
+
|
525
|
+
def test_assert_respond_to
|
526
|
+
@tc.assert_respond_to "blah", :empty?
|
527
|
+
end
|
528
|
+
|
529
|
+
def test_assert_respond_to_triggered
|
530
|
+
util_assert_triggered 'Expected "blah" (String) to respond to #rawr!.' do
|
531
|
+
@tc.assert_respond_to "blah", :rawr!
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
def test_assert_same
|
536
|
+
@assertion_count = 3
|
537
|
+
|
538
|
+
o = "blah"
|
539
|
+
@tc.assert_same 1, 1
|
540
|
+
@tc.assert_same :blah, :blah
|
541
|
+
@tc.assert_same o, o
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_assert_same_triggered
|
545
|
+
@assertion_count = 2
|
546
|
+
|
547
|
+
util_assert_triggered 'Expected 2 (0xXXX) to be the same as 1 (0xXXX).' do
|
548
|
+
@tc.assert_same 1, 2
|
549
|
+
end
|
550
|
+
|
551
|
+
s1 = "blah"
|
552
|
+
s2 = "blah"
|
553
|
+
|
554
|
+
util_assert_triggered 'Expected "blah" (0xXXX) to be the same as "blah" (0xXXX).' do
|
555
|
+
@tc.assert_same s1, s2
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
def test_assert_send
|
560
|
+
@tc.assert_send [1, :<, 2]
|
561
|
+
end
|
562
|
+
|
563
|
+
def test_assert_send_bad
|
564
|
+
util_assert_triggered "Expected 1.>(*[2]) to return true." do
|
565
|
+
@tc.assert_send [1, :>, 2]
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
def test_assert_throws
|
570
|
+
@tc.assert_throws(:blah) do
|
571
|
+
throw :blah
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
def test_assert_throws_different
|
576
|
+
util_assert_triggered 'Expected :blah to have been thrown, not :not_blah.' do
|
577
|
+
@tc.assert_throws(:blah) do
|
578
|
+
throw :not_blah
|
579
|
+
end
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
def test_assert_throws_unthrown
|
584
|
+
util_assert_triggered 'Expected :blah to have been thrown.' do
|
585
|
+
@tc.assert_throws(:blah) do
|
586
|
+
# do nothing
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
def test_capture_io
|
592
|
+
@assertion_count = 0
|
593
|
+
|
594
|
+
out, err = capture_io do
|
595
|
+
puts 'hi'
|
596
|
+
warn 'bye!'
|
597
|
+
end
|
598
|
+
|
599
|
+
assert_equal "hi\n", out
|
600
|
+
assert_equal "bye!\n", err
|
601
|
+
end
|
602
|
+
|
603
|
+
def test_flunk
|
604
|
+
util_assert_triggered 'Epic Fail!' do
|
605
|
+
@tc.flunk
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
def test_flunk_message
|
610
|
+
util_assert_triggered @zomg do
|
611
|
+
@tc.flunk @zomg
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
def test_message
|
616
|
+
@assertion_count = 0
|
617
|
+
|
618
|
+
assert_equal "blah2.", @tc.message { "blah2" }.call
|
619
|
+
assert_equal "blah2.", @tc.message("") { "blah2" }.call
|
620
|
+
assert_equal "blah1.\nblah2.", @tc.message("blah1") { "blah2" }.call
|
621
|
+
end
|
622
|
+
|
623
|
+
def test_pass
|
624
|
+
@tc.pass
|
625
|
+
end
|
626
|
+
|
627
|
+
def test_test_methods_sorted
|
628
|
+
@assertion_count = 0
|
629
|
+
|
630
|
+
sample_test_case = Class.new(MiniTest::Unit::TestCase)
|
631
|
+
|
632
|
+
class << sample_test_case
|
633
|
+
def test_order; :sorted end
|
634
|
+
end
|
635
|
+
|
636
|
+
sample_test_case.instance_eval do
|
637
|
+
define_method :test_test3 do assert "does not matter" end
|
638
|
+
define_method :test_test2 do assert "does not matter" end
|
639
|
+
define_method :test_test1 do assert "does not matter" end
|
640
|
+
end
|
641
|
+
|
642
|
+
expected = %w(test_test1 test_test2 test_test3)
|
643
|
+
assert_equal expected, sample_test_case.test_methods
|
644
|
+
end
|
645
|
+
|
646
|
+
def test_test_methods_random
|
647
|
+
@assertion_count = 0
|
648
|
+
|
649
|
+
sample_test_case = Class.new(MiniTest::Unit::TestCase)
|
650
|
+
|
651
|
+
class << sample_test_case
|
652
|
+
def test_order; :random end
|
653
|
+
end
|
654
|
+
|
655
|
+
sample_test_case.instance_eval do
|
656
|
+
define_method :test_test1 do assert "does not matter" end
|
657
|
+
define_method :test_test2 do assert "does not matter" end
|
658
|
+
define_method :test_test3 do assert "does not matter" end
|
659
|
+
end
|
660
|
+
|
661
|
+
srand 42
|
662
|
+
expected = %w(test_test1 test_test2 test_test3)
|
663
|
+
max = expected.size
|
664
|
+
expected = expected.sort_by { rand(max) }
|
665
|
+
|
666
|
+
srand 42
|
667
|
+
result = sample_test_case.test_methods
|
668
|
+
|
669
|
+
assert_equal expected, result
|
670
|
+
end
|
671
|
+
|
672
|
+
def test_refute
|
673
|
+
@assertion_count = 2
|
674
|
+
|
675
|
+
@tc.assert_equal false, @tc.refute(false), "returns false on success"
|
676
|
+
end
|
677
|
+
|
678
|
+
def test_refute_empty
|
679
|
+
@assertion_count = 2
|
680
|
+
|
681
|
+
@tc.refute_empty [1]
|
682
|
+
end
|
683
|
+
|
684
|
+
def test_refute_empty_triggered
|
685
|
+
@assertion_count = 2
|
686
|
+
|
687
|
+
util_assert_triggered "Expected [] to not be empty." do
|
688
|
+
@tc.refute_empty []
|
689
|
+
end
|
690
|
+
end
|
691
|
+
|
692
|
+
def test_refute_equal
|
693
|
+
@tc.refute_equal "blah", "yay"
|
694
|
+
end
|
695
|
+
|
696
|
+
def test_refute_equal_triggered
|
697
|
+
util_assert_triggered 'Expected "blah" to not be equal to "blah".' do
|
698
|
+
@tc.refute_equal "blah", "blah"
|
699
|
+
end
|
700
|
+
end
|
701
|
+
|
702
|
+
def test_refute_in_delta
|
703
|
+
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.000001
|
704
|
+
end
|
705
|
+
|
706
|
+
def test_refute_in_delta_triggered
|
707
|
+
util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to not be < 0.1.' do
|
708
|
+
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
def test_refute_in_epsilon
|
713
|
+
@tc.refute_in_epsilon 10000, 9990
|
714
|
+
end
|
715
|
+
|
716
|
+
def test_refute_in_epsilon_triggered
|
717
|
+
util_assert_triggered 'Expected 10000 - 9991 (9) to not be < 10.0.' do
|
718
|
+
@tc.refute_in_epsilon 10000, 9991
|
719
|
+
fail
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
def test_refute_includes
|
724
|
+
@assertion_count = 2
|
725
|
+
|
726
|
+
@tc.refute_includes [true], false
|
727
|
+
end
|
728
|
+
|
729
|
+
def test_refute_includes_triggered
|
730
|
+
@assertion_count = 4
|
731
|
+
|
732
|
+
e = @tc.assert_raises MiniTest::Assertion do
|
733
|
+
@tc.refute_includes [true], true
|
734
|
+
end
|
735
|
+
|
736
|
+
expected = "Expected [true] to not include true."
|
737
|
+
assert_equal expected, e.message
|
738
|
+
end
|
739
|
+
|
740
|
+
def test_refute_instance_of
|
741
|
+
@tc.refute_instance_of Array, "blah"
|
742
|
+
end
|
743
|
+
|
744
|
+
def test_refute_instance_of_triggered
|
745
|
+
util_assert_triggered 'Expected "blah" to not be an instance of String.' do
|
746
|
+
@tc.refute_instance_of String, "blah"
|
747
|
+
end
|
748
|
+
end
|
749
|
+
|
750
|
+
def test_refute_kind_of
|
751
|
+
@tc.refute_kind_of Array, "blah"
|
752
|
+
end
|
753
|
+
|
754
|
+
def test_refute_kind_of_triggered
|
755
|
+
util_assert_triggered 'Expected "blah" to not be a kind of String.' do
|
756
|
+
@tc.refute_kind_of String, "blah"
|
757
|
+
end
|
758
|
+
end
|
759
|
+
|
760
|
+
def test_refute_match
|
761
|
+
@tc.refute_match "blah blah blah", /\d+/
|
762
|
+
end
|
763
|
+
|
764
|
+
def test_refute_match_triggered
|
765
|
+
util_assert_triggered 'Expected /\w+/ to not match "blah blah blah".' do
|
766
|
+
@tc.refute_match "blah blah blah", /\w+/
|
767
|
+
end
|
768
|
+
end
|
769
|
+
|
770
|
+
def test_refute_nil
|
771
|
+
@tc.refute_nil 42
|
772
|
+
end
|
773
|
+
|
774
|
+
def test_refute_nil_triggered
|
775
|
+
util_assert_triggered 'Expected nil to not be nil.' do
|
776
|
+
@tc.refute_nil nil
|
777
|
+
end
|
778
|
+
end
|
779
|
+
|
780
|
+
def test_refute_operator
|
781
|
+
@tc.refute_operator 2, :<, 1
|
782
|
+
end
|
783
|
+
|
784
|
+
def test_refute_operator_triggered
|
785
|
+
util_assert_triggered "Expected 2 to not be > 1." do
|
786
|
+
@tc.refute_operator 2, :>, 1
|
787
|
+
end
|
788
|
+
end
|
789
|
+
|
790
|
+
def test_refute_respond_to
|
791
|
+
@tc.refute_respond_to "blah", :rawr!
|
792
|
+
end
|
793
|
+
|
794
|
+
def test_refute_respond_to_triggered
|
795
|
+
util_assert_triggered 'Expected "blah" to not respond to empty?.' do
|
796
|
+
@tc.refute_respond_to "blah", :empty?
|
797
|
+
end
|
798
|
+
end
|
799
|
+
|
800
|
+
def test_refute_same
|
801
|
+
@tc.refute_same 1, 2
|
802
|
+
end
|
803
|
+
|
804
|
+
# TODO: "with id <id>" crap from assertions.rb
|
805
|
+
def test_refute_same_triggered
|
806
|
+
util_assert_triggered 'Expected 1 to not be the same as 1.' do
|
807
|
+
@tc.refute_same 1, 1
|
808
|
+
end
|
809
|
+
end
|
810
|
+
|
811
|
+
def test_skip
|
812
|
+
@assertion_count = 0
|
813
|
+
|
814
|
+
util_assert_triggered "haha!", MiniTest::Skip do
|
815
|
+
@tc.skip "haha!"
|
816
|
+
end
|
817
|
+
end
|
818
|
+
|
819
|
+
def util_assert_triggered expected, klass = MiniTest::Assertion
|
820
|
+
e = assert_raises(klass) do
|
821
|
+
yield
|
822
|
+
end
|
823
|
+
|
824
|
+
msg = e.message.sub(/(---Backtrace---).*/m, '\1')
|
825
|
+
msg.gsub!(/\(0x[0-9a-f]+\)/, '(0xXXX)')
|
826
|
+
|
827
|
+
assert_equal expected, msg
|
828
|
+
end
|
829
|
+
|
830
|
+
if ENV['DEPRECATED'] then
|
831
|
+
require 'test/unit/assertions'
|
832
|
+
def test_assert_nothing_raised
|
833
|
+
@tc.assert_nothing_raised do
|
834
|
+
# do nothing
|
835
|
+
end
|
836
|
+
end
|
837
|
+
|
838
|
+
def test_assert_nothing_raised_triggered
|
839
|
+
expected = 'Exception raised:
|
840
|
+
Class: <RuntimeError>
|
841
|
+
Message: <"oops!">
|
842
|
+
---Backtrace---'
|
843
|
+
|
844
|
+
util_assert_triggered expected do
|
845
|
+
@tc.assert_nothing_raised do
|
846
|
+
raise "oops!"
|
847
|
+
end
|
848
|
+
end
|
849
|
+
end
|
850
|
+
end
|
851
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest_tu_shim
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-10-09 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: minitest
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.0
|
34
|
+
version:
|
35
|
+
description: minitest_te_shim bridges the gap between the small and fast minitest and ruby's huge and slow test/unit.
|
36
|
+
email:
|
37
|
+
- ryand-ruby@zenspider.com
|
38
|
+
executables:
|
39
|
+
- use_minitest
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- History.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- README.txt
|
46
|
+
files:
|
47
|
+
- .autotest
|
48
|
+
- History.txt
|
49
|
+
- Manifest.txt
|
50
|
+
- README.txt
|
51
|
+
- Rakefile
|
52
|
+
- bin/use_minitest
|
53
|
+
- lib/test/unit.rb
|
54
|
+
- lib/test/unit/assertions.rb
|
55
|
+
- lib/test/unit/deprecate.rb
|
56
|
+
- lib/test/unit/error.rb
|
57
|
+
- lib/test/unit/testcase.rb
|
58
|
+
- test/test_mini_test.rb
|
59
|
+
has_rdoc: true
|
60
|
+
homepage: http://rubyforge.org/projects/bfts
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options:
|
63
|
+
- --main
|
64
|
+
- README.txt
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project: bfts
|
82
|
+
rubygems_version: 1.3.0
|
83
|
+
signing_key:
|
84
|
+
specification_version: 2
|
85
|
+
summary: minitest_te_shim bridges the gap between the small and fast minitest and ruby's huge and slow test/unit.
|
86
|
+
test_files:
|
87
|
+
- test/test_mini_test.rb
|