diff --git a/ChangeLog b/ChangeLog index d178cf0b5e..fa386a4dd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Feb 16 21:34:33 2007 Koichi Sasada + + * object.c (rb_obj_ivar_set/get/defined): fix to check :@_v/C id. + + * test/testunit/test_testcase.rb: fix to use instance_variable_get() + to access @_result. + Fri Feb 16 20:59:10 2007 Koichi Sasada * intern.h: add a prototype of rb_sym_to_s(). diff --git a/object.c b/object.c index aa5e6b73fb..f0138d6c29 100644 --- a/object.c +++ b/object.c @@ -1673,13 +1673,13 @@ rb_obj_public_methods(int argc, VALUE *argv, VALUE obj) * fred.instance_variable_get(:@a) #=> "cat" * fred.instance_variable_get("@b") #=> 99 */ - +#include "debug.h" static VALUE rb_obj_ivar_get(VALUE obj, VALUE iv) { ID id = rb_to_id(iv); - if (!rb_is_instance_id(id)) { + if (!rb_is_instance_id(id) && !rb_is_instance2_id(id)) { rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id)); } return rb_ivar_get(obj, id); @@ -1710,7 +1710,7 @@ rb_obj_ivar_set(VALUE obj, VALUE iv, VALUE val) { ID id = rb_to_id(iv); - if (!rb_is_instance_id(id)) { + if (!rb_is_instance_id(id) && !rb_is_instance2_id(id)) { rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id)); } return rb_ivar_set(obj, id, val); @@ -1739,7 +1739,7 @@ rb_obj_ivar_defined(VALUE obj, VALUE iv) { ID id = rb_to_id(iv); - if (!rb_is_instance_id(id)) { + if (!rb_is_instance_id(id) && !rb_is_instance2_id(id)) { rb_name_error(id, "`%s' is not allowed as an instance variable name", rb_id2name(id)); } return rb_ivar_defined(obj, id); diff --git a/test/testunit/test_testcase.rb b/test/testunit/test_testcase.rb index 2934a92fef..4eaac2f3f2 100644 --- a/test/testunit/test_testcase.rb +++ b/test/testunit/test_testcase.rb @@ -265,7 +265,7 @@ module Test end def check(message, passed) - @_result.add_assertion + instance_variable_get(:@_result/TestCase).add_assertion if ! passed raise AssertionFailedError.new(message) end