diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-26 13:36:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-30 15:30:35 +0200 |
commit | e59c2bc979293d8cdea3f9733ecd59c080fce63c (patch) | |
tree | 337fefcc20ee6b6de53514caceefc9d45e5bd7d8 /tests/switch | |
parent | 333f468d264f0fa36a772b10b885fff6160ae4c7 (diff) |
Add support for `case` pattern alternatives
case <pattern>[ | <pattern>...]
Diffstat (limited to 'tests/switch')
-rw-r--r-- | tests/switch/testscript | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/switch/testscript b/tests/switch/testscript index 877f640..1399df0 100644 --- a/tests/switch/testscript +++ b/tests/switch/testscript @@ -9,7 +9,7 @@ : basics : $* <<EOI >>EOO -for i: 1 2 3 4 +for i: 1 2 3 4 5 { switch $i { @@ -19,9 +19,11 @@ for i: 1 2 3 4 { print 2 } - case 5 + case 0 case 3 - print 3,5 + print 0,3 + case 0|4 + print 0,4 default print d } @@ -29,14 +31,15 @@ for i: 1 2 3 4 EOI 1 2 -3,5 +0,3 +0,4 d EOO : basics-multiple : $* <<EOI >>EOO -for i: 1 2 3 4 +for i: 1 2 3 4 5 { switch $i, $i { @@ -49,8 +52,10 @@ for i: 1 2 3 4 print 2 } case 3, 3 - case 5, 5 - print 3,5 + case 0, 0 + print 3,0 + case 4|0, 0|4|0 + print 4,0 default print d } @@ -58,11 +63,11 @@ for i: 1 2 3 4 EOI 1 2 -3,5 +3,0 +4,0 d EOO - : empty : $* <<EOI |