OSDN Git Service

Updated to tcl 8.4.1
[pf3gnuchains/sourceware.git] / tcl / tests / assocd.test
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 # Copyright (c) 1998-1999 by Scriptics Corporation.
10 #
11 # See the file "license.terms" for information on usage and redistribution
12 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 #
14 # RCS: @(#) $Id$
15
16 if {[lsearch [namespace children] ::tcltest] == -1} {
17     package require tcltest
18     namespace import -force ::tcltest::*
19 }
20
21 if {[string compare testsetassocdata [info commands testsetassocdata]] != 0} {
22     puts "This application hasn't been compiled with the tests for assocData,"
23     puts "therefore I am skipping all of these tests."
24     ::tcltest::cleanupTests
25     return
26 }
27
28 test assocd-1.1 {testing setting assoc data} {
29    testsetassocdata a 1
30 } ""
31 test assocd-1.2 {testing setting assoc data} {
32    testsetassocdata a 2
33 } ""
34 test assocd-1.3 {testing setting assoc data} {
35    testsetassocdata 123 456
36 } ""
37 test assocd-1.4 {testing setting assoc data} {
38    testsetassocdata abc "abc d e f"
39 } ""
40
41 test assocd-2.1 {testing getting assoc data} {
42    testgetassocdata a
43 } 2
44 test assocd-2.2 {testing getting assoc data} {
45    testgetassocdata 123
46 } 456
47 test assocd-2.3 {testing getting assoc data} {
48    testgetassocdata abc
49 } {abc d e f}
50 test assocd-2.4 {testing getting assoc data} {
51    testgetassocdata xxx
52 } ""
53
54 test assocd-3.1 {testing deleting assoc data} {
55    testdelassocdata a
56 } ""
57 test assocd-3.2 {testing deleting assoc data} {
58    testdelassocdata 123
59 } ""
60 test assocd-3.3 {testing deleting assoc data} {
61    list [catch {testdelassocdata nonexistent} msg] $msg
62 } {0 {}}
63
64 # cleanup
65 ::tcltest::cleanupTests
66 return
67
68
69
70
71
72
73
74
75
76
77
78