summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2019-09-01 16:39:34 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2019-09-01 16:39:34 +0900
commit94d6ec1d90bb28e5f303867b048e6322d8781cb1 (patch)
tree55a794614931f6dc7778f6b1b672ca3a01f0b34f /test
parentcda5745c1bacdb3be8384d21ee0dd70a9d95af5b (diff)
downloadruby-94d6ec1d90bb28e5f303867b048e6322d8781cb1.tar.gz
Make pattern matching support **nil syntax
Diffstat (limited to 'test')
-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