diff options
author | Kazuki Tsujimoto <kazuki@callcc.net> | 2021-08-19 17:03:17 +0900 |
---|---|---|
committer | Kazuki Tsujimoto <kazuki@callcc.net> | 2021-08-19 17:07:58 +0900 |
commit | ecb6d6a4ef058b5598a7633c3921eeab08ce11c6 (patch) | |
tree | 0df5b09fae002fff45b63ccf6ca3afc07a9a9bae /spec | |
parent | 00d66f7ec215406b5977fb490b06dae71a4fede6 (diff) | |
download | ruby-ecb6d6a4ef058b5598a7633c3921eeab08ce11c6.tar.gz |
Allow omission of parentheses in one line pattern matching [Feature #16182]
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/language/pattern_matching_spec.rb | 11 |
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 |