Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5561d4df28
Fetching contributors…

Cannot retrieve contributors at this time

76 lines (59 sloc) 1.326 kb
#!perl
# Copyright (C) 2006-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; #\
__DATA__
source lib/test_more.tcl
plan 12
eval_is {
set a a
lset a b
set a
} b {two arg replace, check variable replacement}
eval_is {
set a a
lset a {} b
} b {three arg replace}
eval_is {
set a "a b c"
lset a 1 c
} {a c c} {one index}
eval_is {
set a "a {b c} d"
lset a 1 0 c
} {a {c c} d} {multiple indices}
eval_is {
set a "a b c d"
lset a end e
} {a b c e} {end}
eval_is {lset} \
{wrong # args: should be "lset listVar index ?index...? value"} \
{too few args}
eval_is {lset a} \
{wrong # args: should be "lset listVar index ?index...? value"} \
{too few args}
eval_is {lset frob b} \
{can't read "frob": no such variable} \
{bad variable}
eval_is {
set a b
lset a 3 b
} {list index out of range} \
{list index out of range}
eval_is {
set a "a b c d"
lset a end--1 e
} {list index out of range} \
{list index out of range}
eval_is {
set a "a b c d"
lset a -1 e
} {list index out of range} \
{list index out of range}
eval_is {
set a b
lset a 3.2 b
} {bad index "3.2": must be integer?[+-]integer? or end?[+-]integer?} \
{float index}
Jump to Line
Something went wrong with that request. Please try again.