summaryrefslogtreecommitdiffstats
path: root/tests/stringComp.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stringComp.test')
-rw-r--r--tests/stringComp.test27
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/stringComp.test b/tests/stringComp.test
index 3c13581..2ce2010 100644
--- a/tests/stringComp.test
+++ b/tests/stringComp.test
@@ -22,17 +22,16 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
# Some tests require the testobj command
-set ::tcltest::testConstraints(testobj) \
- [expr {[info commands testobj] != {}}]
+testConstraint testobj [expr {[info commands testobj] != {}}]
test stringComp-1.1 {error conditions} {
proc foo {} {string gorp a b}
list [catch {foo} msg] $msg
-} {1 {bad option "gorp": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
+} {1 {unknown or ambiguous subcommand "gorp": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}}
test stringComp-1.2 {error conditions} {
proc foo {} {string}
list [catch {foo} msg] $msg
-} {1 {wrong # args: should be "string option arg ?arg ...?"}}
+} {1 {wrong # args: should be "string subcommand ?argument ...?"}}
test stringComp-1.3 {error condition - undefined method during compile} {
# We don't want this to complain about 'never' because it may never
# be called, or string may get redefined. This must compile OK.
@@ -221,15 +220,15 @@ test stringComp-3.8 {string equal with length, unequal strings} {
test stringComp-4.1 {string first, too few args} {
proc foo {} {string first a}
list [catch {foo} msg] $msg
-} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
+} {1 {wrong # args: should be "string first needleString haystackString ?startIndex?"}}
test stringComp-4.2 {string first, bad args} {
proc foo {} {string first a b c}
list [catch {foo} msg] $msg
-} {1 {bad index "c": must be integer or end?-integer?}}
+} {1 {bad index "c": must be integer?[+-]integer? or end?[+-]integer?}}
test stringComp-4.3 {string first, too many args} {
proc foo {} {string first a b 5 d}
list [catch {foo} msg] $msg
-} {1 {wrong # args: should be "string first subString string ?startIndex?"}}
+} {1 {wrong # args: should be "string first needleString haystackString ?startIndex?"}}
test stringComp-4.4 {string first} {
proc foo {} {string first bq abcdefgbcefgbqrs}
foo
@@ -302,7 +301,7 @@ test stringComp-5.6 {string index} {
test stringComp-5.7 {string index} {
proc foo {} {string index a xyz}
list [catch {foo} msg] $msg
-} {1 {bad index "xyz": must be integer or end?-integer?}}
+} {1 {bad index "xyz": must be integer?[+-]integer? or end?[+-]integer?}}
test stringComp-5.8 {string index} {
proc foo {} {string index abc end}
foo
@@ -348,14 +347,14 @@ test stringComp-5.16 {string index, bytearray object with string obj shimmering}
}
foo
} 0
-test stringComp-5.17 {string index, bad integer} {
- proc foo {} {string index "abc" 08}
+test stringComp-5.17 {string index, bad integer} -body {
+ proc foo {} {string index "abc" 0o8}
list [catch {foo} msg] $msg
-} {1 {bad index "08": must be integer or end?-integer? (looks like invalid octal number)}}
-test stringComp-5.18 {string index, bad integer} {
- proc foo {} {string index "abc" end-00289}
+} -match glob -result {1 {*invalid octal number*}}
+test stringComp-5.18 {string index, bad integer} -body {
+ proc foo {} {string index "abc" end-0o0289}
list [catch {foo} msg] $msg
-} {1 {bad index "end-00289": must be integer or end?-integer? (looks like invalid octal number)}}
+} -match glob -result {1 {*invalid octal number*}}
test stringComp-5.19 {string index, bytearray object out of bounds} {
proc foo {} {string index [binary format I* {0x50515253 0x52}] -1}
foo