diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-06-10 19:05:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-10 16:05:58 -0700 |
| commit | 40251ed0dfe99bb09c2fa542fce603ade25e3729 (patch) | |
| tree | 9b3bb804720dcddf10e501b66a8fb2a9f8d57dc1 /test/ruby/test_syntax.rb | |
| parent | d0327a7224d8d778a75c7554b287369895dc17be (diff) | |
Fix inconsistent evaluation of keyword splat (#10959)
[Bug #20180]
Backports #9624.
Diffstat (limited to 'test/ruby/test_syntax.rb')
| -rw-r--r-- | test/ruby/test_syntax.rb | 15 |
1 files changed, 15 insertions, 0 deletions
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]) |
