sl@0: # This file tests the AssocData facility of Tcl sl@0: # sl@0: # This file contains a collection of tests for one or more of the Tcl sl@0: # built-in commands. Sourcing this file into Tcl runs the tests and sl@0: # generates output for errors. No output means no errors were found. sl@0: # sl@0: # Copyright (c) 1991-1994 The Regents of the University of California. sl@0: # Copyright (c) 1994 Sun Microsystems, Inc. sl@0: # Copyright (c) 1998-1999 by Scriptics Corporation. sl@0: # sl@0: # See the file "license.terms" for information on usage and redistribution sl@0: # of this file, and for a DISCLAIMER OF ALL WARRANTIES. sl@0: # sl@0: # RCS: @(#) $Id: assocd.test,v 1.5 2000/04/10 17:18:56 ericm Exp $ sl@0: sl@0: if {[lsearch [namespace children] ::tcltest] == -1} { sl@0: package require tcltest sl@0: namespace import -force ::tcltest::* sl@0: } sl@0: sl@0: if {[string compare testsetassocdata [info commands testsetassocdata]] != 0} { sl@0: puts "This application hasn't been compiled with the tests for assocData," sl@0: puts "therefore I am skipping all of these tests." sl@0: ::tcltest::cleanupTests sl@0: return sl@0: } sl@0: sl@0: test assocd-1.1 {testing setting assoc data} { sl@0: testsetassocdata a 1 sl@0: } "" sl@0: test assocd-1.2 {testing setting assoc data} { sl@0: testsetassocdata a 2 sl@0: } "" sl@0: test assocd-1.3 {testing setting assoc data} { sl@0: testsetassocdata 123 456 sl@0: } "" sl@0: test assocd-1.4 {testing setting assoc data} { sl@0: testsetassocdata abc "abc d e f" sl@0: } "" sl@0: sl@0: test assocd-2.1 {testing getting assoc data} { sl@0: testgetassocdata a sl@0: } 2 sl@0: test assocd-2.2 {testing getting assoc data} { sl@0: testgetassocdata 123 sl@0: } 456 sl@0: test assocd-2.3 {testing getting assoc data} { sl@0: testgetassocdata abc sl@0: } {abc d e f} sl@0: test assocd-2.4 {testing getting assoc data} { sl@0: testgetassocdata xxx sl@0: } "" sl@0: sl@0: test assocd-3.1 {testing deleting assoc data} { sl@0: testdelassocdata a sl@0: } "" sl@0: test assocd-3.2 {testing deleting assoc data} { sl@0: testdelassocdata 123 sl@0: } "" sl@0: test assocd-3.3 {testing deleting assoc data} { sl@0: list [catch {testdelassocdata nonexistent} msg] $msg sl@0: } {0 {}} sl@0: sl@0: # cleanup sl@0: ::tcltest::cleanupTests sl@0: return sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: