summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_exception.rb11
-rw-r--r--test/ruby/test_fiber.rb2
2 files changed, 9 insertions, 4 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
diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb
index 4acfb139e0..7b5ce8190f 100644
--- a/test/ruby/test_fiber.rb
+++ b/test/ruby/test_fiber.rb
@@ -117,7 +117,7 @@ class TestFiber < Test::Unit::TestCase
end
def test_throw
- assert_raise(ArgumentError){
+ assert_raise(UncaughtThrowError){
Fiber.new do
throw :a
end.resume