diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-21 04:47:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-21 04:47:35 +0000 |
commit | f4ac0d75d9ed9c8eec4196f4410d6e9dda464d0c (patch) | |
tree | adc4c4d50e22aee104f5868c31e09f184f824a54 /test | |
parent | c924e2db9612bf3ca7aeb169075fdd80fbf545ca (diff) |
parse.y: preserve cmdarg_stack
* parse.y (brace_body, do_body): preserve cmdarg_stack so that
`do` after cmdarg in a block should be `do_block` and bound to
the outer method. [ruby-core:72482] [Bug #11873]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_syntax.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 965ef3e577..fcec8c955c 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -840,6 +840,27 @@ eom assert_valid_syntax %q{a b(c(d)), :e do end}, bug11873 end + def test_block_after_cmdarg_in_paren + bug11873 = '[ruby-core:72482] [Bug #11873]' + def bug11873.p(*);end; + + assert_raise(LocalJumpError, bug11873) do + bug11873.instance_eval do + p p{p p;p(p)}, tap do + raise SyntaxError, "should not be passed to tap" + end + end + end + + assert_raise(LocalJumpError, bug11873) do + bug11873.instance_eval do + p p{p(p);p p}, tap do + raise SyntaxError, "should not be passed to tap" + end + end + end + end + private def not_label(x) @result = x; @not_label ||= nil end |