diff options
Diffstat (limited to 'tests/linsert.test')
| -rw-r--r-- | tests/linsert.test | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tests/linsert.test b/tests/linsert.test index 86a47f5..4939e5c 100644 --- a/tests/linsert.test +++ b/tests/linsert.test @@ -6,13 +6,15 @@ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# -# SCCS: @(#) linsert.test 1.14 97/11/18 13:54:18 -if {[string compare test [info procs test]] == 1} then {source defs} +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest + namespace import -force ::tcltest::* +} catch {unset lis} catch {rename p ""} @@ -74,19 +76,28 @@ test linsert-1.18 {linsert command} { test linsert-1.19 {linsert command} { linsert {} end q r } {q r} +test linsert-1.20 {linsert command, use of end-int index} { + linsert {a b c d} end-2 e f +} {a b e f c d} test linsert-2.1 {linsert errors} { list [catch linsert msg] $msg -} {1 {wrong # args: should be "linsert list index element ?element ...?"}} +} {1 {wrong # args: should be "linsert list index ?element ...?"}} test linsert-2.2 {linsert errors} { list [catch {linsert a b} msg] $msg -} {1 {wrong # args: should be "linsert list index element ?element ...?"}} +} {1 {bad index "b": must be integer?[+-]integer? or end?[+-]integer?}} test linsert-2.3 {linsert errors} { list [catch {linsert a 12x 2} msg] $msg -} {1 {bad index "12x": must be integer or "end"}} +} {1 {bad index "12x": must be integer?[+-]integer? or end?[+-]integer?}} test linsert-2.4 {linsert errors} { list [catch {linsert \{ 12 2} msg] $msg } {1 {unmatched open brace in list}} +test linsert-2.5 {syntax (TIP 323)} { + linsert {a b c} 0 +} [list a b c] +test linsert-2.6 {syntax (TIP 323)} { + linsert "a\nb\nc" 0 +} [list a b c] test linsert-3.1 {linsert won't modify shared argument objects} { proc p {} { @@ -101,5 +112,8 @@ test linsert-3.2 {linsert won't modify shared argument objects} { linsert $lis 0 [string length $lis] } "7 a b c" +# cleanup catch {unset lis} catch {rename p ""} +::tcltest::cleanupTests +return |
