summaryrefslogtreecommitdiff
path: root/test/ruby/test_call.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-16 01:49:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-16 01:49:42 +0000
commitbfd34365b6b01898649cfd570306e062c170628b (patch)
treed9f8e9100417a3e586b6b5dc5b9531a90f523b06 /test/ruby/test_call.rb
parentda7c77152d8a0021866b671fcce1113dece1e440 (diff)
parse.y: fix block_call&.call
* parse.y (block_command, block_call): fix `&.` calls after block_call. [Feature #11537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_call.rb')
-rw-r--r--test/ruby/test_call.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index 2cef0e5c66..04966f40f7 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -65,4 +65,21 @@ class TestCall < Test::Unit::TestCase
o.x&.at(proc.call)
assert_equal(1, count)
end
+
+ def test_safe_call_block_command
+ assert_nil(("a".sub! "b" do end&.foo 1))
+ end
+
+ def test_safe_call_block_call
+ assert_nil(("a".sub! "b" do end&.foo))
+ end
+
+ def test_safe_call_block_call_brace
+ assert_nil(("a".sub! "b" do end&.foo {}))
+ assert_nil(("a".sub! "b" do end&.foo do end))
+ end
+
+ def test_safe_call_block_call_command
+ assert_nil(("a".sub! "b" do end&.foo 1 do end))
+ end
end