From 13261f00fbe844261f364d51fc97318758d87c2b Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 8 Oct 2021 14:40:38 -0400 Subject: More simple bootstrap tests for kwargs --- bootstraptest/test_yjit.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 100cb99cee..a190d8ffb1 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -2074,6 +2074,35 @@ assert_equal '["sub", "sub"]', %q{ [foo(sub), foo(sub)] } +assert_equal '[1]', %q{ + def kwargs(value:) + value + end + + 5.times.map { kwargs(value: 1) }.uniq +} + +assert_equal '[[1, 2]]', %q{ + def kwargs(left:, right:) + [left, right] + end + + 5.times.flat_map do + [ + kwargs(left: 1, right: 2), + kwargs(right: 2, left: 1) + ] + end.uniq +} + +assert_equal '[[1, 2]]', %q{ + def kwargs(lead, kwarg:) + [lead, kwarg] + end + + 5.times.map { kwargs(1, kwarg: 2) }.uniq +} + # leading and keyword arguments are swapped into the right order assert_equal '[[1, 2, 3, 4, 5, 6]]', %q{ def kwargs(five, six, a:, b:, c:, d:) -- cgit v1.2.3