From 6c76926d0504eff50b06f4aea1dc84526403f26e Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 13 Sep 2021 10:58:13 +0900 Subject: parse.y: allow value omission in Hash literals introduced in Ruby3.1. `{x:, y:}` now is a syntax sugar of `{x: x, y: y}`. This fix also includes the update of #4815 fix. --- test/t/hash.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/t/hash.rb b/test/t/hash.rb index 9bc2668ae..1b4db056e 100644 --- a/test/t/hash.rb +++ b/test/t/hash.rb @@ -1006,3 +1006,9 @@ assert('#== receiver should be specified value') do %i[has_value? value?].each{|m| assert_nothing_raised{h.__send__(m, v1)}} end end + +assert('test value ommision') do + x = 1 + y = 2 + assert_equal({x:1, y:2}, {x:, y:}) +end -- cgit v1.2.3