summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdejong <mdejong>2010-02-12 03:21:32 (GMT)
committermdejong <mdejong>2010-02-12 03:21:32 (GMT)
commitbbe0b1645349bb22662c4a8858a4fce1e5e07132 (patch)
tree2b588e2697c4889438249793e1ca4dd53d6b1cf8
parent9f5bce3cf43a2bddf371367d361c3fd289131e4a (diff)
downloadtcl-bbe0b1645349bb22662c4a8858a4fce1e5e07132.zip
tcl-bbe0b1645349bb22662c4a8858a4fce1e5e07132.tar.gz
tcl-bbe0b1645349bb22662c4a8858a4fce1e5e07132.tar.bz2
add tests for explicit backslash zero as argument to list command
-rw-r--r--ChangeLog5
-rw-r--r--tests/list.test22
2 files changed, 26 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 78710d9..a0e4f09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-11 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/list.test: Add tests for explicit \0 in
+ a string argument to the list command.
+
2010-02-11 Donal K. Fellows <dkf@users.sf.net>
* generic/tclIOCmd.c (Tcl_OpenObjCmd): [Bug 2949740]: Make sure that
diff --git a/tests/list.test b/tests/list.test
index 01dc060..0dd2d73 100644
--- a/tests/list.test
+++ b/tests/list.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: list.test,v 1.7 2003/07/24 16:05:24 dgp Exp $
+# RCS: @(#) $Id: list.test,v 1.8 2010/02/12 03:21:32 mdejong Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -46,6 +46,26 @@ test list-1.23 {basic tests} {list \{} "\\{"
test list-1.24 {basic tests} {list} {}
test list-1.25 {basic tests} {list # #} {{#} #}
test list-1.26 {basic tests} {list #\{ #\{} {\#\{ #\{}
+test list-1.27 {basic null treatment} {
+ set l [list "" "\0" "\0\0"]
+ set e "{} \0 \0\0"
+ string equal $l $e
+} 1
+test list-1.28 {basic null treatment} {
+ set result "\0a\0b"
+ list $result [string length $result]
+} "\0a\0b 4"
+test list-1.29 {basic null treatment} {
+ set result "\0a\0b"
+ set srep "$result 4"
+ set lrep [list $result [string length $result]]
+ string equal $srep $lrep
+} 1
+test list-1.30 {basic null treatment} {
+ set l [list "\0abc" "xyz"]
+ set e "\0abc xyz"
+ string equal $l $e
+} 1
# For the next round of tests create a list and then pick it apart
# with "index" to make sure that we get back exactly what went in.