1 # Commands covered: llength
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 if {"::tcltest" ni [namespace children]} {
15 package require tcltest 2.5
16 namespace import -force ::tcltest::*
19 test llength-1.1 {length of list} {
22 test llength-1.2 {length of list} {
23 llength {a b c {a b {c d}} d}
25 test llength-1.3 {length of list} {
29 test llength-2.1 {error conditions} {
30 list [catch {llength} msg] $msg
31 } {1 {wrong # args: should be "llength list"}}
32 test llength-2.2 {error conditions} {
33 list [catch {llength 123 2} msg] $msg
34 } {1 {wrong # args: should be "llength list"}}
35 test llength-2.3 {error conditions} {
36 list [catch {llength "a b c \{"} msg] $msg
37 } {1 {unmatched open brace in list}}
40 ::tcltest::cleanupTests