diff options
| author | Kazuki Tsujimoto <[email protected]> | 2012-06-03 17:48:02 +0900 |
|---|---|---|
| committer | Kazuki Tsujimoto <[email protected]> | 2012-06-03 17:48:02 +0900 |
| commit | 0629cf21baefd83765206036e4ceac45f7a55ca4 (patch) | |
| tree | a10497dddf3b6c10b2ab884a49ffc8dce00eeee6 /test | |
| parent | 597978c1690ca25b6a1ca99f8dd4c70190765bea (diff) | |
| download | mruby-0629cf21baefd83765206036e4ceac45f7a55ca4.tar.gz mruby-0629cf21baefd83765206036e4ceac45f7a55ca4.zip | |
A rescue clause with no parameter list rescues only StandardErrors
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/exception.rb | 36 |
1 files changed, 36 insertions, 0 deletions
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 |
