aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-09 17:20:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-09 17:20:00 +0000
commit0e10e9aa615e69a7e435cfdb549c7bad3c0c9a50 (patch)
tree30dbeb230c0a9caa11dbf7bdb99a3f3a822b7ee3 /test
parenta6b3ad36dec0c52b4cb9619da15fb55b9feb209c (diff)
downloadruby-0e10e9aa615e69a7e435cfdb549c7bad3c0c9a50.tar.gz
parse.y: brace after literal arg
* parse.y (symbol, dsym, parser_set_number_literal, parser_yylex): set state to END too not only ENDARG and after a literal, so that a left brace after it should be a primary block bound to the literal, which causes syntax error. [ruby-core:81037] [Bug #13547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 00ba5192a1..d1ac396eab 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -952,6 +952,16 @@ eom
assert_equal(:ok, result)
end
+ def test_brace_after_literal_argument
+ bug = '[ruby-core:81037] [Bug #13547]'
+ error = /unexpected '{'/
+ assert_syntax_error('m "x" {}', error)
+ assert_syntax_error('m 1 {}', error, bug)
+ assert_syntax_error('m 1.0 {}', error, bug)
+ assert_syntax_error('m :m {}', error, bug)
+ assert_syntax_error('m :"#{m}" {}', error, bug)
+ end
+
def test_return_toplevel
feature4840 = '[ruby-core:36785] [Feature #4840]'
code = "#{<<~"begin;"}\n#{<<~"end;"}"