spec icon indicating copy to clipboard operation
spec copied to clipboard

Adds spec for Feature#17260 and Feature#17231

Open baweaver opened this issue 4 years ago • 2 comments

Refers to #823

Adds specs for one-line pattern matching syntax in Ruby 3.0+, including both Righthand Assignment (=>) and one-line match (in).

Notes:

I was confused on how to add specs for only Ruby 2.7 to get NoMatchingPatternError for 0 in 1 as the syntax I'd found will run in Ruby 3.0.

How exhaustive do we want these tests to be? On one hand they could be reasonably inferred from full pattern matches, and we simply want to check that the syntax works. On the other we should likely test edge-cases.

What are thoughts on this?

I can certainly see a case for a more comprehensive test on possible syntax errors and odd uses to ensure consistency, but want to run that by maintainers first.

baweaver avatar Oct 06 '21 04:10 baweaver

Ah, I've noticed that there's range support in the Ruby version blocks. Would that be the recommended way?

EDIT - Went ahead and added that in, going to assume so.

baweaver avatar Oct 06 '21 04:10 baweaver

@baweaver Hello, any chance you could finish this? If not, please also reply, and then I'll try to address it myself when I get some time.

eregon avatar Oct 09 '22 10:10 eregon