OSDN Git Service

Updated to tcl 8.4.1
[pf3gnuchains/sourceware.git] / tcl / tests / misc.test
1 # Commands covered:  various
2 #
3 # This file contains a collection of miscellaneous Tcl tests that
4 # don't fit naturally in any of the other test files.  Many of these
5 # tests are pathological cases that caused bugs in earlier Tcl
6 # releases.
7 #
8 # Copyright (c) 1992-1993 The Regents of the University of California.
9 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
10 # Copyright (c) 1998-1999 by Scriptics Corporation.
11 #
12 # See the file "license.terms" for information on usage and redistribution
13 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 #
15 # RCS: @(#) $Id$
16
17 if {[lsearch [namespace children] ::tcltest] == -1} {
18     package require tcltest
19     namespace import -force ::tcltest::*
20 }
21
22 test misc-1.1 {error in variable ref. in command in array reference} {
23     proc tstProc {} {
24         global a
25     
26         set tst $a([winfo name $zz])
27         # this is a bogus comment
28         # this is a bogus comment
29         # this is a bogus comment
30         # this is a bogus comment
31         # this is a bogus comment
32         # this is a bogus comment
33         # this is a bogus comment
34         # this is a bogus comment
35     }
36     set msg {}
37     list [catch tstProc msg] $msg
38 } {1 {can't read "zz": no such variable}}
39 test misc-1.2 {error in variable ref. in command in array reference} {
40     proc tstProc {} "
41         global a
42     
43         set tst \$a(\[winfo name \$\{zz)
44         # this is a bogus comment
45         # this is a bogus comment
46         # this is a bogus comment
47         # this is a bogus comment
48         # this is a bogus comment
49         # this is a bogus comment
50         # this is a bogus comment
51         # this is a bogus comment
52     "
53     set msg {}
54     list [catch tstProc msg] $msg $errorInfo
55 } {1 {missing close-brace for variable name} {missing close-brace for variable name
56     while compiling
57 "set tst $a([winfo name "
58     (compiling body of proc "tstProc", line 4)
59     invoked from within
60 "tstProc"}}
61
62 # cleanup
63 ::tcltest::cleanupTests
64 return
65
66
67
68
69
70
71
72
73
74
75
76