1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/test/unit.rb (assert_nothing_thrown): implemented.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-10-18 04:41:17 +00:00
parent c2fab59341
commit 6fa352271f
2 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Sat Oct 18 13:40:27 2008 Tanaka Akira <akr@fsij.org>
* lib/test/unit.rb (assert_nothing_thrown): implemented.
Sat Oct 18 01:33:22 2008 WATANABE Hirofumi <eban@ruby-lang.org>
* common.mk: use added options for generic_erb.rb.

View file

@ -48,7 +48,7 @@ module Test
begin
require f
rescue LoadError
puts $!
puts "#{f}: #{$!}"
end
}
@ -79,7 +79,7 @@ module Test
rescue Exception => e
if ((args.empty? && !e.instance_of?(MiniTest::Assertion)) ||
args.any? {|a| a.instance_of?(Module) ? e.is_a?(a) : e.class == a })
msg = message(msg) { "Exception raised:\n<#{mu_pp(act)}>" }
msg = message(msg) { "Exception raised:\n<#{mu_pp(e)}>" }
assert(false, msg)
else
raise
@ -88,6 +88,17 @@ module Test
nil
end
def assert_nothing_thrown(msg=nil)
begin
yield
rescue ArgumentError => error
raise error if /^uncaught throw (.+)$/ !~ error.message
msg = message(msg) { "<#{$1.intern}> was thrown when nothing was expected" }
flunk(msg)
end
assert(true, "Expected nothing to be thrown")
end
def assert_equal(exp, act, msg = nil)
msg = message(msg) {
exp_str = mu_pp(exp)