Commit bf322657 authored by Christopher Aue's avatar Christopher Aue

Allowed to pass multiple exceptions to assert_raise

parent fe3227cd
......@@ -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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment