1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_basicinstructions.rb: updated for new class

behavior.  [ruby-dev:32192]

* encoding.c (enc_name): Encoding should not rely on ENCODING in
  the FL_USERS flags.

* encoding.c (rb_enc_from_encoding): do not call rb_enc_associate
  for encoding itself.

* encoding.c (enc_register_at): ditto.

* marshal.c (r_ivar): do not set real instance variable for
  encoding data associated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-11-09 04:37:36 +00:00
parent a46c532ab8
commit 4ab384be2d
4 changed files with 30 additions and 14 deletions

View file

@ -2,6 +2,22 @@ Fri Nov 9 12:56:36 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval_load.c (loaded_feature_path): check with type of given feature.
Fri Nov 9 12:43:02 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* test/ruby/test_basicinstructions.rb: updated for new class
behavior. [ruby-dev:32192]
* encoding.c (enc_name): Encoding should not rely on ENCODING in
the FL_USERS flags.
* encoding.c (rb_enc_from_encoding): do not call rb_enc_associate
for encoding itself.
* encoding.c (enc_register_at): ditto.
* marshal.c (r_ivar): do not set real instance variable for
encoding data associated.
Fri Nov 9 10:43:55 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (send_internal): use self in the previous frame to check for

View file

@ -52,9 +52,7 @@ rb_enc_from_encoding(rb_encoding *encoding)
if (!encoding) return 0;
if (enc_initialized_p(encoding))
return ENC_FROM_ENCODING(encoding);
enc = enc_new(encoding);
rb_enc_associate(enc, encoding);
return enc;
return enc_new(encoding);
}
static int
@ -146,8 +144,8 @@ enc_register_at(int index, const char *name, rb_encoding *encoding)
encoding = ent->enc;
encoding->name = name;
if (rb_cEncoding) {
VALUE enc = enc_new(encoding);
rb_enc_associate_index(enc, index);
/* initialize encoding data */
enc_new(encoding);
}
else {
encoding->auxiliary_data = ENC_UNINITIALIZED;
@ -523,13 +521,13 @@ static VALUE
enc_to_s(VALUE self)
{
return rb_sprintf("<%s:%s>", rb_obj_classname(self),
rb_enc_name(enc_get_encoding(self)));
rb_enc_name((rb_encoding*)DATA_PTR(self)));
}
static VALUE
enc_name(VALUE self)
{
return rb_str_new2(rb_enc_name(enc_get_encoding(self)));
return rb_str_new2(rb_enc_name((rb_encoding*)DATA_PTR(self)));
}
static VALUE

View file

@ -1086,7 +1086,9 @@ r_ivar(VALUE obj, struct load_arg *arg)
int idx = rb_enc_find_index(StringValueCStr(val));
if (idx > 0) rb_enc_associate_index(obj, idx);
}
rb_ivar_set(obj, id, val);
else {
rb_ivar_set(obj, id, val);
}
}
}
}

View file

@ -483,16 +483,16 @@ class TestBasicInstructions < Test::Unit::TestCase
assert_equal 'B/singleton', CVarB.cvB
assert_equal 'B/singleton', CVarB.cvB2
assert_equal 'B/singleton', CVarB.new.cvB
assert_equal 'CVarA@@cv', CVarA.cv
assert_equal 'CVarA@@cv', CVarA.cv2
assert_equal 'CVarA@@cv', CVarA.new.cv
assert_equal 'B/singleton', CVarA.cv
assert_equal 'B/singleton', CVarA.cv2
assert_equal 'B/singleton', CVarA.new.cv
CVarB.new.cvB = 'B/instance'
assert_equal 'B/instance', CVarB.cvB
assert_equal 'B/instance', CVarB.cvB2
assert_equal 'B/instance', CVarB.new.cvB
assert_equal 'CVarA@@cv', CVarA.cv
assert_equal 'CVarA@@cv', CVarA.cv2
assert_equal 'CVarA@@cv', CVarA.new.cv
assert_equal 'B/instance', CVarA.cv
assert_equal 'B/instance', CVarA.cv2
assert_equal 'B/instance', CVarA.new.cv
CVarA.cv = 'CVarA@@cv'
CVarB.cvB = 'CVarB@@cv'