diff options
author | Yusuke Endoh <[email protected]> | 2019-09-05 19:07:05 +0900 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2019-09-05 17:47:12 -0700 |
commit | dd83f7bf98764b27385735f6f39dd090dc4854f9 (patch) | |
tree | c4b02be62307904bc39dd51e5aad8da3f9f1f6d4 | |
parent | 70f2780892330f8d1b612002c437fc2ca739fc7f (diff) |
define_method should not drop the empty keyword hash
Similar to 38e9c1bc35d5549575fbb263afff560e97db068e
-rw-r--r-- | test/ruby/test_keyword.rb | 8 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index dc450c08c2..229f0b3871 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -185,7 +185,7 @@ class TestKeywordArguments < Test::Unit::TestCase f = -> { true } assert_equal(true, f[**{}]) - assert_equal(true, f[**kw]) + assert_raise(ArgumentError) { f[**kw] } assert_raise(ArgumentError) { f[**h] } assert_raise(ArgumentError) { f[a: 1] } assert_raise(ArgumentError) { f[**h2] } @@ -193,7 +193,7 @@ class TestKeywordArguments < Test::Unit::TestCase f = ->(a) { a } assert_raise(ArgumentError) { f[**{}] } - assert_raise(ArgumentError) { f[**kw] } + assert_equal(kw, f[**kw]) assert_equal(h, f[**h]) assert_equal(h, f[a: 1]) assert_equal(h2, f[**h2]) @@ -685,7 +685,7 @@ class TestKeywordArguments < Test::Unit::TestCase define_method(:m) { } end assert_nil(c.m(**{})) - assert_nil(c.m(**kw)) + assert_raise(ArgumentError) { c.m(**kw) } assert_raise(ArgumentError) { c.m(**h) } assert_raise(ArgumentError) { c.m(a: 1) } assert_raise(ArgumentError) { c.m(**h2) } @@ -697,7 +697,7 @@ class TestKeywordArguments < Test::Unit::TestCase define_method(:m) {|arg| arg } end assert_raise(ArgumentError) { c.m(**{}) } - assert_raise(ArgumentError) { c.m(**kw) } + assert_equal(kw, c.m(**kw)) assert_equal(h, c.m(**h)) assert_equal(h, c.m(a: 1)) assert_equal(h2, c.m(**h2)) diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 227ec2e08f..92a9bc6c9a 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2927,7 +2927,7 @@ vm_callee_setup_block_arg(rb_execution_context_t *ec, struct rb_calling_info *ca rb_control_frame_t *cfp = ec->cfp; VALUE arg0; - CALLER_SETUP_ARG(cfp, calling, ci, 1); /* splat arg */ + CALLER_SETUP_ARG(cfp, calling, ci, 0); /* splat arg */ if (arg_setup_type == arg_setup_block && calling->argc == 1 && |