aboutsummaryrefslogtreecommitdiff
path: root/tests/switch
diff options
context:
space:
mode:
Diffstat (limited to 'tests/switch')
-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