From 207577f0af72874d9d643f2c46b881a9159d42d7 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 15 Jul 2015 14:45:32 +0900 Subject: mrb_protect() to return the exception raised (with the state of true) --- mrbgems/mruby-error/test/exception.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mrbgems/mruby-error/test') 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 -- cgit v1.2.3