diff options
author | vincentdarley <vincentdarley> | 2003-06-17 20:42:36 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2003-06-17 20:42:36 (GMT) |
commit | a267f6ee293c2fba8b771503ae41210a47bf3232 (patch) | |
tree | 2eff1f6d9708a1ba542c66565ef1b010c91e79bb /tests | |
parent | eb3d0976d6642da1d58097dd0c63336427f68e3d (diff) | |
download | tcl-a267f6ee293c2fba8b771503ae41210a47bf3232.zip tcl-a267f6ee293c2fba8b771503ae41210a47bf3232.tar.gz tcl-a267f6ee293c2fba8b771503ae41210a47bf3232.tar.bz2 |
backport of regsub empty string fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/regexp.test | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/regexp.test b/tests/regexp.test index 2bb017e..af27771 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.22 2002/07/10 11:56:44 dgp Exp $ +# RCS: @(#) $Id: regexp.test,v 1.22.2.1 2003/06/17 20:42:37 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -572,6 +572,46 @@ test regexp-20.2 {regsub shared object shimmering with -about} { eval regexp -about abc } {0 {}} +test regexp-21.1 {regsub works with empty string} { + regsub -- ^ {} foo +} {foo} + +test regexp-21.2 {regsub works with empty string} { + regsub -- \$ {} foo +} {foo} + +test regexp-21.3 {regsub works with empty string offset} { + regsub -start 0 -- ^ {} foo +} {foo} + +test regexp-21.4 {regsub works with empty string offset} { + regsub -start 0 -- \$ {} foo +} {foo} + +test regexp-21.5 {regsub works with empty string offset} { + regsub -start 3 -- \$ {123} foo +} {123foo} + +test regexp-21.6 {regexp works with empty string} { + regexp -- ^ {} +} {1} + +test regexp-21.7 {regexp works with empty string} { + regexp -start 0 -- ^ {} +} {1} + +test regexp-21.8 {regexp works with empty string offset} { + regexp -start 3 -- ^ {123} +} {0} + +test regexp-21.9 {regexp works with empty string offset} { + regexp -start 3 -- \$ {123} +} {1} + +test regexp-21.10 {multiple matches handle newlines} { + regsub -all -lineanchor -- {^#[^\n]*\n} "#one\n#two\n#three\n" foo\n +} "foo\nfoo\nfoo\n" + # cleanup ::tcltest::cleanupTests return |