summaryrefslogtreecommitdiffstats
path: root/tests/regexp.test
diff options
context:
space:
mode:
authormdejong <mdejong>2009-09-21 21:30:41 (GMT)
committermdejong <mdejong>2009-09-21 21:30:41 (GMT)
commit4fec8cdfead1265eae20b7fc9460b0d1bdc0e820 (patch)
tree31fce579cea8b53f114237555edfee40a771cd4a /tests/regexp.test
parent9badd9a07bfa6ee391090b99b1805824a894b856 (diff)
downloadtcl-4fec8cdfead1265eae20b7fc9460b0d1bdc0e820.zip
tcl-4fec8cdfead1265eae20b7fc9460b0d1bdc0e820.tar.gz
tcl-4fec8cdfead1265eae20b7fc9460b0d1bdc0e820.tar.bz2
* tests/regexp.test: Added check for error message from
unbalanced [] in regexp. Added additional simple test cases of basic regsub command.
Diffstat (limited to 'tests/regexp.test')
-rw-r--r--tests/regexp.test14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/regexp.test b/tests/regexp.test
index c4b4cab..2fe87b9 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.33 2008/08/21 23:19:51 hobbs Exp $
+# RCS: @(#) $Id: regexp.test,v 1.34 2009/09/21 21:30:41 mdejong Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -246,6 +246,9 @@ test regexp-6.8 {regexp errors} {
test regexp-6.9 {regexp errors, -start bad int check} {
list [catch {regexp -start bogus {^$} {}} msg] $msg
} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}}
+test regexp-6.10 {regexp errors} {
+ list [catch {regexp {a[} b} msg] $msg
+} {1 {couldn't compile regular expression pattern: brackets [] not balanced}}
test regexp-7.1 {basic regsub operation} {
list [regsub aa+ xaxaaaxaa 111&222 foo] $foo
@@ -305,6 +308,15 @@ test regexp-7.17 {regsub utf compliance} {
regsub a\u4e4eb xyza\u4e4ebijka\u4e4ebpqr 555 bar
list [string compare $foo $bar] [regexp 4 $bar]
} {0 0}
+test regexp-7.18 {basic regsub replacement} {
+ list [regsub a+ aaa {&} foo] $foo
+} {1 aaa}
+test regexp-7.19 {basic regsub backslash replacement} {
+ list [regsub a+ aaa {\0} foo] $foo
+} {1 aaa}
+test regexp-7.20 {basic regsub backslash replacement} {
+ list [regsub a+ aaa {\\\0} foo] $foo
+} {1 {\aaa}}
test regexp-8.1 {case conversion in regsub} {
list [regsub -nocase a(a+) xaAAaAAay & foo] $foo