summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-08-25 21:43:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-08-25 21:43:21 (GMT)
commit71968e0f29b83374e539b31314b21a43b7ab61b6 (patch)
treeaa48a8922ceeb5182dd0a21e669fd18fa93bb9ca /tests
parent963fffad6be76adc9f12bbe25fa6cb828e93aac0 (diff)
parent1ca69943d5e3146511079b413ad981d77c387bd0 (diff)
downloadtcl-71968e0f29b83374e539b31314b21a43b7ab61b6.zip
tcl-71968e0f29b83374e539b31314b21a43b7ab61b6.tar.gz
tcl-71968e0f29b83374e539b31314b21a43b7ab61b6.tar.bz2
merge trunk; update changesrc3core_8_6_2core_8_6_2_rc
Diffstat (limited to 'tests')
-rw-r--r--tests/string.test34
-rw-r--r--tests/stringComp.test38
2 files changed, 65 insertions, 7 deletions
diff --git a/tests/string.test b/tests/string.test
index a8a83d9..3611753 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -30,7 +30,7 @@ testConstraint memory [llength [info commands memory]]
test string-1.1 {error conditions} {
list [catch {string gorp a b} msg] $msg
-} {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}}
+} {1 {unknown or ambiguous subcommand "gorp": must be bytelength, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}}
test string-1.2 {error conditions} {
list [catch {string} msg] $msg
} {1 {wrong # args: should be "string subcommand ?arg ...?"}}
@@ -54,7 +54,7 @@ test string-2.6 {string compare} {
string compare abcde abdef
} -1
test string-2.7 {string compare, shortest method name} {
- string c abcde ABCDE
+ string co abcde ABCDE
} 1
test string-2.8 {string compare} {
string compare abcde abcde
@@ -81,7 +81,7 @@ test string-2.13 {string compare -nocase} {
string compare -nocase abcde abdef
} -1
test string-2.14 {string compare -nocase} {
- string c -nocase abcde ABCDE
+ string compare -nocase abcde ABCDE
} 0
test string-2.15 {string compare -nocase} {
string compare -nocase abcde abcde
@@ -1513,7 +1513,7 @@ test string-20.1 {string trimright errors} {
} {1 {wrong # args: should be "string trimright string ?chars?"}}
test string-20.2 {string trimright errors} {
list [catch {string trimg a} msg] $msg
-} {1 {unknown or ambiguous subcommand "trimg": 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}}
+} {1 {unknown or ambiguous subcommand "trimg": must be bytelength, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}}
test string-20.3 {string trimright} {
string trimright " XYZ "
} { XYZ}
@@ -1572,7 +1572,7 @@ test string-21.14 {string wordend, unicode} {
test string-22.1 {string wordstart} {
list [catch {string word a} msg] $msg
-} {1 {unknown or ambiguous subcommand "word": 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}}
+} {1 {unknown or ambiguous subcommand "word": must be bytelength, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}}
test string-22.2 {string wordstart} {
list [catch {string wordstart a} msg] $msg
} {1 {wrong # args: should be "string wordstart string index"}}
@@ -1969,6 +1969,30 @@ test string-28.13 {tcl::prefix longest} {
tcl::prefix longest {ax\x90 bep ax\x91} a
} ax
+test string-29.1 {string cat, no arg} {
+ string cat
+} ""
+test string-29.2 {string cat, single arg} {
+ set x FOO
+ string compare $x [string cat $x]
+} 0
+test string-29.3 {string cat, two args} {
+ set x FOO
+ string compare $x$x [string cat $x $x]
+} 0
+test string-29.4 {string cat, many args} {
+ set x FOO
+ set n 260
+ set xx [string repeat $x $n]
+ set vv [string repeat {$x} $n]
+ set vvs [string repeat {$x } $n]
+ set r1 [string compare $xx [subst $vv]]
+ set r2 [string compare $xx [eval "string cat $vvs"]]
+ list $r1 $r2
+} {0 0}
+
+
+
# cleanup
rename MemStress {}
catch {rename foo {}}
diff --git a/tests/stringComp.test b/tests/stringComp.test
index 165ef20..f9f6bda 100644
--- a/tests/stringComp.test
+++ b/tests/stringComp.test
@@ -46,7 +46,7 @@ if {[testConstraint memory]} {
test stringComp-1.1 {error conditions} {
proc foo {} {string gorp a b}
list [catch {foo} msg] $msg
-} {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}}
+} {1 {unknown or ambiguous subcommand "gorp": must be bytelength, cat, 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
@@ -210,7 +210,7 @@ foreach {tname tbody tresult tcode} {
# need a few extra tests short abbr cmd
test stringComp-3.1 {string compare, shortest method name} {
- proc foo {} {string c abcde ABCDE}
+ proc foo {} {string co abcde ABCDE}
foo
} 1
test stringComp-3.2 {string equal, shortest method name} {
@@ -735,6 +735,40 @@ test stringComp-14.2 {Bug 82e7f67325} memory {
## string word*
## not yet bc
+
+## string cat
+test stringComp-29.1 {string cat, no arg} {
+ proc foo {} {string cat}
+ foo
+} ""
+test stringComp-29.2 {string cat, single arg} {
+ proc foo {} {
+ set x FOO
+ string compare $x [string cat $x]
+ }
+ foo
+} 0
+test stringComp-29.3 {string cat, two args} {
+ proc foo {} {
+ set x FOO
+ string compare $x$x [string cat $x $x]
+ }
+ foo
+} 0
+test stringComp-29.4 {string cat, many args} {
+ proc foo {} {
+ set x FOO
+ set n 260
+ set xx [string repeat $x $n]
+ set vv [string repeat {$x} $n]
+ set vvs [string repeat {$x } $n]
+ set r1 [string compare $xx [subst $vv]]
+ set r2 [string compare $xx [eval "string cat $vvs"]]
+ list $r1 $r2
+ }
+ foo
+} {0 0}
+
# cleanup
catch {rename foo {}}