summaryrefslogtreecommitdiffstats
path: root/tests/assocd.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/assocd.test')
-rw-r--r--tests/assocd.test57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/assocd.test b/tests/assocd.test
new file mode 100644
index 0000000..20e8223
--- /dev/null
+++ b/tests/assocd.test
@@ -0,0 +1,57 @@
+# This file tests the AssocData facility of Tcl
+#
+# This file contains a collection of tests for one or more of the Tcl
+# built-in commands. Sourcing this file into Tcl runs the tests and
+# generates output for errors. No output means no errors were found.
+#
+# Copyright (c) 1991-1994 The Regents of the University of California.
+# Copyright (c) 1994 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# "@(#) assocd.test 1.5 95/08/02 17:11:37"
+
+if {[string compare test [info procs test]] == 1} then {source defs}
+
+if {[string compare testsetassocdata [info commands testsetassocdata]] != 0} {
+ puts "This application hasn't been compiled with the tests for assocData,"
+ puts "therefore I am skipping all of these tests."
+ return
+}
+
+test assocd-1.1 {testing setting assoc data} {
+ testsetassocdata a 1
+} ""
+test assocd-1.2 {testing setting assoc data} {
+ testsetassocdata a 2
+} ""
+test assocd-1.3 {testing setting assoc data} {
+ testsetassocdata 123 456
+} ""
+test assocd-1.4 {testing setting assoc data} {
+ testsetassocdata abc "abc d e f"
+} ""
+
+test assocd-2.1 {testing getting assoc data} {
+ testgetassocdata a
+} 2
+test assocd-2.2 {testing getting assoc data} {
+ testgetassocdata 123
+} 456
+test assocd-2.3 {testing getting assoc data} {
+ testgetassocdata abc
+} {abc d e f}
+test assocd-2.4 {testing getting assoc data} {
+ testgetassocdata xxx
+} ""
+
+test assocd-3.1 {testing deleting assoc data} {
+ testdelassocdata a
+} ""
+test assocd-3.2 {testing deleting assoc data} {
+ testdelassocdata 123
+} ""
+test assocd-3.3 {testing deleting assoc data} {
+ list [catch {testdelassocdata nonexistent} msg] $msg
+} {0 {}}