diff --git a/test/mri/ruby/test_keyword.rb b/test/mri/ruby/test_keyword.rb index c6bb6de7747..5d0262a4498 100644 --- a/test/mri/ruby/test_keyword.rb +++ b/test/mri/ruby/test_keyword.rb @@ -182,12 +182,12 @@ def test_method_parameters [:keyrest, :kw], [:block, :b]], method(:f9).parameters) end - # def test_keyword_with_anonymous_keyword_splat - # def self.a(b: 1, **) [b, **] end - # kw = {b: 2, c: 3} - # assert_equal([2, {c: 3}], a(**kw)) - # assert_equal({b: 2, c: 3}, kw) - # end + def test_keyword_with_anonymous_keyword_splat + def self.a(b: 1, **) [b, **] end + kw = {b: 2, c: 3} + assert_equal([2, {c: 3}], a(**kw)) + assert_equal({b: 2, c: 3}, kw) + end def test_keyword_splat_nil # cfunc call @@ -2817,23 +2817,23 @@ class << o assert_raise(FrozenError) { c.send(:ruby2_keywords, :baz) } end - # def test_anon_splat_ruby2_keywords - # singleton_class.class_exec do - # def bar(*a, **kw) - # [a, kw] - # end - # - # ruby2_keywords def bar_anon(*) - # bar(*) - # end - # end - # - # a = [1, 2] - # kw = {a: 1} - # assert_equal([[1, 2], {a: 1}], bar_anon(*a, **kw)) - # assert_equal([1, 2], a) - # assert_equal({a: 1}, kw) - # end + def test_anon_splat_ruby2_keywords + singleton_class.class_exec do + def bar(*a, **kw) + [a, kw] + end + + ruby2_keywords def bar_anon(*) + bar(*) + end + end + + a = [1, 2] + kw = {a: 1} + assert_equal([[1, 2], {a: 1}], bar_anon(*a, **kw)) + assert_equal([1, 2], a) + assert_equal({a: 1}, kw) + end def test_top_ruby2_keywords assert_in_out_err([], <<-INPUT, ["[1, 2, 3]", "{:k=>1}"], [])