parse.y: lbracket

* parse.y (lbracket): support .? before aref.  [Feature #11537]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-11-02 11:07:13 +00:00
parent 840e6b6307
commit dbf73f6fc2
3 changed files with 33 additions and 8 deletions

View file

@ -46,9 +46,13 @@ class TestCall < Test::Unit::TestCase
assert_equal(5, o.y)
o.?z ||= 6
assert_equal(6, o.z)
assert_equal(42, o.?[:x])
assert_equal(42, o.?["x"])
o = nil
assert_nil(o.?x)
assert_nil(o.?[:x])
assert_nil(o.?["x"])
assert_nothing_raised(NoMethodError) {o.?x = 6}
assert_nothing_raised(NoMethodError) {o.?x *= 7}
end