summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-11-14 00:56:43 (GMT)
committerhobbs <hobbs>2002-11-14 00:56:43 (GMT)
commitce023c000e543273cb1129138c9c923df5ed49d2 (patch)
tree42acb02405ac9cd1cb89f8aa292cb0741fdb18a3 /tests
parentfe149949576c0ce56f3649fe2f2072823ba5e701 (diff)
downloadtcl-ce023c000e543273cb1129138c9c923df5ed49d2.zip
tcl-ce023c000e543273cb1129138c9c923df5ed49d2.tar.gz
tcl-ce023c000e543273cb1129138c9c923df5ed49d2.tar.bz2
* generic/regexpComp.test: added tests 22.*
* generic/tclCompCmds.c (TclCompileRegexpCmd): add left and right anchoring (^ and $) recognition and check starting or ending .* to extend the number of REs that can be compiled to string match or string equal.
Diffstat (limited to 'tests')
-rw-r--r--tests/regexpComp.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/regexpComp.test b/tests/regexpComp.test
index 3ae78b2..6665e63 100644
--- a/tests/regexpComp.test
+++ b/tests/regexpComp.test
@@ -798,6 +798,26 @@ test regexp-21.11 {regexp command compiling tests} {
}
} {0 {}}
+set i 0
+foreach {str exp result} {
+ foo ^foo 1
+ foobar ^foobar$ 1
+ foobar bar$ 1
+ foobar ^$ 0
+ "" ^$ 1
+ anything $ 1
+ anything ^.*$ 1
+ anything ^.*a$ 0
+ anything ^.*a.*$ 1
+ anything ^.*.*$ 1
+ anything ^.*..*$ 1
+ anything ^.*b$ 0
+ anything ^a.*$ 1
+} {
+ test regexp-22.[incr i] {regexp command compiling tests} \
+ [subst {evalInProc {set a "$str"; regexp {$exp} \$a}}] $result
+}
+
# cleanup
::tcltest::cleanupTests
return