diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-01 15:03:39 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-01 15:03:39 +0200 |
commit | 9966533902ad459bafffa692fd0eb0c5a9e00e03 (patch) | |
tree | ddf1f15af825385fcd6abc1ebc369c8b3132739d | |
parent | b465f2a1068037f34f0954c34bbf3605690e9f41 (diff) |
Add extractor, path.match, and string.icasecmp pattern matching tests
-rw-r--r-- | tests/switch/testscript | 42 |
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 : |