summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-09 12:33:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-09 12:33:38 +0000
commit9c2c2f77ba4b346e99f00862ac6340ff1a33a82c (patch)
tree9f076f1972b344b5e3e6594c3cbaf397ae81699e /test
parentd68a3d3bc11c06edbfca6e02839acc1f6cbe0685 (diff)
parse.y: insane syntax
* parse.y (primary): save/restore COND and CMDARG stacks at method definition, to distinguish do_block and do_cond properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 57ce169cd3..bf9f4998ac 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1181,6 +1181,11 @@ eom
assert_equal(line, e.backtrace_locations[0].lineno)
end
+ def test_methoddef_in_cond
+ assert_valid_syntax('while def foo; tap do end; end; break; end')
+ assert_valid_syntax('while def foo a = tap do end; end; break; end')
+ end
+
private
def not_label(x) @result = x; @not_label ||= nil end