Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/tests/assocd.test @ 68

Last change on this file since 68 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 2.1 KB
Line 
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: assocd.test,v 1.6 2004/05/19 10:42:00 dkf Exp $
15
16if {[lsearch [namespace children] ::tcltest] == -1} {
17    package require tcltest
18    namespace import -force ::tcltest::*
19}
20
21testConstraint testgetassocdata [llength [info commands testgetassocdata]]
22testConstraint testsetassocdata [llength [info commands testsetassocdata]]
23testConstraint testdelassocdata [llength [info commands testdelassocdata]]
24
25test assocd-1.1 {testing setting assoc data} testsetassocdata {
26   testsetassocdata a 1
27} ""
28test assocd-1.2 {testing setting assoc data} testsetassocdata {
29   testsetassocdata a 2
30} ""
31test assocd-1.3 {testing setting assoc data} testsetassocdata {
32   testsetassocdata 123 456
33} ""
34test assocd-1.4 {testing setting assoc data} testsetassocdata {
35   testsetassocdata abc "abc d e f"
36} ""
37
38test assocd-2.1 {testing getting assoc data} testgetassocdata {
39   testgetassocdata a
40} 2
41test assocd-2.2 {testing getting assoc data} testgetassocdata {
42   testgetassocdata 123
43} 456
44test assocd-2.3 {testing getting assoc data} testgetassocdata {
45   testgetassocdata abc
46} {abc d e f}
47test assocd-2.4 {testing getting assoc data} testgetassocdata {
48   testgetassocdata xxx
49} ""
50
51test assocd-3.1 {testing deleting assoc data} testdelassocdata {
52   testdelassocdata a
53} ""
54test assocd-3.2 {testing deleting assoc data} testdelassocdata {
55   testdelassocdata 123
56} ""
57test assocd-3.3 {testing deleting assoc data} testdelassocdata {
58   list [catch {testdelassocdata nonexistent} msg] $msg
59} {0 {}}
60
61# cleanup
62::tcltest::cleanupTests
63return
Note: See TracBrowser for help on using the repository browser.