diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-25 13:45:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-30 15:30:08 +0200 |
commit | 70f5ab11c55ff4a43b32aafe21e839d050301215 (patch) | |
tree | 45db520a78c5b6b0b84027908a6ea4f416ea7cdf /tests/switch/testscript | |
parent | ea997c89f7ea59db0164c79ac0fda5b607754753 (diff) |
Pattern matching support (switch): multiple values implementation
Diffstat (limited to 'tests/switch/testscript')
-rw-r--r-- | tests/switch/testscript | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/switch/testscript b/tests/switch/testscript index d59b33d..86f1d7e 100644 --- a/tests/switch/testscript +++ b/tests/switch/testscript @@ -29,6 +29,32 @@ EOI default EOO +: basics-multiple +: +$* <<EOI >>EOO +for i: 1 2 3 +{ + switch $i, $i + { + case 1, 1 + print 1 + case 1, 2 + assert + case 2 + { + print 2 + } + default + print default + } +} +EOI +1 +2 +default +EOO + + : empty : $* <<EOI @@ -132,3 +158,14 @@ switch 1 EOI <stdin>:3:3: error: expected case or default instead of 'x' EOE + +: multiple-more-patterns +: +$* <<EOI 2>>EOE != 0 +switch 1 +{ + case 1, 1 +} +EOI +<stdin>:3:11: error: more patterns than switch expressions +EOE |