diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-15 07:28:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-15 07:28:08 +0000 |
commit | 558b9191c0c76d9807f339dae289a62ad7ed4ae8 (patch) | |
tree | fbed87b0b070cf04dccb7789607c496d758ec96a /test/ruby/test_exception.rb | |
parent | abd5ba5af2b98d5cfdd947f855669f6e8cc61615 (diff) | |
download | ruby-558b9191c0c76d9807f339dae289a62ad7ed4ae8.tar.gz |
vm_eval.c: UncaughtThrowError
* vm_eval.c (rb_throw_obj): throw UncaughtThrowError instead of
ArgumentError. [Feature #10480]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r-- | test/ruby/test_exception.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 4659def1ea..99cacc21f9 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -147,7 +147,7 @@ class TestException < Test::Unit::TestCase end def test_catch_throw_noarg - assert_nothing_raised(ArgumentError) { + assert_nothing_raised(UncaughtThrowError) { result = catch {|obj| throw obj, :ok assert(false, "should not reach here") @@ -157,13 +157,18 @@ class TestException < Test::Unit::TestCase end def test_uncaught_throw - assert_raise_with_message(ArgumentError, /uncaught throw/) { + tag = nil + e = assert_raise_with_message(UncaughtThrowError, /uncaught throw/) { catch("foo") {|obj| - throw obj.dup, :ok + tag = obj.dup + throw tag, :ok assert(false, "should not reach here") } assert(false, "should not reach here") } + assert_not_nil(tag) + assert_same(tag, e.tag) + assert_equal(:ok, e.value) end def test_catch_throw_in_require |