summaryrefslogtreecommitdiffstats
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
commitfaa478cb02da6da955831df28f94e89168d9cde8 (patch)
tree42e57053dce062666184382e21ea763c0e1101ea /lib
parent274ebddacbd9694e9d062e3e2a06bcec17ceb4b4 (diff)
downloadruby-faa478cb02da6da955831df28f94e89168d9cde8.tar.gz
ruby-faa478cb02da6da955831df28f94e89168d9cde8.tar.xz
ruby-faa478cb02da6da955831df28f94e89168d9cde8.zip
Imported minitest 1.3.0 r4429. Fixes issues reported by akira and nobu
git-svn-id: http://svn.ruby-lang.org/repos/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 ad9e3c430..460258cdf 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