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

ruby-changes:67967

From: Brandon <ko1@a...>
Date: Mon, 13 Sep 2021 13:55:45 +0900 (JST)
Subject: [ruby-changes:67967] 4676921730 (master): Adds mixed hash value and value omission tests

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

From 4676921730bd257c234396fd9134ae9876043756 Mon Sep 17 00:00:00 2001
From: Brandon Weaver <keystonelemur@g...>
Date: Sun, 12 Sep 2021 20:34:28 -0700
Subject: Adds mixed hash value and value omission tests

Introduces specification tests for mixed values and value omissions for
Hashes and keyword arguments, such as `{ a:, b:, c: 3 }`.
---
 test/ruby/test_keyword.rb | 1 +
 test/ruby/test_literal.rb | 1 +
 2 files changed, 2 insertions(+)

diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index a899934..9094259 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -4357,6 +4357,7 @@ class TestKeywordArgumentsSymProcRefinements < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L4357
     x = 1
     y = 2
     assert_equal({x: 1, y: 2}, f.call(x:, y:))
+    assert_equal({x: 1, y: 2, z: 3}, f.call(x:, y:, z: 3))
     assert_equal({one: 1, two: 2}, f.call(one:, two:))
   end
 
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index c8a65c9..ccfe1b1 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -510,6 +510,7 @@ class TestRubyLiteral < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_literal.rb#L510
     x = 1
     y = 2
     assert_equal({x: 1, y: 2}, {x:, y:})
+    assert_equal({x: 1, y: 2, z: 3}, {x:, y:, z: 3})
     assert_equal({one: 1, two: 2}, {one:, two:})
     assert_syntax_error('{"#{x}":}', /'\}'/)
   end
-- 
cgit v1.1


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

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