diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-09 17:20:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-09 17:20:00 +0000 |
commit | 99871095e6b94d4851daec10ccc601bd3b23316f (patch) | |
tree | 30dbeb230c0a9caa11dbf7bdb99a3f3a822b7ee3 /test | |
parent | 046c94380bda1aafe99f56a854f9d44478381b1d (diff) | |
download | ruby-99871095e6b94d4851daec10ccc601bd3b23316f.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.rb | 10 |
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;"}" |