summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-05 09:28:08 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-05 09:28:08 +0000
commitfb9df41221bfe285227537e04cb822b28188501e (patch)
treef55a0f8a40ed1a17ea6957e59754213d6fc291e1 /test
parentac96c3f6c2e500ff6cc8cbceb98363eddb50f890 (diff)
merge revision(s) 48102: [Backport #10413]
* class.c (unknown_keyword_error): delete expected keywords directly from raw table, so that the given block is not called. [ruby-core:65837] [Bug #10413] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@48284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_keyword.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 8a00128605..118e82720f 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -359,4 +359,19 @@ class TestKeywordArguments < Test::Unit::TestCase
assert_equal([{}, {}], a.new.foo({}))
assert_equal([{}, {:bar=>"x"}], a.new.foo({}, bar: "x"))
end
+
+ def test_unknown_keyword_with_block
+ bug10413 = '[ruby-core:65837] [Bug #10413]'
+ class << (o = Object.new)
+ def bar(k2: 'v2')
+ end
+
+ def foo
+ bar(k1: 1)
+ end
+ end
+ assert_raise_with_message(ArgumentError, /unknown keyword: k1/, bug10413) {
+ o.foo {raise "unreachable"}
+ }
+ end
end