aboutsummaryrefslogtreecommitdiff
path: root/tests/switch/testscript
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-01 15:03:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-01 15:03:39 +0200
commit9966533902ad459bafffa692fd0eb0c5a9e00e03 (patch)
treeddf1f15af825385fcd6abc1ebc369c8b3132739d /tests/switch/testscript
parentb465f2a1068037f34f0954c34bbf3605690e9f41 (diff)
Add extractor, path.match, and string.icasecmp pattern matching tests
Diffstat (limited to 'tests/switch/testscript')
-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
: