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

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
This commit is contained in:
nobu 2013-08-11 06:11:17 +00:00
parent dc548ba04e
commit c6282e9bf9
3 changed files with 29 additions and 13 deletions

View file

@ -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)