summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2021-08-19 17:03:17 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2021-08-19 17:07:58 +0900
commitecb6d6a4ef058b5598a7633c3921eeab08ce11c6 (patch)
tree0df5b09fae002fff45b63ccf6ca3afc07a9a9bae /spec
parent00d66f7ec215406b5977fb490b06dae71a4fede6 (diff)
Allow omission of parentheses in one line pattern matching [Feature #16182]
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/language/pattern_matching_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/language/pattern_matching_spec.rb b/spec/ruby/language/pattern_matching_spec.rb
index 4e9d42b257..e9fc4f557d 100644
--- a/spec/ruby/language/pattern_matching_spec.rb
+++ b/spec/ruby/language/pattern_matching_spec.rb
@@ -1135,5 +1135,16 @@ ruby_version_is "2.7" do
result.should == true
end
end
+
+ ruby_version_is "3.1" do
+ it "can omit parentheses in one line pattern matching" do
+ [1, 2] => a, b
+ a.should == 1
+ b.should == 2
+
+ {a: 1} => a:
+ a.should == 1
+ end
+ end
end
end