From bbe0b1645349bb22662c4a8858a4fce1e5e07132 Mon Sep 17 00:00:00 2001 From: mdejong Date: Fri, 12 Feb 2010 03:21:32 +0000 Subject: add tests for explicit backslash zero as argument to list command --- ChangeLog | 5 +++++ tests/list.test | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 78710d9..a0e4f09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-02-11 Mo DeJong + + * tests/list.test: Add tests for explicit \0 in + a string argument to the list command. + 2010-02-11 Donal K. Fellows * 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. -- cgit v0.12