summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2023-08-31 21:35:55 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2023-09-01 12:55:09 +0900
commit45cd011d73ed1fac195d828c0565e2cac57f65fc (patch)
treeaad4c8611bc63e94a09682a79d4b4355a7e69f04 /test/ruby
parentdf4c77608e76068deed58b2781674b0eb247c325 (diff)
[Bug #19281] Allow semicolon in parenthesis at the first argument of command call
Allow compstmt in the first argument of command call wrapped with parenthesis like following arguments with parenthesis.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8347
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index c65d7af4c2..cda84c6368 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1650,6 +1650,21 @@ eom
assert_valid_syntax('Foo::Bar() {}')
end
+ def test_command_newline_in_tlparen_args
+ assert_valid_syntax("p (1\n2\n),(3),(4)")
+ assert_valid_syntax("p (\n),(),()")
+ assert_valid_syntax("a.b (1\n2\n),(3),(4)")
+ assert_valid_syntax("a.b (\n),(),()")
+ end
+
+ def test_command_semicolon_in_tlparen_at_the_first_arg
+ bug19281 = '[ruby-core:111499] [Bug #19281]'
+ assert_valid_syntax('p (1;2),(3),(4)', bug19281)
+ assert_valid_syntax('p (;),(),()', bug19281)
+ assert_valid_syntax('a.b (1;2),(3),(4)', bug19281)
+ assert_valid_syntax('a.b (;),(),()', bug19281)
+ end
+
def test_numbered_parameter
assert_valid_syntax('proc {_1}')
assert_equal(3, eval('[1,2].then {_1+_2}'))