os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/lrange.test
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/lrange.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,91 @@
1.4 +# Commands covered: lrange
1.5 +#
1.6 +# This file contains a collection of tests for one or more of the Tcl
1.7 +# built-in commands. Sourcing this file into Tcl runs the tests and
1.8 +# generates output for errors. No output means no errors were found.
1.9 +#
1.10 +# Copyright (c) 1991-1993 The Regents of the University of California.
1.11 +# Copyright (c) 1994 Sun Microsystems, Inc.
1.12 +# Copyright (c) 1998-1999 by Scriptics Corporation.
1.13 +#
1.14 +# See the file "license.terms" for information on usage and redistribution
1.15 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.16 +#
1.17 +# RCS: @(#) $Id: lrange.test,v 1.7 2000/04/10 17:19:01 ericm Exp $
1.18 +
1.19 +if {[lsearch [namespace children] ::tcltest] == -1} {
1.20 + package require tcltest
1.21 + namespace import -force ::tcltest::*
1.22 +}
1.23 +
1.24 +test lrange-1.1 {range of list elements} {
1.25 + lrange {a b c d} 1 2
1.26 +} {b c}
1.27 +test lrange-1.2 {range of list elements} {
1.28 + lrange {a {bcd e {f g {}}} l14 l15 d} 1 1
1.29 +} {{bcd e {f g {}}}}
1.30 +test lrange-1.3 {range of list elements} {
1.31 + lrange {a {bcd e {f g {}}} l14 l15 d} 3 end
1.32 +} {l15 d}
1.33 +test lrange-1.4 {range of list elements} {
1.34 + lrange {a {bcd e {f g {}}} l14 l15 d} 4 10000
1.35 +} {d}
1.36 +test lrange-1.5 {range of list elements} {
1.37 + lrange {a {bcd e {f g {}}} l14 l15 d} 4 3
1.38 +} {}
1.39 +test lrange-1.6 {range of list elements} {
1.40 + lrange {a {bcd e {f g {}}} l14 l15 d} 10 11
1.41 +} {}
1.42 +test lrange-1.7 {range of list elements} {
1.43 + lrange {a b c d e} -1 2
1.44 +} {a b c}
1.45 +test lrange-1.8 {range of list elements} {
1.46 + lrange {a b c d e} -2 -1
1.47 +} {}
1.48 +test lrange-1.9 {range of list elements} {
1.49 + lrange {a b c d e} -2 e
1.50 +} {a b c d e}
1.51 +test lrange-1.10 {range of list elements} {
1.52 + lrange "a b\{c d" 1 2
1.53 +} "b\\{c d"
1.54 +test lrange-1.11 {range of list elements} {
1.55 + lrange "a b c d" end end
1.56 +} d
1.57 +test lrange-1.12 {range of list elements} {
1.58 + lrange "a b c d" end 100000
1.59 +} d
1.60 +test lrange-1.13 {range of list elements} {
1.61 + lrange "a b c d" e 3
1.62 +} d
1.63 +test lrange-1.14 {range of list elements} {
1.64 + lrange "a b c d" end 2
1.65 +} {}
1.66 +test lrange-1.15 {range of list elements} {
1.67 + concat \"[lrange {a b \{\ } 0 2]"
1.68 +} {"a b \{\ "}
1.69 +test lrange-1.16 {list element quoting} {
1.70 + lrange {[append a .b]} 0 end
1.71 +} {{[append} a .b\]}
1.72 +
1.73 +test lrange-2.1 {error conditions} {
1.74 + list [catch {lrange a b} msg] $msg
1.75 +} {1 {wrong # args: should be "lrange list first last"}}
1.76 +test lrange-2.2 {error conditions} {
1.77 + list [catch {lrange a b 6 7} msg] $msg
1.78 +} {1 {wrong # args: should be "lrange list first last"}}
1.79 +test lrange-2.3 {error conditions} {
1.80 + list [catch {lrange a b 6} msg] $msg
1.81 +} {1 {bad index "b": must be integer or end?-integer?}}
1.82 +test lrange-2.4 {error conditions} {
1.83 + list [catch {lrange a 0 enigma} msg] $msg
1.84 +} {1 {bad index "enigma": must be integer or end?-integer?}}
1.85 +test lrange-2.5 {error conditions} {
1.86 + list [catch {lrange "a \{b c" 3 4} msg] $msg
1.87 +} {1 {unmatched open brace in list}}
1.88 +test lrange-2.6 {error conditions} {
1.89 + list [catch {lrange "a b c \{ d e" 1 4} msg] $msg
1.90 +} {1 {unmatched open brace in list}}
1.91 +
1.92 +# cleanup
1.93 +::tcltest::cleanupTests
1.94 +return