summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-25 22:38:09 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-25 22:38:09 +0000
commit17358af75b80343f7861907b9288607e67a08f61 (patch)
tree42e57053dce062666184382e21ea763c0e1101ea /lib
parentfe7ce06150e75f524f2aaaf3198927a58873d9a1 (diff)
Imported minitest 1.3.0 r4429. Fixes issues reported by akira and nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/minitest/unit.rb23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb
index ad9e3c4305..460258cdf2 100644
--- a/lib/minitest/unit.rb
+++ b/lib/minitest/unit.rb
@@ -87,7 +87,7 @@ module MiniTest
def assert_in_delta exp, act, delta = 0.001, msg = nil
n = (exp - act).abs
msg = message(msg) { "Expected #{exp} - #{act} (#{n}) to be < #{delta}" }
- assert delta > n, msg
+ assert delta >= n, msg
end
def assert_in_epsilon a, b, epsilon = 0.001, msg = nil
@@ -139,7 +139,10 @@ module MiniTest
yield
should_raise = true
rescue Exception => e
- assert_includes(exp, e.class, exception_details(e, "<#{mu_pp(exp)}> exception expected, not"))
+ assert(exp.any? { |ex|
+ ex.instance_of?(Module) ? e.kind_of?(ex) : ex == e.class
+ }, exception_details(e, "#{mu_pp(exp)} exception expected, not"))
+
return e
end
@@ -188,12 +191,12 @@ module MiniTest
assert caught, message(msg) { default }
end
- def capture_io
- require 'stringio'
+ def capture_io
+ require 'stringio'
- orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
- captured_stdout, captured_stderr = StringIO.new, StringIO.new
- $stdout, $stderr = captured_stdout, captured_stderr
+ orig_stdout, orig_stderr = $stdout, $stderr
+ captured_stdout, captured_stderr = StringIO.new, StringIO.new
+ $stdout, $stderr = captured_stdout, captured_stderr
yield
@@ -303,14 +306,14 @@ module MiniTest
refute exp.equal?(act), msg
end
- def skip msg = nil
+ def skip msg = nil, bt = caller
msg ||= "Skipped, no message given"
- raise MiniTest::Skip, msg
+ raise MiniTest::Skip, msg, bt
end
end
class Unit
- VERSION = "1.3.0"
+ VERSION = "1.3.1"
attr_accessor :report, :failures, :errors, :skips
attr_accessor :test_count, :assertion_count