From 40251ed0dfe99bb09c2fa542fce603ade25e3729 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 10 Jun 2024 19:05:58 -0400 Subject: Fix inconsistent evaluation of keyword splat (#10959) [Bug #20180] Backports #9624. --- test/ruby/test_syntax.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 2d4ce59b39..a7a25ef3c0 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -233,6 +233,7 @@ class TestSyntax < Test::Unit::TestCase def test_array_kwsplat_hash kw = {} h = {a: 1} + a = [] assert_equal([], [**{}]) assert_equal([], [**kw]) assert_equal([h], [**h]) @@ -247,6 +248,20 @@ class TestSyntax < Test::Unit::TestCase assert_equal([1, kw], [1, kw]) assert_equal([1, h], [1, h]) + assert_equal([], [*a, **{}]) + assert_equal([], [*a, **kw]) + assert_equal([h], [*a, **h]) + assert_equal([{}], [*a, {}]) + assert_equal([kw], [*a, kw]) + assert_equal([h], [*a, h]) + + assert_equal([1], [1, *a, **{}]) + assert_equal([1], [1, *a, **kw]) + assert_equal([1, h], [1, *a, **h]) + assert_equal([1, {}], [1, *a, {}]) + assert_equal([1, kw], [1, *a, kw]) + assert_equal([1, h], [1, *a, h]) + assert_equal([], [**kw, **kw]) assert_equal([], [**kw, **{}, **kw]) assert_equal([1], [1, **kw, **{}, **kw]) -- cgit v1.2.3