diff --git a/core/hash/hash_spec.rb b/core/hash/hash_spec.rb index 3649d4d8de..2ccb483120 100644 --- a/core/hash/hash_spec.rb +++ b/core/hash/hash_spec.rb @@ -41,4 +41,13 @@ h.hash.should == {x: [h]}.hash # Like above, because h.eql?(x: [h]) end + + ruby_version_is "3.1" do + it "allows ommiting values" do + a = 1 + b = 2 + + eval('{a:, b:}.should == { a: 1, b: 2 }') + end + end end diff --git a/language/keyword_arguments_spec.rb b/language/keyword_arguments_spec.rb index 8771c5806c..c47b7b0ae9 100644 --- a/language/keyword_arguments_spec.rb +++ b/language/keyword_arguments_spec.rb @@ -321,6 +321,21 @@ def m(*args) m({a: 1}).should == [[{a: 1}], {}] end + ruby_version_is "3.1" do + describe "omitted values" do + it "accepts short notation 'key' for 'key: value' syntax" do + def m(a:, b:) + [a, b] + end + + a = 1 + b = 2 + + eval('m(a:, b:).should == [1, 2]') + end + end + end + ruby_version_is "3.2" do it "does not work with call(*ruby2_keyword_args) with missing ruby2_keywords in between" do class << self