mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Assoc pattern matching (#3703)
[Feature #17260] One-line pattern matching using tASSOC R-assignment is rejected instead.
This commit is contained in:
parent
cffdacb15a
commit
52c630da00
Notes:
git
2020-10-26 18:00:56 +09:00
Merged-By: nobu <nobu@ruby-lang.org>
8 changed files with 37 additions and 65 deletions
|
@ -9,11 +9,13 @@ ruby_version_is "2.7" do
|
|||
ScratchPad.record []
|
||||
end
|
||||
|
||||
it "can be standalone in operator that deconstructs value" do
|
||||
eval(<<-RUBY).should == [0, 1]
|
||||
[0, 1] in [a, b]
|
||||
[a, b]
|
||||
RUBY
|
||||
ruby_version_is "3.0" do
|
||||
it "can be standalone assoc operator that deconstructs value" do
|
||||
eval(<<-RUBY).should == [0, 1]
|
||||
[0, 1] => [a, b]
|
||||
[a, b]
|
||||
RUBY
|
||||
end
|
||||
end
|
||||
|
||||
it "extends case expression with case/in construction" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue