From 26aed9c5779cadf6d8a2030e4cc25958efbda522 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 5 Aug 2017 06:58:44 +0000 Subject: splat keyword hash * compile.c (compile_array_keyword_arg): set keyword splat flag if explicitly splatted. [ruby-core:68124] [Bug #10856] * vm_args.c (setup_parameters_complex): try keyword hash splat if given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_keyword.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby/test_keyword.rb') diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 4c99a3212d..c7dd6c88e3 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -503,6 +503,17 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([1, 9], m1(1, o, &->(a, k: 0) {break [a, k]}), bug10016) end + def test_splat_hash + m = Object.new + def m.f() :ok; end + o = {a: 1} + assert_raise_with_message(ArgumentError, /unknown keyword: a/) { + m.f(**o) + } + o = {} + assert_equal(:ok, m.f(**o), '[ruby-core:68124] [Bug #10856]') + end + def test_gced_object_in_stack bug8964 = '[ruby-dev:47729] [Bug #8964]' assert_normal_exit %q{ -- cgit v1.2.3