Debian Codegraph @

tests/misc.test

raw
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 if {"::tcltest" ni [namespace children]} {
16 package require tcltest 2.5
17 namespace import -force ::tcltest::*
18 }
19
20 ::tcltest::loadTestedCommands
21 catch [list package require -exact Tcltest [info patchlevel]]
22
23 testConstraint testhashsystemhash [llength [info commands testhashsystemhash]]
24
25 test misc-1.1 {error in variable ref. in command in array reference} {
26 proc tstProc {} {
27 global a
28
29 set tst $a([winfo name $zz])
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 # this is a bogus comment
36 # this is a bogus comment
37 # this is a bogus comment
38 }
39 set msg {}
40 list [catch tstProc msg] $msg
41 } {1 {can't read "zz": no such variable}}
42 test misc-1.2 {error in variable ref. in command in array reference} {
43 proc tstProc {} "
44 global a
45
46 set tst \$a(\[winfo name \$\{zz)
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 # this is a bogus comment
53 # this is a bogus comment
54 # this is a bogus comment
55 "
56 set msg {}
57 join [list [catch tstProc msg] $msg $::errorInfo] \n
58 } [subst -novariables -nocommands {1
59 missing close-brace for variable name
60 missing close-brace for variable name
61 while executing
62 "set tst $a([winfo name $\{"
63 (procedure "tstProc" line 4)
64 invoked from within
65 "tstProc"}]
66
67 for {set i 1} {$i<300} {incr i} {
68 test misc-2.$i {hash table with sys-alloc} testhashsystemhash \
69 "testhashsystemhash $i" OK
70 }
71
72 # cleanup
73 ::tcltest::cleanupTests
74 return