1# 2# lassign.test 3# 4# Tests for lassign command. 5#--------------------------------------------------------------------------- 6# Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans. 7# 8# Permission to use, copy, modify, and distribute this software and its 9# documentation for any purpose and without fee is hereby granted, provided 10# that the above copyright notice appear in all copies. Karl Lehenbauer and 11# Mark Diekhans make no representations about the suitability of this 12# software for any purpose. It is provided "as is" without express or 13# implied warranty. 14#------------------------------------------------------------------------------ 15# $Id: lassign.test,v 1.2 2002/04/02 02:29:43 hobbs Exp $ 16#------------------------------------------------------------------------------ 17# 18 19if {[cequal [info procs Test] {}]} { 20 source [file join [file dirname [info script]] testlib.tcl] 21} 22 23Test lassign-1.1 {lassign command} { 24 lassign "a b {c d} e" alpha beta gamma delta epsilon 25 list $alpha $beta $gamma $delta $epsilon 26} 0 "a b {c d} e {}" 27 28Test lassign-1.2 {lassign command} { 29 set remain [lassign "a b {c d} e gg hhh ii" alpha beta gamma delta] 30 list $alpha $beta $gamma $delta $remain 31} 0 "a b {c d} e {gg hhh ii}" 32 33Test lassign-1.3 {lassign command} { 34 lassign "a b {c d} e" 35} 1 {wrong # args: lassign list varname ?varname..?} 36 37Test lassign-1.4 {lassign command} { 38 lassign "a b {c d} e" array(alpha) array(beta) array(gamma) array(delta) array(epsilon) 39 list $array(alpha) $array(beta) $array(gamma) $array(delta) $array(epsilon) 40} 0 "a b {c d} e {}" 41 42catch {unset alpha beta gamma delta epsilon} 43 44# cleanup 45::tcltest::cleanupTests 46return 47