diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-27 14:22:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-27 14:22:33 +0000 |
commit | 3d2e45d3195ea8ad896e3a48d5cff29bfc032fff (patch) | |
tree | 9a5ba84aa549bb31d53289892733531dbbd7a57a /test | |
parent | 0e547e6392581acac939fdfba6b730e0480c5fd6 (diff) | |
download | ruby-3d2e45d3195ea8ad896e3a48d5cff29bfc032fff.tar.gz |
parse.y: fix up r56198
* parse.y (symbol, dsym, parser_set_number_literal): set state to
ENDARG, so that `do` after a literal should be `do_block` and
bound to the outer method. [ruby-core:72482] [Bug #11873]
* parse.y (parse_ident): revert r56198.
* parse.y (warn_balanced): the state of symbol and numeric
literals is now EXPR_ENDARG, do not exclude it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_syntax.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index b026c21a4c..7c754316ff 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -844,6 +844,10 @@ eom assert_valid_syntax %q{a b(c d), :e do end}, bug11873 assert_valid_syntax %q{a b{c(d)}, :e do end}, bug11873 assert_valid_syntax %q{a b(c(d)), :e 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)}, 1 do end}, bug11873 + assert_valid_syntax %q{a b(c(d)), 1 do end}, bug11873 end def test_block_after_cmdarg_in_paren @@ -867,6 +871,15 @@ eom end end + def test_do_after_local_variable + obj = Object.new + def obj.m; yield; end + result = assert_nothing_raised(SyntaxError) do + obj.instance_eval("m = 1; m do :ok end") + end + assert_equal(:ok, result) + end + private def not_label(x) @result = x; @not_label ||= nil end |