sl@0
|
1 |
# This file tests the AssocData facility of Tcl
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# This file contains a collection of tests for one or more of the Tcl
|
sl@0
|
4 |
# built-in commands. Sourcing this file into Tcl runs the tests and
|
sl@0
|
5 |
# generates output for errors. No output means no errors were found.
|
sl@0
|
6 |
#
|
sl@0
|
7 |
# Copyright (c) 1991-1994 The Regents of the University of California.
|
sl@0
|
8 |
# Copyright (c) 1994 Sun Microsystems, Inc.
|
sl@0
|
9 |
# Copyright (c) 1998-1999 by Scriptics Corporation.
|
sl@0
|
10 |
#
|
sl@0
|
11 |
# See the file "license.terms" for information on usage and redistribution
|
sl@0
|
12 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
sl@0
|
13 |
#
|
sl@0
|
14 |
# RCS: @(#) $Id: assocd.test,v 1.5 2000/04/10 17:18:56 ericm Exp $
|
sl@0
|
15 |
|
sl@0
|
16 |
if {[lsearch [namespace children] ::tcltest] == -1} {
|
sl@0
|
17 |
package require tcltest
|
sl@0
|
18 |
namespace import -force ::tcltest::*
|
sl@0
|
19 |
}
|
sl@0
|
20 |
|
sl@0
|
21 |
if {[string compare testsetassocdata [info commands testsetassocdata]] != 0} {
|
sl@0
|
22 |
puts "This application hasn't been compiled with the tests for assocData,"
|
sl@0
|
23 |
puts "therefore I am skipping all of these tests."
|
sl@0
|
24 |
::tcltest::cleanupTests
|
sl@0
|
25 |
return
|
sl@0
|
26 |
}
|
sl@0
|
27 |
|
sl@0
|
28 |
test assocd-1.1 {testing setting assoc data} {
|
sl@0
|
29 |
testsetassocdata a 1
|
sl@0
|
30 |
} ""
|
sl@0
|
31 |
test assocd-1.2 {testing setting assoc data} {
|
sl@0
|
32 |
testsetassocdata a 2
|
sl@0
|
33 |
} ""
|
sl@0
|
34 |
test assocd-1.3 {testing setting assoc data} {
|
sl@0
|
35 |
testsetassocdata 123 456
|
sl@0
|
36 |
} ""
|
sl@0
|
37 |
test assocd-1.4 {testing setting assoc data} {
|
sl@0
|
38 |
testsetassocdata abc "abc d e f"
|
sl@0
|
39 |
} ""
|
sl@0
|
40 |
|
sl@0
|
41 |
test assocd-2.1 {testing getting assoc data} {
|
sl@0
|
42 |
testgetassocdata a
|
sl@0
|
43 |
} 2
|
sl@0
|
44 |
test assocd-2.2 {testing getting assoc data} {
|
sl@0
|
45 |
testgetassocdata 123
|
sl@0
|
46 |
} 456
|
sl@0
|
47 |
test assocd-2.3 {testing getting assoc data} {
|
sl@0
|
48 |
testgetassocdata abc
|
sl@0
|
49 |
} {abc d e f}
|
sl@0
|
50 |
test assocd-2.4 {testing getting assoc data} {
|
sl@0
|
51 |
testgetassocdata xxx
|
sl@0
|
52 |
} ""
|
sl@0
|
53 |
|
sl@0
|
54 |
test assocd-3.1 {testing deleting assoc data} {
|
sl@0
|
55 |
testdelassocdata a
|
sl@0
|
56 |
} ""
|
sl@0
|
57 |
test assocd-3.2 {testing deleting assoc data} {
|
sl@0
|
58 |
testdelassocdata 123
|
sl@0
|
59 |
} ""
|
sl@0
|
60 |
test assocd-3.3 {testing deleting assoc data} {
|
sl@0
|
61 |
list [catch {testdelassocdata nonexistent} msg] $msg
|
sl@0
|
62 |
} {0 {}}
|
sl@0
|
63 |
|
sl@0
|
64 |
# cleanup
|
sl@0
|
65 |
::tcltest::cleanupTests
|
sl@0
|
66 |
return
|
sl@0
|
67 |
|
sl@0
|
68 |
|
sl@0
|
69 |
|
sl@0
|
70 |
|
sl@0
|
71 |
|
sl@0
|
72 |
|
sl@0
|
73 |
|
sl@0
|
74 |
|
sl@0
|
75 |
|
sl@0
|
76 |
|
sl@0
|
77 |
|
sl@0
|
78 |
|