diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-11 06:11:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-11 06:11:17 +0000 |
commit | c6282e9bf95a29fd0761536e2f2ff37528d0a643 (patch) | |
tree | 077df45c2dfc3dd8b8dc167728a57739e4b7d7eb /test | |
parent | dc548ba04e468824edc3b4fe3210ae12c10f6100 (diff) | |
download | ruby-c6282e9bf95a29fd0761536e2f2ff37528d0a643.tar.gz |
parse.y: non-local/const attrset
* parse.y (rb_enc_symname_type): allow ID_ATTRSET for ID_INSTANCE,
ID_GLOBAL, ID_CLASS, ID_JUNK too. [Bug #8756]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_struct.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb index 677452879c..1bcc485410 100644 --- a/test/ruby/test_struct.rb +++ b/test/ruby/test_struct.rb @@ -131,7 +131,15 @@ class TestStruct < Test::Unit::TestCase klass = Struct.new(:@a) o = klass.new(1) + assert_equal(1, o.__send__(:@a)) assert_equal("#<struct :@a=1>", o.inspect) + o.__send__(:"@a=", 2) + assert_equal(2, o.__send__(:@a)) + assert_equal("#<struct :@a=2>", o.inspect) + o.__send__("@a=", 3) + assert_equal(3, o.__send__(:@a)) + assert_equal("#<struct :@a=3>", o.inspect) + methods = klass.instance_methods(false) assert_equal([:@a, :"@a="].inspect, methods.inspect, '[Bug #8756]') assert_include(methods, :@a) |