summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-09-13 10:58:13 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-09-13 11:04:27 +0900
commit6c76926d0504eff50b06f4aea1dc84526403f26e (patch)
tree9c40f79e2c2447b90d098096fb207a00c214ccb8 /test
parent31fc74f5a8ef979abaa5e43802e5714b6c959c38 (diff)
downloadmruby-6c76926d0504eff50b06f4aea1dc84526403f26e.tar.gz
mruby-6c76926d0504eff50b06f4aea1dc84526403f26e.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/t/hash.rb6
1 files changed, 6 insertions, 0 deletions
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