home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / SunLabs / tclTK / src / tcl7.4 / tests / llength.test < prev    next >
Encoding:
Text File  |  1994-12-18  |  1.1 KB  |  36 lines

  1. # Commands covered:  llength
  2. #
  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.
  6. #
  7. # Copyright (c) 1991-1993 The Regents of the University of California.
  8. # Copyright (c) 1994 Sun Microsystems, Inc.
  9. #
  10. # See the file "license.terms" for information on usage and redistribution
  11. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12. #
  13. # @(#) llength.test 1.3 94/12/17 16:20:09
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. test llength-1.1 {length of list} {
  18.     llength {a b c d}
  19. } 4
  20. test llength-1.2 {length of list} {
  21.     llength {a b c {a b {c d}} d}
  22. } 5
  23. test llength-1.3 {length of list} {
  24.     llength {}
  25. } 0
  26.  
  27. test llength-2.1 {error conditions} {
  28.     list [catch {llength} msg] $msg
  29. } {1 {wrong # args: should be "llength list"}}
  30. test llength-2.2 {error conditions} {
  31.     list [catch {llength 123 2} msg] $msg
  32. } {1 {wrong # args: should be "llength list"}}
  33. test llength-2.3 {error conditions} {
  34.     list [catch {llength "a b c \{"} msg] $msg
  35. } {1 {unmatched open brace in list}}
  36.