From 9966533902ad459bafffa692fd0eb0c5a9e00e03 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 1 Oct 2019 15:03:39 +0200 Subject: Add extractor, path.match, and string.icasecmp pattern matching tests --- tests/switch/testscript | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'tests') 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 : $* <>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 +: +$* <>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 +: +$* <>EOO +for i: abc ABC aBC +{ + switch $i: string.icasecmp + { + case 'AbC' + print a + } +} +EOI +a +a +a +EOO : attributes : -- cgit v1.1