diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-25 07:47:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-03-25 07:47:37 +0000 |
commit | d7442c32df355ccb3f793a594723acae2a571d0f (patch) | |
tree | 7006ae19d0d1e35e8ebab725e068b31c065d96ed /test/ruby/test_keyword.rb | |
parent | 0574b64694010540e0c61f9f1aa67a9de2c8cf59 (diff) |
parse.y: required kwarg without parentheses
* parse.y (lex_state_e, parser_params, f_arglist, parser_yylex):
separate EXPR_LABELARG from EXPR_BEG and let newline significant,
so that required keyword argument can place at the end of
argument list without parentheses. [ruby-core:61658] [Bug #9669]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_keyword.rb')
-rw-r--r-- | test/ruby/test_keyword.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 625146b0ba..75b8f58a98 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -325,6 +325,16 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([[:keyreq, :a], [:keyrest, :b]], o.method(:bar).parameters, feature7701) assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar(c: bug8139)} assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar} + + bug9669 = '[ruby-core:61658] [Bug #9669]' + assert_nothing_raised(SyntaxError, bug9669) do + eval(<<-'end;', nil, __FILE__, __LINE__) + def bug9669.foo a: + return a + end + end; + end + assert_equal(42, bug9669.foo(a: 42)) end def test_block_required_keyword |