Allowed to pass multiple exceptions to assert_raise
@@ -143,17 +143,19 @@ def assert_not_include(collection, obj, msg = nil)
assert_false(collection.include?(obj), msg, diff)
end
-def assert_raise(exc, msg = nil)
+def assert_raise(*exc)
return true unless $mrbtest_assert
$mrbtest_assert_idx += 1
+ msg = (exc.last.is_a? String) ? exc.pop : nil
+
begin
yield
msg ||= "Expected to raise #{exc} but nothing was raised."
diff = nil
$mrbtest_assert.push [$mrbtest_assert_idx, msg, diff]
false
- rescue exc
+ rescue *exc
true
rescue Exception => e
msg ||= "Expected to raise #{exc}, not"
