aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_pattern_matching.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_pattern_matching.rb')
-rw-r--r--test/ruby/test_pattern_matching.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb
index 988a9dfe39..1f209b0081 100644
--- a/test/ruby/test_pattern_matching.rb
+++ b/test/ruby/test_pattern_matching.rb
@@ -847,6 +847,44 @@ END
end
assert_block do
+ [{}, C.new({})].all? do |i|
+ case i
+ in **nil
+ true
+ end
+ end
+ end
+
+ assert_block do
+ [{a: 0}, C.new({a: 0})].all? do |i|
+ case i
+ in **nil
+ else
+ true
+ end
+ end
+ end
+
+ assert_block do
+ [{a: 0}, C.new({a: 0})].all? do |i|
+ case i
+ in a:, **nil
+ true
+ end
+ end
+ end
+
+ assert_block do
+ [{a: 0, b: 1}, C.new({a: 0, b: 1})].all? do |i|
+ case i
+ in a:, **nil
+ else
+ true
+ end
+ end
+ end
+
+ assert_block do
case C.new({a: 0})
in C(a: 0)
true