diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-03 05:08:48 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-03 05:08:48 -0700 |
| commit | e66587439a0b2026ad56ba3548245a6d25d62b67 (patch) | |
| tree | e7c9cd353d543930f8426c95d02821d0c97f06f3 /test | |
| parent | dece49750d161d74992854fb18d64d50bdaad0a9 (diff) | |
| parent | 0629cf21baefd83765206036e4ceac45f7a55ca4 (diff) | |
| download | mruby-e66587439a0b2026ad56ba3548245a6d25d62b67.tar.gz mruby-e66587439a0b2026ad56ba3548245a6d25d62b67.zip | |
Merge pull request #237 from k-tsj/rescue-only-standarderrors
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 |
