aboutsummaryrefslogtreecommitdiff
path: root/tests/switch
diff options
context:
space:
mode:
Diffstat (limited to 'tests/switch')
-rw-r--r--tests/switch/testscript42
1 files changed, 39 insertions, 3 deletions
diff --git a/tests/switch/testscript b/tests/switch/testscript
index 221ad47..346e968 100644
--- a/tests/switch/testscript
+++ b/tests/switch/testscript
@@ -125,13 +125,12 @@ nn
aa
EOO
-#\
: extractor
:
$* <<EOI >>EOO
for i: 123 abc
{
- switch $i: regex.extract
+ switch $i: regex.match return_subs
{
case '([0-9]+)'
print n
@@ -143,7 +142,44 @@ EOI
n
d
EOO
-#\
+
+: matcher-path
+:
+$* <<EOI >>EOO
+for i: 123 abc 1a3
+{
+ switch $i: path.match
+ {
+ case '[0-9][0-9][0-9]'
+ print n
+ case '[a-z][a-z][a-z]'
+ print a
+ case '*'
+ print d
+ }
+}
+EOI
+n
+a
+d
+EOO
+
+: matcher-case
+:
+$* <<EOI >>EOO
+for i: abc ABC aBC
+{
+ switch $i: string.icasecmp
+ {
+ case 'AbC'
+ print a
+ }
+}
+EOI
+a
+a
+a
+EOO
: attributes
: