summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-error/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-07-15 14:45:32 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-07-15 14:47:15 +0900
commit207577f0af72874d9d643f2c46b881a9159d42d7 (patch)
tree83de6a20178bc3fb35dfc203731d58aa5559d5a3 /mrbgems/mruby-error/test
parent1085167fefe010be8e2d39e2adb31134a5512b15 (diff)
downloadmruby-207577f0af72874d9d643f2c46b881a9159d42d7.tar.gz
mruby-207577f0af72874d9d643f2c46b881a9159d42d7.zip
mrb_protect() to return the exception raised (with the state of true)
Diffstat (limited to 'mrbgems/mruby-error/test')
-rw-r--r--mrbgems/mruby-error/test/exception.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/mrbgems/mruby-error/test/exception.rb b/mrbgems/mruby-error/test/exception.rb
index b5ea719a2..0bbc2a0e7 100644
--- a/mrbgems/mruby-error/test/exception.rb
+++ b/mrbgems/mruby-error/test/exception.rb
@@ -1,10 +1,12 @@
assert 'mrb_protect' do
+ # no failure in protect returns [result, false]
assert_equal ['test', false] do
ExceptionTest.mrb_protect { 'test' }
end
- assert_equal [nil, true] do
- ExceptionTest.mrb_protect { raise 'test' }
- end
+ # failure in protect returns [exception, true]
+ result = ExceptionTest.mrb_protect { raise 'test' }
+ assert_kind_of RuntimeError, result[0]
+ assert_true result[1]
end
assert 'mrb_ensure' do