summaryrefslogtreecommitdiffhomepage
path: root/test/t/syntax.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2014-04-19 18:46:07 +0900
committerNobuyoshi Nakada <[email protected]>2014-04-19 18:46:07 +0900
commitb16697982eff27ef45d8c82b5e086cefd8716597 (patch)
treec88ada396febdcb276c3b91e49dbe169fa29e681 /test/t/syntax.rb
parent426f80b191a0130e94a1daebf204ece0433e9d78 (diff)
downloadmruby-b16697982eff27ef45d8c82b5e086cefd8716597.tar.gz
mruby-b16697982eff27ef45d8c82b5e086cefd8716597.zip
Allow parenthesed do-block in cmdarg
Flush cmdarg flags inside left-paren in a command argument, to allow parenthesed `do-block` as an argument without arguments parentheses. `CMDARG_PUSH(0)` for tLPAREN_ARG is before `CMDARG_PUSH(1)` in `command_args` due to look-ahead.
Diffstat (limited to 'test/t/syntax.rb')
-rw-r--r--test/t/syntax.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index fac73aa7b..d761b1991 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -254,3 +254,14 @@ assert('External command execution.') do
end
true
end
+
+assert('parenthesed do-block in cmdarg') do
+ class ParenDoBlockCmdArg
+ def test(block)
+ block.call
+ end
+ end
+ x = ParenDoBlockCmdArg.new
+ result = x.test (proc do :ok; end)
+ assert_equal :ok, result
+end