mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit/assertions.rb (Test::Unit::Assertions#assert_throws):
throw won't raise NameError nor ThreadError but ArgumentError on 1.9. (Test::Unit::Assertions#assert_not_throws): ditto. * test/testunit/test_assertions.rb: add assertions for throwing some objects other than Symbol. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b3c2e224d3
commit
d356ccc987
3 changed files with 36 additions and 11 deletions
|
|
@ -403,6 +403,22 @@ Message: <"Error">
|
|||
throw :thing
|
||||
}
|
||||
}
|
||||
check_nothing_fails {
|
||||
assert_throws(0, "message") {
|
||||
throw 0
|
||||
}
|
||||
}
|
||||
obj = Object.new
|
||||
check_nothing_fails {
|
||||
assert_throws(obj, "message") {
|
||||
throw obj
|
||||
}
|
||||
}
|
||||
check_fails("message.\n<\"string\"> expected to be thrown but\n<\"string\"> was thrown.") {
|
||||
assert_throws("string", "message") {
|
||||
throw "string"
|
||||
}
|
||||
}
|
||||
check_fails("message.\n<:thing> expected to be thrown but\n<:thing2> was thrown.") {
|
||||
assert_throws(:thing, "message") {
|
||||
throw :thing2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue