summaryrefslogtreecommitdiff
path: root/test/testunit
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 19:47:55 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 19:47:55 +0000
commitd356ccc9870a00b25fc44ff5815650578a4bcb68 (patch)
treed1c884bec5e5685b0326664574e8191311000728 /test/testunit
parentb3c2e224d35a09dc95451d2010b00ef3a6547189 (diff)
* 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
Diffstat (limited to 'test/testunit')
-rw-r--r--test/testunit/test_assertions.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/testunit/test_assertions.rb b/test/testunit/test_assertions.rb
index 19b4963..d39c089 100644
--- a/test/testunit/test_assertions.rb
+++ b/test/testunit/test_assertions.rb
@@ -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