summaryrefslogtreecommitdiffstats
path: root/tests/string.test
diff options
context:
space:
mode:
authorstanton <stanton>1999-06-03 18:43:30 (GMT)
committerstanton <stanton>1999-06-03 18:43:30 (GMT)
commit1ee755b0c7f5e4fdcfcce9b291e9eef6aa37c18c (patch)
treec08c858dca740efb49396a89896647c6016c2393 /tests/string.test
parentafdabb4790d357c3b065250f1af0b9ce4860f8b1 (diff)
downloadtcl-1ee755b0c7f5e4fdcfcce9b291e9eef6aa37c18c.zip
tcl-1ee755b0c7f5e4fdcfcce9b291e9eef6aa37c18c.tar.gz
tcl-1ee755b0c7f5e4fdcfcce9b291e9eef6aa37c18c.tar.bz2
* generic/tclCmdMZ.c (Tcl_StringObjCmd):
* tests/string.test: Fixed bug where string equal/compare -nocase reported wrong result on null strings. [Bug: 2138]
Diffstat (limited to 'tests/string.test')
-rw-r--r--tests/string.test26
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/string.test b/tests/string.test
index d517db5..01ad4bf 100644
--- a/tests/string.test
+++ b/tests/string.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: string.test,v 1.10 1999/05/22 01:20:14 stanton Exp $
+# RCS: @(#) $Id: string.test,v 1.11 1999/06/03 18:43:30 stanton Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -83,7 +83,7 @@ test string-2.17 {string compare -nocase with length} {
} -1
test string-2.18 {string compare -nocase with length <= 0} {
string compare -nocase -length -1 abcde AbCdEf
-} 0
+} -1
test string-2.19 {string compare -nocase with excessive length} {
string compare -nocase -length 50 AbCdEf abcde
} 1
@@ -95,10 +95,28 @@ test string-2.20 {string compare -len unicode} {
test string-2.21 {string compare -nocase with special index} {
list [catch {string compare -nocase -length end-3 Abcde abxyz} msg] $msg
} {1 {expected integer but got "end-3"}}
-test string-2.22 {string equal with length, unequal strings} {
+test string-2.22 {string compare, null strings} {
+ string compare "" ""
+} 0
+test string-2.23 {string compare, null strings} {
+ string compare "" foo
+} -1
+test string-2.24 {string compare, null strings} {
+ string compare foo ""
+} 1
+test string-2.25 {string compare -nocase, null strings} {
+ string compare -nocase "" ""
+} 0
+test string-2.26 {string compare -nocase, null strings} {
+ string compare -nocase "" foo
+} -1
+test string-2.27 {string compare -nocase, null strings} {
+ string compare -nocase foo ""
+} 1
+test string-2.28 {string equal with length, unequal strings} {
string compare -length 2 abc abde
} 0
-test string-2.22 {string equal with length, unequal strings} {
+test string-2.29 {string equal with length, unequal strings} {
string compare -length 2 ab abde
} 0