# # lassign.test # # Tests for lassign command. #--------------------------------------------------------------------------- # Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, provided # that the above copyright notice appear in all copies. Karl Lehenbauer and # Mark Diekhans make no representations about the suitability of this # software for any purpose. It is provided "as is" without express or # implied warranty. #------------------------------------------------------------------------------ # $Id: lassign.test,v 1.1 2001/10/24 23:31:49 hobbs Exp $ #------------------------------------------------------------------------------ # if {[cequal [info procs Test] {}]} { source [file join [file dirname [info script]] testlib.tcl] } Test lassign-1.1 {lassign command} { lassign "a b {c d} e" alpha beta gamma delta epsilon list $alpha $beta $gamma $delta $epsilon } 0 "a b {c d} e {}" Test lassign-1.2 {lassign command} { set remain [lassign "a b {c d} e gg hhh ii" alpha beta gamma delta] list $alpha $beta $gamma $delta $remain } 0 "a b {c d} e {gg hhh ii}" Test lassign-1.3 {lassign command} { lassign "a b {c d} e" } 1 {wrong # args: lassign list varname ?varname..?} Test lassign-1.4 {lassign command} { lassign "a b {c d} e" array(alpha) array(beta) array(gamma) array(delta) array(epsilon) list $array(alpha) $array(beta) $array(gamma) $array(delta) $array(epsilon) } 0 "a b {c d} e {}" catch {unset alpha beta gamma delta epsilon} # cleanup ::tcltest::cleanupTests return