From 0629cf21baefd83765206036e4ceac45f7a55ca4 Mon Sep 17 00:00:00 2001 From: Kazuki Tsujimoto Date: Sun, 3 Jun 2012 17:48:02 +0900 Subject: A rescue clause with no parameter list rescues only StandardErrors --- test/t/exception.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test') diff --git a/test/t/exception.rb b/test/t/exception.rb index 6b46314d0..d68ed8bd7 100644 --- a/test/t/exception.rb +++ b/test/t/exception.rb @@ -193,3 +193,39 @@ assert('Exception 10') do 7+7 end == 12 end + +assert('Exception 11') do + a = :ok + begin + begin + raise Exception + rescue + a = :ng + end + rescue Exception + end + a == :ok +end + +assert('Exception 12') do + a = :ok + begin + raise Exception rescue a = :ng + rescue Exception + end + a == :ok +end + +assert('Exception 13') do + a = :ng + begin + raise StandardError + rescue TypeError, ArgumentError + a = :ng + rescue + a = :ok + else + a = :ng + end + a == :ok +end -- cgit v1.2.3