aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-05-04 20:43:46 +1000
committerSteve Bennett <steveb@workware.net.au>2020-05-04 21:57:37 +1000
commitac35b8a6ec417f75b5ec86ca64ea1614a8170a38 (patch)
tree2f5b8ff0a91946a84b1b8f6ec8da82f539d5cf31 /tests
parentae1a518e6edc96cb54f6d6401fd6a59656abe8a9 (diff)
downloadjimtcl-ac35b8a6ec417f75b5ec86ca64ea1614a8170a38.zip
jimtcl-ac35b8a6ec417f75b5ec86ca64ea1614a8170a38.tar.gz
jimtcl-ac35b8a6ec417f75b5ec86ca64ea1614a8170a38.tar.bz2
regexp: Improved error message
Detect and produce an error for missing closing bracket ] Consider a trailing backslash as an invalid escape Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/regexp.test9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/regexp.test b/tests/regexp.test
index e372fbd..c6133e7 100644
--- a/tests/regexp.test
+++ b/tests/regexp.test
@@ -714,14 +714,13 @@ test regexp-22.10 {Various char escapes} {
join $result |
} {12,11|8,9|27}
-test regexp-22.11 {backslash as last char} {
+test regexp-22.11 {backslash as last char} -body {
regexp -all -inline "\[a\\" "ba\\d\[ef"
-} "a\ \\\\"
+} -returnCodes error -result {couldn't compile regular expression pattern: invalid escape \ sequence}
-# Probably should be an error
-test regexp-22.12 {missing closing bracket} {
+test regexp-22.12 {missing closing bracket} -body {
regexp -all -inline {[abc} "abcdefghi"
-} {a b c}
+} -returnCodes error -result {couldn't compile regular expression pattern: brackets [] not balanced}
test regexp-22.13 {empty alternative} {
regexp -all -inline {a(a|b|)c} "aacbacbaa"