sl@0: # Commands covered: join sl@0: # sl@0: # This file contains a collection of tests for one or more of the Tcl sl@0: # built-in commands. Sourcing this file into Tcl runs the tests and sl@0: # generates output for errors. No output means no errors were found. sl@0: # sl@0: # Copyright (c) 1991-1993 The Regents of the University of California. sl@0: # Copyright (c) 1994 Sun Microsystems, Inc. sl@0: # Copyright (c) 1998-1999 by Scriptics Corporation. sl@0: # sl@0: # See the file "license.terms" for information on usage and redistribution sl@0: # of this file, and for a DISCLAIMER OF ALL WARRANTIES. sl@0: # sl@0: # RCS: @(#) $Id: join.test,v 1.5 2000/04/10 17:19:01 ericm Exp $ sl@0: sl@0: if {[lsearch [namespace children] ::tcltest] == -1} { sl@0: package require tcltest sl@0: namespace import -force ::tcltest::* sl@0: } sl@0: sl@0: test join-1.1 {basic join commands} { sl@0: join {a b c} xyz sl@0: } axyzbxyzc sl@0: test join-1.2 {basic join commands} { sl@0: join {a b c} {} sl@0: } abc sl@0: test join-1.3 {basic join commands} { sl@0: join {} xyz sl@0: } {} sl@0: test join-1.4 {basic join commands} { sl@0: join {12 34 56} sl@0: } {12 34 56} sl@0: sl@0: test join-2.1 {join errors} { sl@0: list [catch join msg] $msg $errorCode sl@0: } {1 {wrong # args: should be "join list ?joinString?"} NONE} sl@0: test join-2.2 {join errors} { sl@0: list [catch {join a b c} msg] $msg $errorCode sl@0: } {1 {wrong # args: should be "join list ?joinString?"} NONE} sl@0: test join-2.3 {join errors} { sl@0: list [catch {join "a \{ c" 111} msg] $msg $errorCode sl@0: } {1 {unmatched open brace in list} NONE} sl@0: sl@0: test join-3.1 {joinString is binary ok} { sl@0: string length [join {a b c} a\0b] sl@0: } 9 sl@0: sl@0: test join-3.2 {join is binary ok} { sl@0: string length [join "a\0b a\0b a\0b"] sl@0: } 11 sl@0: sl@0: # cleanup sl@0: ::tcltest::cleanupTests sl@0: return sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: