diff options
author | Kevin Newton <kddnewton@gmail.com> | 2021-10-08 14:40:38 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:43 -0400 |
commit | 13261f00fbe844261f364d51fc97318758d87c2b (patch) | |
tree | bfc3711e52d27f144d9c634bdb79e19a6bd8ee04 /bootstraptest | |
parent | 32b5125c5eb40422ef8a92a9886986a9ee4dc299 (diff) |
More simple bootstrap tests for kwargs
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 29 |
1 files changed, 29 insertions, 0 deletions
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:) |