Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5561d4df28
Fetching contributors…

Cannot retrieve contributors at this time

executable file 47 lines (36 sloc) 1.06 kb
# Copyright (C) 2005-2007, The Parrot Foundation.
# the following lines re-execute this as a tcl script
# the \ at the end of these lines makes them a comment in tcl \
use lib qw(lib); # \
use Tcl::Test; #\
source lib/test_more.tcl
plan 7
eval_is {lassign} \
{wrong # args: should be "lassign list varName ?varName ...?"} \
{no args}
eval_is {lassign {a b}} \
{wrong # args: should be "lassign list varName ?varName ...?"} \
{one args}
eval_is {
set b [lassign {x y} a]
list $a $b
} {x y} {singleton with one leftover}
eval_is {
set b [lassign {x y z} a]
list $a $b
} {x {y z}} {singleton with two leftovers}
eval_is {
set c [lassign {x y z} a b]
list $a $b $c
} {x y z} {double with a leftover}
eval_is {
set d [lassign {x y z} a b c]
list $a $b $c $d
} {x y z {}} {triple, no leftovers}
eval_is {
set e [lassign {x y z} a b c d]
list $a $b $c $d $e
} {x y z {} {}} {4 variables, not enough values}
Jump to Line
Something went wrong with that request. Please try again.