* error.c (exc_equal): == method should not raise Exception.
[ruby-dev:37519] * sample/test.rb: fix test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f0da2e1657
commit
7160543aeb
@ -1,3 +1,10 @@
|
|||||||
|
Wed Dec 24 20:59:12 2008 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* error.c (exc_equal): == method should not raise Exception.
|
||||||
|
[ruby-dev:37519]
|
||||||
|
|
||||||
|
* sample/test.rb: fix test.
|
||||||
|
|
||||||
Wed Dec 24 20:33:45 2008 Koichi Sasada <ko1@atdot.net>
|
Wed Dec 24 20:33:45 2008 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* vm_insnhelper.c (vm_call_method): use class of method defined
|
* vm_insnhelper.c (vm_call_method): use class of method defined
|
||||||
|
15
error.c
15
error.c
@ -559,14 +559,25 @@ exc_equal(VALUE exc, VALUE obj)
|
|||||||
|
|
||||||
if (exc == obj) return Qtrue;
|
if (exc == obj) return Qtrue;
|
||||||
CONST_ID(id_mesg, "mesg");
|
CONST_ID(id_mesg, "mesg");
|
||||||
|
|
||||||
if (rb_obj_class(exc) != rb_obj_class(obj)) {
|
if (rb_obj_class(exc) != rb_obj_class(obj)) {
|
||||||
mesg = rb_funcall(obj, rb_intern("message"), 0, 0);
|
ID id_message, id_backtrace;
|
||||||
backtrace = rb_funcall(obj, rb_intern("backtrace"), 0, 0);
|
CONST_ID(id_message, "message");
|
||||||
|
CONST_ID(id_backtrace, "backtrace");
|
||||||
|
|
||||||
|
if (rb_respond_to(obj, id_message) && rb_respond_to(obj, id_backtrace)) {
|
||||||
|
mesg = rb_funcall(obj, id_message, 0, 0);
|
||||||
|
backtrace = rb_funcall(obj, id_backtrace, 0, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Qfalse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mesg = rb_attr_get(obj, id_mesg);
|
mesg = rb_attr_get(obj, id_mesg);
|
||||||
backtrace = exc_backtrace(obj);
|
backtrace = exc_backtrace(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rb_equal(rb_attr_get(exc, id_mesg), mesg))
|
if (!rb_equal(rb_attr_get(exc, id_mesg), mesg))
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
if (!rb_equal(exc_backtrace(exc), backtrace))
|
if (!rb_equal(exc_backtrace(exc), backtrace))
|
||||||
|
@ -661,9 +661,11 @@ begin
|
|||||||
end
|
end
|
||||||
test_ok(false)
|
test_ok(false)
|
||||||
rescue => e
|
rescue => e
|
||||||
test_ok(true) if $! == e
|
test_ok($! == e)
|
||||||
|
test_ok(e.message == $string)
|
||||||
|
test_ok(e != $string)
|
||||||
end
|
end
|
||||||
|
|
||||||
# exception in ensure clause
|
# exception in ensure clause
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user