summaryrefslogtreecommitdiffstats
path: root/tests/regexp.test
diff options
context:
space:
mode:
authorericm <ericm>2000-04-10 21:08:26 (GMT)
committerericm <ericm>2000-04-10 21:08:26 (GMT)
commit1ca8b9ee3d089e20d6e8603c3b6ce33bac188d6d (patch)
tree969dd778b3f00ae92ec0793ad12d2fb87496794c /tests/regexp.test
parenta44349c8166358f92b65f61682ea4a484df881b4 (diff)
downloadtcl-1ca8b9ee3d089e20d6e8603c3b6ce33bac188d6d.zip
tcl-1ca8b9ee3d089e20d6e8603c3b6ce33bac188d6d.tar.gz
tcl-1ca8b9ee3d089e20d6e8603c3b6ce33bac188d6d.tar.bz2
* win/tclWinPipe.c (TclpCreateTempFile): Added conversion of
contents string from UTF to native encoding [Bug: 4030]. * tests/regexp.test: Added tests for infinite looping in [regexp -all]. * generic/tclCmdMZ.c: Fixed infinite loop bug with [regexp -all] [Bug: 4981].
Diffstat (limited to 'tests/regexp.test')
-rw-r--r--tests/regexp.test25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/regexp.test b/tests/regexp.test
index dfbfd38..e891b54 100644
--- a/tests/regexp.test
+++ b/tests/regexp.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: regexp.test,v 1.12 2000/04/10 17:19:03 ericm Exp $
+# RCS: @(#) $Id: regexp.test,v 1.13 2000/04/10 21:08:27 ericm Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -503,6 +503,29 @@ test regexp-18.6 {regexp -all -inline} {
test regexp-18.7 {regexp -all -inline} {
list [catch {regexp -all -inline b abc match} msg] $msg
} {1 {regexp match variables not allowed when using -inline}}
+test regexp-18.8 {regexp -all} {
+ # This should not cause an infinite loop
+ regexp -all -inline {a*} a
+} {a}
+test regexp-18.9 {regexp -all} {
+ # Yes, the expected result is {a {}}. Here's why:
+ # Start at index 0; a* matches the "a" there then stops.
+ # Go to index 1; a* matches the lambda (or {}) there then stops. Recall
+ # that a* matches zero or more "a"'s; thus it matches the string "b", as
+ # there are zero or more "a"'s there.
+ # Go to index 2; this is past the end of the string, so stop.
+ regexp -all -inline {a*} ab
+} {a {}}
+test regexp-18.10 {regexp -all} {
+ # Yes, the expected result is {a {} a}. Here's why:
+ # Start at index 0; a* matches the "a" there then stops.
+ # Go to index 1; a* matches the lambda (or {}) there then stops. Recall
+ # that a* matches zero or more "a"'s; thus it matches the string "b", as
+ # there are zero or more "a"'s there.
+ # Go to index 2; a* matches the "a" there then stops.
+ # Go to index 3; this is past the end of the string, so stop.
+ regexp -all -inline {a*} aba
+} {a {} a}
# cleanup
::tcltest::cleanupTests