diff options
| author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-18 15:36:58 +0000 |
|---|---|---|
| committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-18 15:36:58 +0000 |
| commit | 4e71ea3a1ae284b6ba2d0ef210666c491f24e1c9 (patch) | |
| tree | 93097361d46b7265dd6cdfd17149532cf1d89d17 /test/ruby | |
| parent | a9006d3af053afd1d93caa5dfb609a4f9b3c41d5 (diff) | |
merge revision(s) r45405,r45408: [Backport #9669] [Backport #9740]
* 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]
* parse.y (parser_yylex): only a newline after label should be
significant. [ruby-core:61658] [Bug #9669]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_keyword.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 03b93dbf0d..f6b4048d61 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -325,6 +325,25 @@ 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)) + assert_nothing_raised(SyntaxError, bug9669) do + eval(<<-'end;', nil, __FILE__, __LINE__) + o = { + a: + 1 + } + end; + end + assert_equal({a: 1}, o, bug9669) end def test_block_required_keyword |
