aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-09-26 12:29:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-09-30 15:30:22 +0200
commit333f468d264f0fa36a772b10b885fff6160ae4c7 (patch)
tree212479a6b793a0911a7de7d647173f66c04a411d /tests
parent70f5ab11c55ff4a43b32aafe21e839d050301215 (diff)
Allow multiple `case` for single line/block
Diffstat (limited to 'tests')
-rw-r--r--tests/switch/testscript41
1 files changed, 33 insertions, 8 deletions
diff --git a/tests/switch/testscript b/tests/switch/testscript
index 86f1d7e..877f640 100644
--- a/tests/switch/testscript
+++ b/tests/switch/testscript
@@ -9,7 +9,7 @@
: basics
:
$* <<EOI >>EOO
-for i: 1 2 3
+for i: 1 2 3 4
{
switch $i
{
@@ -19,20 +19,24 @@ for i: 1 2 3
{
print 2
}
+ case 5
+ case 3
+ print 3,5
default
- print default
+ print d
}
}
EOI
1
2
-default
+3,5
+d
EOO
: basics-multiple
:
$* <<EOI >>EOO
-for i: 1 2 3
+for i: 1 2 3 4
{
switch $i, $i
{
@@ -44,14 +48,18 @@ for i: 1 2 3
{
print 2
}
+ case 3, 3
+ case 5, 5
+ print 3,5
default
- print default
+ print d
}
}
EOI
1
2
-default
+3,5
+d
EOO
@@ -69,10 +77,10 @@ $* <<EOI >>EOO
switch 1
{
default
- print default
+ print d
}
EOI
-default
+d
EOO
: nested
@@ -97,6 +105,23 @@ EOI
2
EOO
+: case-default
+:
+$* <<EOI >>EOO
+for i: 1 2
+{
+ switch $i
+ {
+ case 1
+ default
+ print 1,d
+ }
+}
+EOI
+1,d
+1,d
+EOO
+
: default-before-case
:
$* <<EOI 2>>EOE != 0