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

  1. # Commands covered:  unknown
  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. # @(#) unknown.test 1.10 94/12/17 16:20:30
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. catch {rename unknown unknown.old}
  18.  
  19. test unknown-1.1 {non-existent "unknown" command} {
  20.     list [catch {_non-existent_ foo bar} msg] $msg
  21. } {1 {invalid command name "_non-existent_"}}
  22.  
  23. proc unknown {args} {
  24.     global x
  25.     set x $args
  26. }
  27.  
  28. test unknown-2.1 {calling "unknown" command} {
  29.     foobar x y z
  30.     set x
  31. } {foobar x y z}
  32. test unknown-2.2 {calling "unknown" command with lots of args} {
  33.     foobar 1 2 3 4 5 6 7
  34.     set x
  35. } {foobar 1 2 3 4 5 6 7}
  36. test unknown-2.3 {calling "unknown" command with lots of args} {
  37.     foobar 1 2 3 4 5 6 7 8
  38.     set x
  39. } {foobar 1 2 3 4 5 6 7 8}
  40. test unknown-2.4 {calling "unknown" command with lots of args} {
  41.     foobar 1 2 3 4 5 6 7 8 9
  42.     set x
  43. } {foobar 1 2 3 4 5 6 7 8 9}
  44.  
  45. test unknown-3.1 {argument quoting in calls to "unknown"} {
  46.     foobar \{ \} a\{b \; "\\" \$a a\[b \]
  47.     set x
  48. } "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]"
  49.  
  50. proc unknown args {
  51.     error "unknown failed"
  52. }
  53.  
  54. test unknown-4.1 {errors in "unknown" procedure} {
  55.     list [catch {non-existent a b} msg] $msg $errorCode
  56. } {1 {unknown failed} NONE}
  57.  
  58. catch {rename unknown {}}
  59. catch {rename unknown.old unknown}
  60. return {}
  61.