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