[前][次][番号順一覧][スレッド一覧]

ruby-changes:69289

From: Kevin <ko1@a...>
Date: Thu, 21 Oct 2021 08:23:35 +0900 (JST)
Subject: [ruby-changes:69289] 13261f00fb (master): More simple bootstrap tests for kwargs

https://git.ruby-lang.org/ruby.git/commit/?id=13261f00fb

From 13261f00fbe844261f364d51fc97318758d87c2b Mon Sep 17 00:00:00 2001
From: Kevin Newton <kddnewton@g...>
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(+)

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{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_yjit.rb#L2074
   [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.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]