assertions.rb: assert_throw
* lib/test/unit/assertions.rb (assert_throw): make an alias of assert_throws. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
305dcadecc
commit
3c0cbea874
@ -191,12 +191,7 @@ module Test
|
|||||||
# assert_throw(tag, "#{tag} was not thrown!") do
|
# assert_throw(tag, "#{tag} was not thrown!") do
|
||||||
# throw tag
|
# throw tag
|
||||||
# end
|
# end
|
||||||
def assert_throw(tag, msg = nil)
|
alias assert_throw assert_throws
|
||||||
catch(tag) do
|
|
||||||
yield(tag)
|
|
||||||
assert(false, message(msg) {"Expected #{mu_pp(tag)} to have been thrown"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# :call-seq:
|
# :call-seq:
|
||||||
# assert_equal( expected, actual, failure_message = nil )
|
# assert_equal( expected, actual, failure_message = nil )
|
||||||
|
@ -29,8 +29,8 @@ class TestObject < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
obj = cls.new
|
obj = cls.new
|
||||||
assert_throws(:initialize_clone) {obj.clone}
|
assert_throw(:initialize_clone) {obj.clone}
|
||||||
assert_throws(:initialize_dup) {obj.dup}
|
assert_throw(:initialize_dup) {obj.dup}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_instance_of
|
def test_instance_of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user