summaryrefslogtreecommitdiff
path: root/test/ruby/test_hash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_hash.rb')
-rw-r--r--test/ruby/test_hash.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index f79879c20a..5aee1b5d5c 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -2178,4 +2178,21 @@ class TestHash < Test::Unit::TestCase
end;
end
end
+
+ def test_value_omission
+ x = 1
+ y = 2
+ assert_equal({x: 1, y: 2}, {x:, y:})
+ assert_equal({one: 1, two: 2}, {one:, two:})
+ end
+
+ private
+
+ def one
+ 1
+ end
+
+ def two
+ 2
+ end
end