archie/tcl7.6/tests/misc.test

71 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2024-05-27 16:13:40 +02:00
# Commands covered: various
#
# This file contains a collection of miscellaneous Tcl tests that
# don't fit naturally in any of the other test files. Many of these
# tests are pathological cases that caused bugs in earlier Tcl
# releases.
#
# Copyright (c) 1992-1993 The Regents of the University of California.
2024-05-27 16:40:40 +02:00
# Copyright (c) 1994 Sun Microsystems, Inc.
2024-05-27 16:13:40 +02:00
#
2024-05-27 16:40:40 +02:00
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
2024-05-27 16:13:40 +02:00
#
2024-05-27 16:40:40 +02:00
# SCCS: @(#) misc.test 1.5 96/02/16 08:56:18
2024-05-27 16:13:40 +02:00
if {[string compare test [info procs test]] == 1} then {source defs}
test misc-1.1 {error in variable ref. in command in array reference} {
proc tstProc {} {
global a
set tst $a([winfo name $zz])
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
}
set msg {}
list [catch tstProc msg] $msg
} {1 {can't read "zz": no such variable}}
test misc-1.2 {error in variable ref. in command in array reference} {
proc tstProc {} "
global a
set tst \$a(\[winfo name \$\{zz)
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
"
set msg {}
list [catch tstProc msg] $msg $errorInfo
} [list 1 {missing close-brace for variable name} \
[format {missing close-brace for variable name
while executing
"winfo name $%szz)
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus commen ..."
(parsing index for array "a")
invoked from within
"set tst $a([winfo name $%szz)
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a bogus comment
# this is a ..."
(procedure "tstProc" line 4)
invoked from within
"tstProc"} \{ \{]]