home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tcl8.0 / tests / assocd.test < prev    next >
Encoding:
Text File  |  1997-08-15  |  1.7 KB  |  58 lines  |  [TEXT/ALFA]

  1. # This file tests the AssocData facility of Tcl
  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-1994 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. # "@(#) assocd.test 1.5 95/08/02 17:11:37"
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. if {[string compare testsetassocdata [info commands testsetassocdata]] != 0} {
  18.     puts "This application hasn't been compiled with the tests for assocData,"
  19.     puts "therefore I am skipping all of these tests."
  20.     return
  21. }
  22.  
  23. test assocd-1.1 {testing setting assoc data} {
  24.    testsetassocdata a 1
  25. } ""
  26. test assocd-1.2 {testing setting assoc data} {
  27.    testsetassocdata a 2
  28. } ""
  29. test assocd-1.3 {testing setting assoc data} {
  30.    testsetassocdata 123 456
  31. } ""
  32. test assocd-1.4 {testing setting assoc data} {
  33.    testsetassocdata abc "abc d e f"
  34. } ""
  35.  
  36. test assocd-2.1 {testing getting assoc data} {
  37.    testgetassocdata a
  38. } 2
  39. test assocd-2.2 {testing getting assoc data} {
  40.    testgetassocdata 123
  41. } 456
  42. test assocd-2.3 {testing getting assoc data} {
  43.    testgetassocdata abc
  44. } {abc d e f}
  45. test assocd-2.4 {testing getting assoc data} {
  46.    testgetassocdata xxx
  47. } ""
  48.  
  49. test assocd-3.1 {testing deleting assoc data} {
  50.    testdelassocdata a
  51. } ""
  52. test assocd-3.2 {testing deleting assoc data} {
  53.    testdelassocdata 123
  54. } ""
  55. test assocd-3.3 {testing deleting assoc data} {
  56.    list [catch {testdelassocdata nonexistent} msg] $msg
  57. } {0 {}}
  58.