diff options
| author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-28 19:47:55 +0000 |
|---|---|---|
| committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-28 19:47:55 +0000 |
| commit | 0039430d54bebf41e2cd0e71f8c03a4560026110 (patch) | |
| tree | d1c884bec5e5685b0326664574e8191311000728 /test | |
| parent | 3e4eee53f679f0f2f878a9b58e8d7ba2630f3acd (diff) | |
| download | ruby-0039430d54bebf41e2cd0e71f8c03a4560026110.tar.gz ruby-0039430d54bebf41e2cd0e71f8c03a4560026110.tar.xz ruby-0039430d54bebf41e2cd0e71f8c03a4560026110.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@14777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/testunit/test_assertions.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/testunit/test_assertions.rb b/test/testunit/test_assertions.rb index 19b496394..d39c089b3 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 |
