diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-06-01 08:47:13 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-06-05 21:13:11 +1000 |
commit | 7dbb01f6ca673f3b46231215695c848ffbee3989 (patch) | |
tree | 01dde8330cd75ed62fb5b29132bd5d0009310a1a /tests | |
parent | d4cd7cabc6359bf5e1af8ce0219e621ae0ec3d86 (diff) | |
download | jimtcl-7dbb01f6ca673f3b46231215695c848ffbee3989.zip jimtcl-7dbb01f6ca673f3b46231215695c848ffbee3989.tar.gz jimtcl-7dbb01f6ca673f3b46231215695c848ffbee3989.tar.bz2 |
core: string match and other glob matching support embedded nulls
string match, switch -glob, info commands, etc. all now support
patterns and strings with embedded nulls.
Fixes #143
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/string.test | 11 | ||||
-rw-r--r-- | tests/stringmatch.test | 12 |
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/string.test b/tests/string.test index e9d5399..5a22229 100644 --- a/tests/string.test +++ b/tests/string.test @@ -696,6 +696,17 @@ test string-11.50 {string match, *special case} tcl { string match "\\" "\\" } 0 +test string-11.51 {string match, nulls in pattern} { + string match "abc\0def" "abc\0def" +} 1 + +test string-11.52 {string match, nulls in pattern} { + string match "abc*\0def" "abcghi\0def" +} 1 + +test string-11.53 {string match, nulls in pattern} { + string match "abc\[ghi\0]def" "abc\0def" +} 1 test string-12.1 {string range} { list [catch {string range} msg] diff --git a/tests/stringmatch.test b/tests/stringmatch.test index 7fe3fcc..f0eab2a 100644 --- a/tests/stringmatch.test +++ b/tests/stringmatch.test @@ -214,12 +214,20 @@ test stringmatch-6.6 {charset with ^} { string match {a[\]]c} {a]c} } 0 -test stringmatch=7.1 {short string with ?} { +test stringmatch-7.1 {short string with ?} { string match {ab?} ab } 0 -test stringmatch=7.1 {multiple * to end} { +test stringmatch-7.2 {multiple * to end} { string match {ab**} ab } 1 +test stringmatch-7.3 {null in string} { + string match *bar* foo\0bar +} 1 + +test stringmatch-7.4 {null in pattern} { + string match *b\[\0a\]r* foobar +} 1 + testreport |