From 45cd011d73ed1fac195d828c0565e2cac57f65fc Mon Sep 17 00:00:00 2001 From: yui-knk Date: Thu, 31 Aug 2023 21:35:55 +0900 Subject: [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. --- test/ruby/test_syntax.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby') 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}')) -- cgit v1.2.3