diff options
author | Steve Bennett <steveb@workware.net.au> | 2023-09-09 08:55:20 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2024-03-21 10:44:34 +1000 |
commit | de64d2d836fcbf13e71be29d73684374170da8aa (patch) | |
tree | f2e2522fcc1f914a8d087c1c550e854e981eb994 /tests | |
parent | e23aea23d3e5cf6ed84f62f0d68a827f1d2780b6 (diff) | |
download | jimtcl-de64d2d836fcbf13e71be29d73684374170da8aa.zip jimtcl-de64d2d836fcbf13e71be29d73684374170da8aa.tar.gz jimtcl-de64d2d836fcbf13e71be29d73684374170da8aa.tar.bz2 |
expr: add support for =* and =~expr-glob-regexp-op
glob match and regexp match operators
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/regexp2.test | 16 | ||||
-rw-r--r-- | tests/stringmatch.test | 12 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/regexp2.test b/tests/regexp2.test index 571c981..c3db17d 100644 --- a/tests/regexp2.test +++ b/tests/regexp2.test @@ -943,4 +943,20 @@ test regexp-25.3 {End of word} { regexp {\mcd\M} cdef } 0 +test regexp-26.1 {regexp operator =~} { + expr {"abc" =~ "^a"} +} 1 + +test regexp-26.2 {regexp operator =~} { + expr {"abc" =~ "^b"} +} 0 + +test regexp-26.2 {regexp operator =~} { + expr {"abc" =~ ".b."} +} 1 + +test regexp-26.3 {regexp operator =~ invalid regexp} -body { + expr {"abc" =~ {[}} +} -returnCodes error -result {couldn't compile regular expression pattern: brackets [] not balanced} + testreport diff --git a/tests/stringmatch.test b/tests/stringmatch.test index f0eab2a..c15acd1 100644 --- a/tests/stringmatch.test +++ b/tests/stringmatch.test @@ -230,4 +230,16 @@ test stringmatch-7.4 {null in pattern} { string match *b\[\0a\]r* foobar } 1 +test stringmatch-8.1 {string match operator =*} { + expr {"abc" =* "a*"} +} 1 + +test stringmatch-8.2 {string match operator =*} { + expr {"abc" =* "b*"} +} 0 + +test stringmatch-8.3 {string match operator =*} { + expr {"abc" =* {*[bB]c}} +} 1 + testreport |