diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-29 03:06:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-29 03:06:03 +0000 |
commit | 98763860a72e507cc941f7af04a75b9b0219bc2c (patch) | |
tree | 18b76fb44a5d250243323bf38e112dc87ac0b2ba | |
parent | a65982f00fe9bc569d44eeaba85400dc000ffd28 (diff) | |
download | ruby-98763860a72e507cc941f7af04a75b9b0219bc2c.tar.gz |
test_keyword.rb: more assertions
* test/ruby/test_keyword.rb (test_block_required_keyword): more
assertions for positional and require keyword parameters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_keyword.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 13c728e8fd..1a7955dbcf 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -386,6 +386,15 @@ class TestKeywordArguments < Test::Unit::TestCase 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 |