Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d0eb5328c1
Fetching contributors…

Cannot retrieve contributors at this time

executable file 31 lines (22 sloc) 0.847 kb
#!perl
# Copyright (C) 2006, 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 9
eval_is {lreplace list first} \
{wrong # args: should be "lreplace list first last ?element element ...?"} \
{too few args}
is [lreplace {a b c} 1 1] {a c} {delete 1}
is [lreplace {a b c} 1 1 d] {a d c} {replace 1}
is [lreplace {a b c} 1 0 d] {a d b c} {insert 1}
is [lreplace {} 4 6 a b c] {a b c} {initial empty list}
eval_is {lreplace list 1 0} \
{list doesn't contain element 1} \
{doesn't contain element}
is [lreplace {a b c} -1 0] {b c} {first negative}
is [lreplace {a b c} -1 -2] {a b c} {both negative}
is [lreplace {a b c} end-1 end d] {a d} {end replace}
Jump to Line
Something went wrong with that request. Please try again.