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,6 +1,11 @@
Tue Jun 22 04:29:00 Kirk Haines <khaines@ruby-lang.org>
* 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.
Sat Jun 12 07:34:00 Kirk Haines <khaines@ruby-lang.org>
* configure.in: Backport #1710 [ruby-core:24104]; backport of r20573 to clean up handling of LIBPATHFLAG.
* configure.in: Backport #1710 [ruby-core:24104]; backport of r20573 to clean up handling of LIBPATHFLAG. r28291
Thu Jun 10 22:50:00 Kirk Haines <khaines@ruby-lang.org>

2
eval.c
View file

@ -4657,6 +4657,7 @@ void
rb_exc_raise(mesg)
VALUE mesg;
{
mesg = rb_make_exception(1, &mesg);
rb_longjmp(TAG_RAISE, mesg);
}
@ -4664,6 +4665,7 @@ void
rb_exc_fatal(mesg)
VALUE mesg;
{
mesg = rb_make_exception(1, &mesg);
rb_longjmp(TAG_FATAL, mesg);
}

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