summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-23 08:15:57 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-23 08:15:57 +0000
commit524e628fd33511e37d8c9de0bb43e9ea2e68376c (patch)
treef382c2e28bd089ef49b07e179c2a3e40c0b58f35 /test
parent66163b7749fa4eb9e3e085dcfaac9df4715bc1f2 (diff)
merge revision(s) 58638,58640: [Backport #11873]
test_syntax.rb: test_brace_after_local_variable * test/ruby/test_syntax.rb (test_brace_after_local_variable): another test using braces. [Bug #11873] parse.y: do after cmdarg in paren * parse.y (parser_yylex): set state to ENDARG after a string literal, so that `do` after a literal should be `do_block` and bound to the outer method, as well as a numeric/symbol literal. [ruby-core:72482] [Bug #11873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index e4f73b97cf..7742dd239a 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -898,6 +898,10 @@ eom
assert_valid_syntax %q{a b(c d), 1 do end}, bug11873
assert_valid_syntax %q{a b{c(d)}, 1 do end}, bug11873
assert_valid_syntax %q{a b(c(d)), 1 do end}, bug11873
+ assert_valid_syntax %q{a b{c d}, "x" do end}, bug11873
+ assert_valid_syntax %q{a b(c d), "x" do end}, bug11873
+ assert_valid_syntax %q{a b{c(d)}, "x" do end}, bug11873
+ assert_valid_syntax %q{a b(c(d)), "x" do end}, bug11873
end
def test_block_after_cmdarg_in_paren
@@ -939,6 +943,15 @@ eom
assert_equal(:ok, result)
end
+ def test_brace_after_local_variable
+ obj = Object.new
+ def obj.m; yield; end
+ result = assert_nothing_raised(SyntaxError) do
+ obj.instance_eval("m = 1; m {:ok}")
+ end
+ assert_equal(:ok, result)
+ end
+
def test_return_toplevel
feature4840 = '[ruby-core:36785] [Feature #4840]'
code = "#{<<~"begin;"}\n#{<<~"end;"}"