зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
b13c74bf82
Коммит
353cd25170
|
@ -1,3 +1,10 @@
|
|||
Fri Feb 16 21:34:33 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* 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 <ko1@atdot.net>
|
||||
|
||||
* intern.h: add a prototype of rb_sym_to_s().
|
||||
|
|
8
object.c
8
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);
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче