summaryrefslogtreecommitdiffstats
path: root/tests/string.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-04-29 20:49:39 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-04-29 20:49:39 (GMT)
commit8b1602650fa95940adc93df6e9c477d12de32664 (patch)
tree55c506247b96b5a5df5bcc7f1aeb3f66cbc3cdb8 /tests/string.test
parent0ab970b22ad15d0f56a3d5a53461daedf8bfc5ef (diff)
downloadtcl-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/string.test')
-rw-r--r--tests/string.test38
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/string.test b/tests/string.test
index 45bb587..c7a9f51 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -12,7 +12,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: string.test,v 1.45 2005/04/22 16:26:04 dgp Exp $
+# RCS: @(#) $Id: string.test,v 1.46 2005/04/29 20:49:44 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -176,7 +176,7 @@ test string-4.1 {string first, too few args} {
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
test string-4.2 {string first, bad args} {
list [catch {string first a b c} msg] $msg
-} {1 {bad index "c": must be integer or end?-integer?}}
+} {1 {bad index "c": must be integer?[+-]integer? or end?[+-]integer?}}
test string-4.3 {string first, too many args} {
list [catch {string first a b 5 d} msg] $msg
} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
@@ -241,7 +241,7 @@ test string-5.6 {string index} {
} {0 {}}
test string-5.7 {string index} {
list [catch {string index a xyz} msg] $msg
-} {1 {bad index "xyz": must be integer or end?-integer?}}
+} {1 {bad index "xyz": must be integer?[+-]integer? or end?[+-]integer?}}
test string-5.8 {string index} {
string index abc end
} c
@@ -276,10 +276,10 @@ test string-5.16 {string index, bytearray object with string obj shimmering} {
} 0
test string-5.17 {string index, bad integer} {
list [catch {string index "abc" 08} msg] $msg
-} {1 {bad index "08": must be integer or end?-integer? (looks like invalid octal number)}}
+} {1 {bad index "08": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test string-5.18 {string index, bad integer} {
list [catch {string index "abc" end-00289} msg] $msg
-} {1 {bad index "end-00289": must be integer or end?-integer? (looks like invalid octal number)}}
+} {1 {bad index "end-00289": must be integer?[+-]integer? or end?[+-]integer? (looks like invalid octal number)}}
test string-5.19 {string index, bytearray object out of bounds} {
string index [binary format I* {0x50515253 0x52}] -1
} {}
@@ -667,7 +667,7 @@ test string-7.1 {string last, too few args} {
} {1 {wrong # args: should be "string last subString string ?startIndex?"}}
test string-7.2 {string last, bad args} {
list [catch {string last a b c} msg] $msg
-} {1 {bad index "c": must be integer or end?-integer?}}
+} {1 {bad index "c": must be integer?[+-]integer? or end?[+-]integer?}}
test string-7.3 {string last, too many args} {
list [catch {string last a b c d} msg] $msg
} {1 {wrong # args: should be "string last subString string ?startIndex?"}}
@@ -1022,7 +1022,7 @@ test string-12.5 {string range, last > length} {
string range abcdefghijklmnop 7 1000
} {hijklmnop}
test string-12.6 {string range} {
- string range abcdefghijklmnop 10 e
+ string range abcdefghijklmnop 10 end
} {klmnop}
test string-12.7 {string range, last < first} {
string range abcdefghijklmnop 10 9
@@ -1041,15 +1041,15 @@ test string-12.11 {string range} {
} {abcdefghijklmnop}
test string-12.12 {string range} {
list [catch {string range abc abc 1} msg] $msg
-} {1 {bad index "abc": must be integer or end?-integer?}}
+} {1 {bad index "abc": must be integer?[+-]integer? or end?[+-]integer?}}
test string-12.13 {string range} {
list [catch {string range abc 1 eof} msg] $msg
-} {1 {bad index "eof": must be integer or end?-integer?}}
+} {1 {bad index "eof": must be integer?[+-]integer? or end?[+-]integer?}}
test string-12.14 {string range} {
string range abcdefghijklmnop end-1 end
} {op}
test string-12.15 {string range} {
- string range abcdefghijklmnop e 1000
+ string range abcdefghijklmnop end 1000
} {p}
test string-12.16 {string range} {
string range abcdefghijklmnop end end-1
@@ -1132,7 +1132,7 @@ test string-14.6 {string replace} {
string replace abcdefghijklmnop 7 1000
} {abcdefg}
test string-14.7 {string replace} {
- string replace abcdefghijklmnop 10 e
+ string replace abcdefghijklmnop 10 end
} {abcdefghij}
test string-14.8 {string replace} {
string replace abcdefghijklmnop 10 9
@@ -1151,15 +1151,15 @@ test string-14.12 {string replace} {
} {}
test string-14.13 {string replace} {
list [catch {string replace abc abc 1} msg] $msg
-} {1 {bad index "abc": must be integer or end?-integer?}}
+} {1 {bad index "abc": must be integer?[+-]integer? or end?[+-]integer?}}
test string-14.14 {string replace} {
list [catch {string replace abc 1 eof} msg] $msg
-} {1 {bad index "eof": must be integer or end?-integer?}}
+} {1 {bad index "eof": must be integer?[+-]integer? or end?[+-]integer?}}
test string-14.15 {string replace} {
string replace abcdefghijklmnop end-10 end-2 NEW
} {abcdeNEWop}
test string-14.16 {string replace} {
- string replace abcdefghijklmnop 0 e foo
+ string replace abcdefghijklmnop 0 end foo
} {foo}
test string-14.17 {string replace} {
string replace abcdefghijklmnop end end-1
@@ -1170,7 +1170,7 @@ test string-15.1 {string tolower too few args} {
} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
test string-15.2 {string tolower bad args} {
list [catch {string tolower a b} msg] $msg
-} {1 {bad index "b": must be integer or end?-integer?}}
+} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}}
test string-15.3 {string tolower too many args} {
list [catch {string tolower ABC 1 end oops} msg] $msg
} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
@@ -1201,7 +1201,7 @@ test string-16.1 {string toupper} {
} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
test string-16.2 {string toupper} {
list [catch {string toupper a b} msg] $msg
-} {1 {bad index "b": must be integer or end?-integer?}}
+} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}}
test string-16.3 {string toupper} {
list [catch {string toupper a 1 end oops} msg] $msg
} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
@@ -1232,7 +1232,7 @@ test string-17.1 {string totitle} {
} {1 {wrong # args: should be "string totitle string ?first? ?last?"}}
test string-17.2 {string totitle} {
list [catch {string totitle a b} msg] $msg
-} {1 {bad index "b": must be integer or end?-integer?}}
+} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}}
test string-17.3 {string totitle} {
string totitle abCDEf
} {Abcdef}
@@ -1314,7 +1314,7 @@ test string-21.2 {string wordend} {
} {1 {wrong # args: should be "string wordend string index"}}
test string-21.3 {string wordend} {
list [catch {string wordend a gorp} msg] $msg
-} {1 {bad index "gorp": must be integer or end?-integer?}}
+} {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}}
test string-21.4 {string wordend} {
string wordend abc. -1
} 3
@@ -1360,7 +1360,7 @@ test string-22.3 {string wordstart} {
} {1 {wrong # args: should be "string wordstart string index"}}
test string-22.4 {string wordstart} {
list [catch {string wordstart a gorp} msg] $msg
-} {1 {bad index "gorp": must be integer or end?-integer?}}
+} {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}}
test string-22.5 {string wordstart} {
string wordstart "one two three_words" 400
} 8