aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_call.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-23 01:49:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-23 01:49:38 +0000
commit977d141edae10c14b1a4f424f000c800d68d4478 (patch)
tree6d2d4381b6bf8322445991dcb3a0c3bc97ef197b /test/ruby/test_call.rb
parent2701b18a00df1dbefbf57457a214b053f949c951 (diff)
downloadruby-977d141edae10c14b1a4f424f000c800d68d4478.tar.gz
safe navigation attrset
* compile.c (iseq_compile_each): support safe navigation of simple attribute assignment. [Feature #11537] * parse.y (mlhs_node, lhs, attrset_gen): ditto. keep mid non-attrset as the sign of safe navigation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_call.rb')
-rw-r--r--test/ruby/test_call.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index 14b6a6431b..33eec70f6a 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -42,5 +42,10 @@ class TestCall < Test::Unit::TestCase
assert_equal(6, o.x)
o.?x *= 7
assert_equal(42, o.x)
+
+ o = nil
+ assert_nil(o.?x)
+ assert_nothing_raised(NoMethodError) {o.?x = 6}
+ assert_nothing_raised(NoMethodError) {o.?x *= 7}
end
end