From ac35b8a6ec417f75b5ec86ca64ea1614a8170a38 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Mon, 4 May 2020 20:43:46 +1000 Subject: 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 --- tests/regexp.test | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests') 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" -- cgit v1.1