os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/lrange.test
First public contribution.
1 # Commands covered: lrange
3 # This file contains a collection of tests for one or more of the Tcl
4 # built-in commands. Sourcing this file into Tcl runs the tests and
5 # generates output for errors. No output means no errors were found.
7 # Copyright (c) 1991-1993 The Regents of the University of California.
8 # Copyright (c) 1994 Sun Microsystems, Inc.
9 # Copyright (c) 1998-1999 by Scriptics Corporation.
11 # See the file "license.terms" for information on usage and redistribution
12 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 # RCS: @(#) $Id: lrange.test,v 1.7 2000/04/10 17:19:01 ericm Exp $
16 if {[lsearch [namespace children] ::tcltest] == -1} {
17 package require tcltest
18 namespace import -force ::tcltest::*
21 test lrange-1.1 {range of list elements} {
24 test lrange-1.2 {range of list elements} {
25 lrange {a {bcd e {f g {}}} l14 l15 d} 1 1
27 test lrange-1.3 {range of list elements} {
28 lrange {a {bcd e {f g {}}} l14 l15 d} 3 end
30 test lrange-1.4 {range of list elements} {
31 lrange {a {bcd e {f g {}}} l14 l15 d} 4 10000
33 test lrange-1.5 {range of list elements} {
34 lrange {a {bcd e {f g {}}} l14 l15 d} 4 3
36 test lrange-1.6 {range of list elements} {
37 lrange {a {bcd e {f g {}}} l14 l15 d} 10 11
39 test lrange-1.7 {range of list elements} {
40 lrange {a b c d e} -1 2
42 test lrange-1.8 {range of list elements} {
43 lrange {a b c d e} -2 -1
45 test lrange-1.9 {range of list elements} {
46 lrange {a b c d e} -2 e
48 test lrange-1.10 {range of list elements} {
51 test lrange-1.11 {range of list elements} {
52 lrange "a b c d" end end
54 test lrange-1.12 {range of list elements} {
55 lrange "a b c d" end 100000
57 test lrange-1.13 {range of list elements} {
60 test lrange-1.14 {range of list elements} {
61 lrange "a b c d" end 2
63 test lrange-1.15 {range of list elements} {
64 concat \"[lrange {a b \{\ } 0 2]"
66 test lrange-1.16 {list element quoting} {
67 lrange {[append a .b]} 0 end
70 test lrange-2.1 {error conditions} {
71 list [catch {lrange a b} msg] $msg
72 } {1 {wrong # args: should be "lrange list first last"}}
73 test lrange-2.2 {error conditions} {
74 list [catch {lrange a b 6 7} msg] $msg
75 } {1 {wrong # args: should be "lrange list first last"}}
76 test lrange-2.3 {error conditions} {
77 list [catch {lrange a b 6} msg] $msg
78 } {1 {bad index "b": must be integer or end?-integer?}}
79 test lrange-2.4 {error conditions} {
80 list [catch {lrange a 0 enigma} msg] $msg
81 } {1 {bad index "enigma": must be integer or end?-integer?}}
82 test lrange-2.5 {error conditions} {
83 list [catch {lrange "a \{b c" 3 4} msg] $msg
84 } {1 {unmatched open brace in list}}
85 test lrange-2.6 {error conditions} {
86 list [catch {lrange "a b c \{ d e" 1 4} msg] $msg
87 } {1 {unmatched open brace in list}}
90 ::tcltest::cleanupTests