1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

eval.c: Bug #1886 [ruby-core:24767]; ensure that rb_exc_raise and rb_exc_fatal require an exception object. Backport of r24403.

test/ruby/test_exception.rb: test for exception change. Backport of r24404.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
wyhaines 2010-06-21 20:32:00 +00:00
parent 987c782a42
commit 4df2827d58
3 changed files with 17 additions and 1 deletions

View file

@ -1,5 +1,11 @@
require 'test/unit'
class ZeroDivisionError
def self.new(message)
42
end
end
class TestException < Test::Unit::TestCase
def test_exception
begin
@ -21,6 +27,9 @@ class TestException < Test::Unit::TestCase
end
assert(true)
e = assert_raise(TypeError) { 1/0 }
assert_equal('exception class/object expected', e.message)
# exception in rescue clause
$string = "this must be handled no.3"
e = assert_raises(RuntimeError) do