diff options
author | dgp <dgp@users.sourceforge.net> | 2005-04-29 20:49:39 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-04-29 20:49:39 (GMT) |
commit | 8b1602650fa95940adc93df6e9c477d12de32664 (patch) | |
tree | 55c506247b96b5a5df5bcc7f1aeb3f66cbc3cdb8 /tests/regexp.test | |
parent | 0ab970b22ad15d0f56a3d5a53461daedf8bfc5ef (diff) | |
download | tcl-8b1602650fa95940adc93df6e9c477d12de32664.zip tcl-8b1602650fa95940adc93df6e9c477d12de32664.tar.gz tcl-8b1602650fa95940adc93df6e9c477d12de32664.tar.bz2 |
TIP#176 IMPLEMENTATION [Patch 1165695]
* generic/tclUtil.c: Extended TclGetIntForIndex to recognize
index formats including end+integer and integer+/-integer.
* generic/tclCmdMZ.c: Extended the -start switch of [regexp]
and [regsub] to accept all index formats known by TclGetIntForIndex.
* doc/lindex.n: Updated docs to note new index formats.
* doc/linsert.n:
* doc/lrange.n:
* doc/lreplace.n:
* doc/lsearch.n:
* doc/lset.n:
* doc/lsort.n:
* doc/regexp.n:
* doc/regsub.n:
* doc/string.n:
* tests/cmdIL.test: Updated tests.
* tests/compile.test:
* tests/lindex.test:
* tests/linsert.test:
* tests/lrange.test:
* tests/lreplace.test:
* tests/lsearch.test:
* tests/lset.test:
* tests/regexp.test:
* tests/regexpComp.test:
* tests/string.test:
* tests/stringComp.test:
* tests/util.test:
Diffstat (limited to 'tests/regexp.test')
-rw-r--r-- | tests/regexp.test | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/regexp.test b/tests/regexp.test index fe4221b..f190298 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.25 2003/10/14 18:23:31 vincentdarley Exp $ +# RCS: @(#) $Id: regexp.test,v 1.26 2005/04/29 20:49:44 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -220,7 +220,7 @@ test regexp-6.8 {regexp errors} { } {1 {couldn't set variable "f1(f2)"}} test regexp-6.9 {regexp errors, -start bad int check} { list [catch {regexp -start bogus {^$} {}} msg] $msg -} {1 {expected integer but got "bogus"}} +} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}} test regexp-7.1 {basic regsub operation} { list [regsub aa+ xaxaaaxaa 111&222 foo] $foo @@ -377,7 +377,7 @@ test regexp-11.7 {regsub errors} { } {1 {couldn't set variable "f1(f2)"}} test regexp-11.8 {regsub errors, -start bad int check} { list [catch {regsub -start bogus pattern string rep var} msg] $msg -} {1 {expected integer but got "bogus"}} +} {1 {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?}} test regexp-11.9 {regsub without final variable name returns value} { regsub b abaca X } {aXaca} @@ -467,6 +467,20 @@ test regexp-15.5 {regexp -start, over end of string} { test regexp-15.6 {regexp -start, loss of ^$ behavior} { list [regexp -start 2 {^$} {}] } {0} +test regexp-15.7 {regexp -start, double option} { + regexp -start 2 -start 0 a abc +} 1 +test regexp-15.8 {regexp -start, double option} { + regexp -start 0 -start 2 a abc +} 0 +test regexp-15.9 {regexp -start, end relative index} { + catch {unset x} + list [regexp -start end {\d} 1abc2de3 x] [info exists x] +} {0 0} +test regexp-15.10 {regexp -start, end relative index} { + catch {unset x} + list [regexp -start end-1 {\d} 1abc2de3 x] [info exists x] $x +} {1 1 3} test regexp-16.1 {regsub -start} { catch {unset x} @@ -485,6 +499,18 @@ test regexp-16.4 {regsub -start, \A behavior} { lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x } {5 /a/b/c/d/e 3 ab/c/d/e} +test regexp-16.5 {regsub -start, double option} { + list [regsub -start 2 -start 0 a abc c x] $x +} {1 cbc} +test regexp-16.6 {regsub -start, double option} { + list [regsub -start 0 -start 2 a abc c x] $x +} {0 abc} +test regexp-16.7 {regexp -start, end relative index} { + list [regsub -start end a aaa b x] $x +} {0 aaa} +test regexp-16.8 {regexp -start, end relative index} { + list [regsub -start end-1 a aaa b x] $x +} {1 aab} test regexp-17.1 {regexp -inline} { regexp -inline b ababa |