ruby-changes:44849
From: nobu <ko1@a...>
Date: Tue, 29 Nov 2016 12:06:09 +0900 (JST)
Subject: [ruby-changes:44849] nobu:r56922 (trunk): test_keyword.rb: more assertions
nobu 2016-11-29 12:06:03 +0900 (Tue, 29 Nov 2016) New Revision: 56922 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56922 Log: test_keyword.rb: more assertions * test/ruby/test_keyword.rb (test_block_required_keyword): more assertions for positional and require keyword parameters. Modified files: trunk/test/ruby/test_keyword.rb Index: test/ruby/test_keyword.rb =================================================================== --- test/ruby/test_keyword.rb (revision 56921) +++ test/ruby/test_keyword.rb (revision 56922) @@ -386,6 +386,15 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L386 assert_equal([[:keyreq, :a], [:keyrest, :bl]], b.parameters, feature7701) assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {b.call(c: bug8139)} assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {b.call} + + b = assert_nothing_raised(SyntaxError, feature7701) do + break eval("proc {|m, a:| [m, a]}", nil, 'xyzzy', __LINE__) + end + assert_raise_with_message(ArgumentError, /missing keyword/) {b.call} + assert_equal([:ok, 42], b.call(:ok, a: 42)) + e = assert_raise_with_message(ArgumentError, /unknown keyword/) {b.call(42, a:0, b:1)} + assert_equal('xyzzy', e.backtrace_locations[0].path) + assert_equal([[:opt, :m], [:keyreq, :a]], b.parameters) end def test_super_with_keyword -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/