From 353cd251706d07ae4ffd66994a72acae06e98057 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 16 Feb 2007 12:36:49 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ object.c | 8 ++++---- test/testunit/test_testcase.rb | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) 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