home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-15 | 43.6 KB | 1,435 lines |
- Newsgroups: comp.sources.misc
- From: karl@sugar.neosoft.com (Karl Lehenbauer)
- Subject: v25i083: tcl - tool command language, version 6.1, Part15/33
- Message-ID: <1991Nov15.224703.20643@sparky.imd.sterling.com>
- X-Md4-Signature: 3125ebba285bdb6a44fba3ec1d6d7da0
- Date: Fri, 15 Nov 1991 22:47:03 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
- Posting-number: Volume 25, Issue 83
- Archive-name: tcl/part15
- Environment: UNIX
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 15 (of 33)."
- # Contents: tcl6.1/tests/scan.test tcl6.1/tests/trace.test
- # Wrapped by karl@one on Tue Nov 12 19:44:23 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'tcl6.1/tests/scan.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/tests/scan.test'\"
- else
- echo shar: Extracting \"'tcl6.1/tests/scan.test'\" \(20188 characters\)
- sed "s/^X//" >'tcl6.1/tests/scan.test' <<'END_OF_FILE'
- X# Commands covered: scan
- X#
- X# This file contains a collection of tests for one or more of the Tcl
- X# built-in commands. Sourcing this file into Tcl runs the tests and
- X# generates output for errors. No output means no errors were found.
- X#
- X# Copyright 1991 Regents of the University of California
- X# Permission to use, copy, modify, and distribute this
- X# software and its documentation for any purpose and without
- X# fee is hereby granted, provided that this copyright notice
- X# appears in all copies. The University of California makes no
- X# representations about the suitability of this software for any
- X# purpose. It is provided "as is" without express or implied
- X# warranty.
- X#
- X# $Header: /user6/ouster/tcl/tests/RCS/scan.test,v 1.9 91/10/17 16:25:28 ouster Exp $ (Berkeley)
- X
- Xif {[string compare test [info procs test]] == 1} then {source defs}
- X
- Xtest scan-1.1 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-20 1476 \n33 0" "%d %d %d %d" a b c d
- X} 4
- Xtest scan-1.2 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-20 1476 \n33 0" "%d %d %d %d" a b c d
- X set a
- X} -20
- Xtest scan-1.3 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-20 1476 \n33 0" "%d %d %d %d" a b c d
- X set b
- X} 1476
- Xtest scan-1.4 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-20 1476 \n33 0" "%d %d %d %d" a b c d
- X set c
- X} 33
- Xtest scan-1.5 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-20 1476 \n33 0" "%d %d %d %d" a b c d
- X set d
- X} 0
- Xtest scan-1.6 {integer scanning} {
- X set a {}; set b {}; set c {}
- X scan "-45 16 7890 +10" "%2d %*d %10d %d" a b c
- X} 3
- Xtest scan-1.7 {integer scanning} {
- X set a {}; set b {}; set c {}
- X scan "-45 16 7890 +10" "%2d %*d %10d %d" a b c
- X set a
- X} -4
- Xtest scan-1.8 {integer scanning} {
- X set a {}; set b {}; set c {}
- X scan "-45 16 7890 +10" "%2d %*d %10d %d" a b c
- X set b
- X} 16
- Xtest scan-1.9 {integer scanning} {
- X set a {}; set b {}; set c {}
- X scan "-45 16 7890 +10" "%2d %*d %10d %d" a b c
- X set c
- X} 7890
- Xtest scan-1.10 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-45 16 +10 987" "%D %d %D %d" a b c d
- X} 4
- Xtest scan-1.11 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-45 16 +10 987" "%D %d %D %d" a b c d
- X set a
- X} -45
- Xtest scan-1.12 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-45 16 +10 987" "%D %d%D %d" a b c d
- X set b
- X} 16
- Xtest scan-1.13 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-45 16 +10 987" "%D %d %D %d" a b c d
- X set c
- X} 10
- Xtest scan-1.14 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-45 16 +10 987" "%D %d %D %d" a b c d
- X set d
- X} 987
- Xtest scan-1.15 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "14 1ab 62 10" "%d %x %O %x" a b c d
- X} 4
- Xtest scan-1.16 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "14 1ab 62 10" "%d %x %O %x" a b c d
- X set a
- X} 14
- Xtest scan-1.17 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "14 1ab 62 10" "%d %x %O %x" a b c d
- X set b
- X} 427
- Xtest scan-1.18 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "14 1ab 62 10" "%d %x %O %x" a b c d
- X set c
- X} 50
- Xtest scan-1.19 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "14 1ab 62 10" "%d %x %O %x" a b c d
- X set d
- X} 16
- Xtest scan-1.20 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345670 1234567890ab cdefg" "%o %o %x %X" a b c d
- X} 4
- Xtest scan-1.21 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345670 1234567890ab cdefg" "%o %o %x %X" a b c d
- X set a
- X} 2739128
- Xtest scan-1.22 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345670 1234567890ab cdefg" "%o %o %x %X" a b c d
- X set b
- X} 342391
- Xtest scan-1.23 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345670 1234567890ab cdefg" "%o %o %x %X" a b c d
- X set c
- X} 561323
- Xtest scan-1.24 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345670 1234567890ab cdefg" "%o %o %x %X" a b c d
- X set d
- X} 52719
- Xtest scan-1.25 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "ab123-24642" "%2x %3x %3o %2o" a b c d
- X} 4
- Xtest scan-1.26 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "ab123-24642" "%2x %3x %3o %2o" a b c d
- X set a
- X} 171
- Xtest scan-1.27 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "ab123-24642" "%2x %3x %3o %2o" a b c d
- X set b
- X} 291
- Xtest scan-1.28 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "ab123-24642" "%2x %3x %3o %2o" a b c d
- X set c
- X} -20
- Xtest scan-1.29 {integer scanning} {
- X set a {}; set b {}
- X scan "ab123-24642" "%2x %3x %3o %2o" a b c d
- X set d
- X} 52
- Xtest scan-1.30 {integer scanning} {
- X set a {}; set b {}
- X scan "1234567 234 567 " "%*3x %x %*o %4o" a b
- X} 2
- Xtest scan-1.31 {integer scanning} {
- X set a {}; set b {}
- X scan "1234567 234 567 " "%*3x %x %*o %4o" a b
- X set a
- X} 17767
- Xtest scan-1.32 {integer scanning} {
- X set a {}; set b {}
- X scan "a 1234" "%d %d" a b
- X} 0
- Xtest scan-1.33 {integer scanning} {
- X set a {}
- X scan "a 1234" "%d %d" a b
- X set a
- X} {}
- Xtest scan-1.34 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {};
- X scan "12345678" "%2d %2d %2d %2d" a b c d
- X} 4
- Xtest scan-1.35 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {};
- X scan "12345678" "%2d %2d %2d %2d" a b c d
- X set a
- X} 12
- Xtest scan-1.36 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345678" "%2d %2d %2d %2d" a b c d
- X set b
- X} 34
- Xtest scan-1.37 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345678" "%2d %2d %2d %2d" a b c d
- X set c
- X} 56
- Xtest scan-1.38 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "12345678" "%2d %2d %2d %2d" a b c d
- X set d
- X} 78
- Xtest scan-1.39 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2 " "%d %d %d %d" a b c d
- X} 2
- Xtest scan-1.40 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2 " "%d %d %d %d" a b c d
- X set a
- X} 1
- Xtest scan-1.41 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2 " "%d %d %d %d" a b c d
- X set b
- X} 2
- Xtest scan-1.42 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2 " "%d %d %d %d" a b c d
- X} 2
- Xtest scan-1.43 {integer scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2 " "%d %d %d %d" a b c d
- X set d
- X} {}
- X
- Xtest scan-2.1 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "2.1 -3.0e8 .99962 a" "%f%f%f%f" a b c d
- X} 3
- Xtest scan-2.2 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "2.1 -3.0e8 .99962 a" "%f%f%f%f" a b c d
- X set a
- X} 2.1
- Xtest scan-2.3 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "2.1 -3.0e8 .99962 a" "%f%f%f%f" a b c d
- X set b
- X} -3e+08
- Xtest scan-2.4 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "2.1 -3.0e8 .99962 a" "%f%f%f%f" a b c d
- X set c
- X} 0.99962
- Xtest scan-2.5 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "2.1 -3.0e8 .99962 a" "%f%f%f%f" a b c d
- X set d
- X} {}
- Xtest scan-2.6 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-1.2345 +8.2 9" "%3e %3f %f %f" a b c d
- X} 4
- Xtest scan-2.7 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-1.2345 +8.2 9" "%3e %3f %f %f" a b c d
- X set a
- X} -1
- Xtest scan-2.8 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-1.2345 +8.2 9" "%3e %3f %f %f" a b c d
- X set b
- X} 234
- Xtest scan-2.9 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-1.2345 +8.2 9" "%3e %3f %f %f" a b c d
- X set c
- X} 5
- Xtest scan-2.10 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "-1.2345 +8.2 9" "%3e %3f %f %f" a b c d
- X set d
- X} 8.2
- Xtest scan-2.11 {floating-point scanning} {
- X set a {}; set b {}; set c {}
- X scan "1e00004 332E-4 3e+4" "%f %*2e %f %f" a b c
- X} 3
- Xtest scan-2.12 {floating-point scanning} {
- X set a {}; set b {}; set c {}
- X scan "1e00004 332E-4 3e+4" "%f %*2e %f %f" a b c
- X set a
- X} 10000
- Xtest scan-2.13 {floating-point scanning} {
- X set a {}; set b {}; set c {}
- X scan "1e00004 332E-4 3e+4" "%f %*2e %f %f" a b c
- X set c
- X} 30000
- Xtest scan-2.14 {floating-point scanning} {
- X set a {}; set b {}; set c {}
- X scan "1. 47.6 2.e2 3.e-" "%f %*f %f %f" a b c
- X} 3
- Xtest scan-2.15 {floating-point scanning} {
- X set a {}; set b {}; set c {}
- X scan "1. 47.6 2.e2 3.e-" "%f %*f %f %f" a b c
- X set a
- X} 1
- Xtest scan-2.16 {floating-point scanning} {
- X set a {}; set b {}; set c {}
- X scan "1. 47.6 2.e2 3.e-" "%f %*f %f %f" a b c
- X set b
- X} 200
- Xtest scan-2.17 {floating-point scanning} {
- X set a {}; set b {}; set c {}
- X scan "1. 47.6 2.e2 3.e-" "%f %*f %f %f" a b c
- X set c
- X} 3
- Xtest scan-2.18 {floating-point scanning} {
- X set a {}; set b {}
- X scan "1.eabc" "%f %x" a b
- X} 2
- Xtest scan-2.19 {floating-point scanning} {
- X set a {}; set b {}
- X scan "1.eabc" "%f %x" a b
- X set a
- X} 1
- Xtest scan-2.20 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d
- X} 4
- Xtest scan-2.21 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d
- X set a
- X} 4.6
- Xtest scan-2.22 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d
- X set b
- X} 99999.7
- Xtest scan-2.23 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d
- X set c
- X} 87.643
- Xtest scan-2.24 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d
- X set d
- X} 118
- Xtest scan-2.25 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1.2345 697.0e-3 124 .00005" "%f %e %f %e" a b c d
- X} 4
- Xtest scan-2.26 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1.2345 697.0e-3 124 .00005" "%f %e %f %e" a b c d
- X set a
- X} 1.2345
- Xtest scan-2.27 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1.2345 697.0e-3 124 .00005" "%f %e %f %e" a b c d
- X set b
- X} 0.697
- Xtest scan-2.28 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1.2345 697.0e-3 124 .00005" "%f %e %f %e" a b c d
- X set c
- X} 124
- Xtest scan-2.29 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1.2345 697.0e-3 124 .00005" "%f %e %f %e" a b c d
- X set d
- X} 5e-05
- Xtest scan-2.30 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6abc" "%f %f %f %f" a b c d
- X} 1
- Xtest scan-2.31 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6abc" "%f %f %f %f" a b c d
- X set a
- X} 4.6
- Xtest scan-2.32 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6abc" "%f %f %f %f" a b c d
- X set b
- X} {}
- Xtest scan-2.33 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6abc" "%f %f %f %f" a b c d
- X set c
- X} {}
- Xtest scan-2.34 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6abc" "%f %f %f %f" a b c d
- X set d
- X} {}
- Xtest scan-2.35 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 5.2" "%f %f %f %f" a b c d
- X} 2
- Xtest scan-2.36 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 5.2" "%f %f %f %f" a b c d
- X set a
- X} 4.6
- Xtest scan-2.37 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 5.2" "%f %f %f %f" a b c d
- X set b
- X} 5.2
- Xtest scan-2.38 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 5.2" "%f %f %f %f" a b c d
- X set c
- X} {}
- Xtest scan-2.39 {floating-point scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "4.6 5.2" "%f %f %f %f" a b c d
- X set d
- X} {}
- X
- Xtest scan-3.1 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "abc defghijk dum " "%s %3s %20s %s" a b c d
- X} 4
- Xtest scan-3.2 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "abc defghijk dum " "%s %3s %20s %s" a b c d
- X set a
- X} abc
- Xtest scan-3.3 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "abc defghijk dum " "%s %3s %20s %s" a b c d
- X set b
- X} def
- Xtest scan-3.4 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "abc defghijk dum " "%s %3s %20s %s" a b c d
- X set c
- X} ghijk
- Xtest scan-3.5 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "abc defghijk dum " "%s %3s %20s %s" a b c d
- X set d
- X} dum
- Xtest scan-3.6 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "a bcdef" "%c%c%1s %s" a b c d
- X} 4
- Xtest scan-3.7 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "a bcdef" "%c%c%1s %s" a b c d
- X set a
- X} 97
- Xtest scan-3.8 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "a bcdef" "%c%c%1s %s" a b c d
- X set b
- X} 32
- Xtest scan-3.9 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "a bcdef" "%c%c%1s %s" a b c d
- X set c
- X} b
- Xtest scan-3.10 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "a bcdef" "%c%c%1s %s" a b c d
- X set d
- X} cdef
- Xtest scan-3.11 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "123456 test " "%*c%*s %s %s %s" a b c
- X} 1
- Xtest scan-3.12 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "123456 test " "%*c%*s %s %s %s" a b c
- X set a
- X} test
- Xtest scan-3.13 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "123456 test " "%*c%*s %s %s %s" a b c
- X set b
- X} {}
- Xtest scan-3.14 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "123456 test " "%*c%*s %s %s %s" a b c
- X set c
- X} {}
- Xtest scan-3.15 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d
- X scan "ababcd01234 f 123450" {%4[abcd] %4[abcd] %[^abcdef] %[^0]} a b c d
- X} 4
- Xtest scan-3.16 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d
- X scan "ababcd01234 f 123450" {%4[abcd] %4[abcd] %[^abcdef] %[^0]} a b c d
- X set a
- X} abab
- Xtest scan-3.17 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d
- X scan "ababcd01234 f 123450" {%4[abcd] %4[abcd] %[^abcdef] %[^0]} a b c d
- X set b
- X} cd
- Xtest scan-3.18 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d
- X scan "ababcd01234 f 123450" {%4[abcd] %4[abcd] %[^abcdef] %[^0]} a b c d
- X set c
- X} {01234 }
- Xtest scan-3.19 {string and character scanning} {
- X set a {}; set b {}; set c {}; set d
- X scan "ababcd01234 f 123450" {%4[abcd] %4[abcd] %[^abcdef] %[^0]} a b c d
- X set d
- X} {f 12345}
- Xtest scan-3.20 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "aaaaaabc aaabcdefg + + XYZQR" {%*4[a] %s %*4[a]%s%*4[ +]%c} a b c
- X} 3
- Xtest scan-3.21 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "aaaaaabc aaabcdefg + + XYZQR" {%*4[a] %s %*4[a]%s%*4[ +]%c} a b c
- X set a
- X} aabc
- Xtest scan-3.22 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "aaaaaabc aaabcdefg + + XYZQR" {%*4[a] %s %*4[a]%s%*4[ +]%c} a b c
- X set b
- X} bcdefg
- Xtest scan-3.23 {string and character scanning} {
- X set a {}; set b {}; set c {}
- X scan "aaaaaabc aaabcdefg + + XYZQR" {%*4[a] %s %*4[a]%s%*4[ +]%c} a b c
- X set c
- X} 43
- X
- Xtest scan-4.1 {error conditions} {
- X catch {scan a}
- X} 1
- Xtest scan-4.2 {error conditions} {
- X catch {scan a} msg
- X set msg
- X} {wrong # args: should be "scan string format ?varName varName ...?"}
- Xtest scan-4.3 {error conditions} {
- X catch {scan "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21" \
- X"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" \
- Xa1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21}
- X} 1
- Xtest scan-4.4 {error conditions} {
- X catch {scan "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21" \
- X"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" \
- Xa1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21} msg
- X set msg
- X} {too many fields to scan}
- Xtest scan-4.5 {error conditions} {
- X catch {scan a %z}
- X} 1
- Xtest scan-4.6 {error conditions} {
- X catch {scan a %z} msg
- X set msg
- X} {bad scan conversion character "z"}
- Xtest scan-4.7 {error conditions} {
- X catch {scan a "%d %d" a}
- X} 1
- Xtest scan-4.8 {error conditions} {
- X catch {scan a "%d %d" a} msg
- X set msg
- X} {different numbers of variable names and field specifiers}
- Xtest scan-4.9 {error conditions} {
- X catch {scan a "%d %d" a b c}
- X} 1
- Xtest scan-4.10 {error conditions} {
- X catch {scan a "%d %d" a b c} msg
- X set msg
- X} {different numbers of variable names and field specifiers}
- Xtest scan-4.11 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X expr {[scan " a" " a %d %d %d %d" a b c d] <= 0}
- X} 1
- Xtest scan-4.12 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan " a" " a %d %d %d %d" a b c d
- X set a
- X} {}
- Xtest scan-4.13 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan " a" " a %d %d %d %d" a b c d
- X set b
- X} {}
- Xtest scan-4.14 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan " a" " a %d %d %d %d" a b c d
- X set c
- X} {}
- Xtest scan-4.15 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan " a" " a %d %d %d %d" a b c d
- X set d
- X} {}
- Xtest scan-4.16 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2" "%d %d %d %d" a b c d
- X} 2
- Xtest scan-4.17 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2" "%d %d %d %d" a b c d
- X set a
- X} 1
- Xtest scan-4.18 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2" "%d %d %d %d" a b c d
- X set b
- X} 2
- Xtest scan-4.19 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2" "%d %d %d %d" a b c d
- X set c
- X} {}
- Xtest scan-4.20 {error conditions} {
- X set a {}; set b {}; set c {}; set d {}
- X scan "1 2" "%d %d %d %d" a b c d
- X set d
- X} {}
- Xtest scan-4.21 {error conditions} {
- X catch {unset a}
- X set a(0) 44
- X list [catch {scan 44 %d a} msg] $msg
- X} {1 {couldn't set variable "a"}}
- Xtest scan-4.22 {error conditions} {
- X catch {unset a}
- X set a(0) 44
- X list [catch {scan 44 %c a} msg] $msg
- X} {1 {couldn't set variable "a"}}
- Xtest scan-4.23 {error conditions} {
- X catch {unset a}
- X set a(0) 44
- X list [catch {scan 44 %s a} msg] $msg
- X} {1 {couldn't set variable "a"}}
- Xtest scan-4.24 {error conditions} {
- X catch {unset a}
- X set a(0) 44
- X list [catch {scan 44 %f a} msg] $msg
- X} {1 {couldn't set variable "a"}}
- Xtest scan-4.25 {error conditions} {
- X catch {unset a}
- X set a(0) 44
- X list [catch {scan 44 %f a} msg] $msg
- X} {1 {couldn't set variable "a"}}
- Xcatch {unset a}
- Xtest scan-4.26 {error conditions} {
- X list [catch {scan 44 %2c a} msg] $msg
- X} {1 {field width may not be specified in %c conversion}}
- X
- Xtest scan-5.1 {lots of arguments} {
- X scan "10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 \
- X200" "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" a1 a2 a3 \
- Xa4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20
- X} 20
- Xtest scan-5.2 {lots of arguments} {
- X scan "10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 \
- X200" "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" a1 a2 a3 \
- Xa4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20
- X set a20
- X} 200
- END_OF_FILE
- if test 20188 -ne `wc -c <'tcl6.1/tests/scan.test'`; then
- echo shar: \"'tcl6.1/tests/scan.test'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/tests/scan.test'
- fi
- if test -f 'tcl6.1/tests/trace.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/tests/trace.test'\"
- else
- echo shar: Extracting \"'tcl6.1/tests/trace.test'\" \(20398 characters\)
- sed "s/^X//" >'tcl6.1/tests/trace.test' <<'END_OF_FILE'
- X# Commands covered: trace
- X#
- X# This file contains a collection of tests for one or more of the Tcl
- X# built-in commands. Sourcing this file into Tcl runs the tests and
- X# generates output for errors. No output means no errors were found.
- X#
- X# Copyright 1991 Regents of the University of California
- X# Permission to use, copy, modify, and distribute this
- X# software and its documentation for any purpose and without
- X# fee is hereby granted, provided that this copyright notice
- X# appears in all copies. The University of California makes no
- X# representations about the suitability of this software for any
- X# purpose. It is provided "as is" without express or implied
- X# warranty.
- X#
- X# $Header: /user6/ouster/tcl/tests/RCS/trace.test,v 1.11 91/10/31 16:40:51 ouster Exp $ (Berkeley)
- X
- Xif {[string compare test [info procs test]] == 1} then {source defs}
- X
- Xproc traceScalar {name1 name2 op} {
- X global info
- X set info [list $name1 $name2 $op [catch {uplevel set $name1} msg] $msg]
- X}
- Xproc traceArray {name1 name2 op} {
- X global info
- X set info [list $name1 $name2 $op [catch {uplevel set [set name1]($name2)} msg] $msg]
- X}
- Xproc traceProc {name1 name2 op} {
- X global info
- X set info [concat $info [list $name1 $name2 $op]]
- X}
- Xproc traceTag {tag args} {
- X global info
- X set info [concat $info $tag]
- X}
- Xproc traceError {args} {
- X error error
- X}
- Xproc traceCheck {cmd args} {
- X global info
- X set info [list [catch $cmd msg] $msg]
- X}
- X
- X# Read-tracing on variables
- X
- Xtest trace-1.1 {trace variable reads} {
- X catch {unset x}
- X set info {}
- X trace var x r traceScalar
- X list [catch {set x} msg] $msg $info
- X} {1 {can't read "x": no such variable} {x {} r 1 {can't read "x": no such variable}}}
- Xtest trace-1.2 {trace variable reads} {
- X catch {unset x}
- X set x 123
- X set info {}
- X trace var x r traceScalar
- X list [catch {set x} msg] $msg $info
- X} {0 123 {x {} r 0 123}}
- Xtest trace-1.3 {trace variable reads} {
- X catch {unset x}
- X set info {}
- X trace var x r traceScalar
- X set x 123
- X set info
- X} {}
- Xtest trace-1.4 {trace array element reads} {
- X catch {unset x}
- X set info {}
- X trace var x(2) r traceArray
- X list [catch {set x(2)} msg] $msg $info
- X} {1 {can't read "x(2)": no such variable} {x 2 r 1 {can't read "x(2)": no such variable}}}
- Xtest trace-1.5 {trace array element reads} {
- X catch {unset x}
- X set x(2) zzz
- X set info {}
- X trace var x(2) r traceArray
- X list [catch {set x(2)} msg] $msg $info
- X} {0 zzz {x 2 r 0 zzz}}
- Xtest trace-1.6 {trace reads on whole arrays} {
- X catch {unset x}
- X set info {}
- X trace var x r traceArray
- X list [catch {set x(2)} msg] $msg $info
- X} {1 {can't read "x(2)": no such variable} {}}
- Xtest trace-1.7 {trace reads on whole arrays} {
- X catch {unset x}
- X set x(2) zzz
- X set info {}
- X trace var x r traceArray
- X list [catch {set x(2)} msg] $msg $info
- X} {0 zzz {x 2 r 0 zzz}}
- Xtest trace-1.8 {trace variable reads} {
- X catch {unset x}
- X set x 444
- X set info {}
- X trace var x r traceScalar
- X unset x
- X set info
- X} {}
- X
- X# Basic write-tracing on variables
- X
- Xtest trace-2.1 {trace variable writes} {
- X catch {unset x}
- X set info {}
- X trace var x w traceScalar
- X set x 123
- X set info
- X} {x {} w 0 123}
- Xtest trace-2.2 {trace writes to array elements} {
- X catch {unset x}
- X set info {}
- X trace var x(33) w traceArray
- X set x(33) 444
- X set info
- X} {x 33 w 0 444}
- Xtest trace-2.3 {trace writes on whole arrays} {
- X catch {unset x}
- X set info {}
- X trace var x w traceArray
- X set x(abc) qq
- X set info
- X} {x abc w 0 qq}
- Xtest trace-2.4 {trace variable writes} {
- X catch {unset x}
- X set x 1234
- X set info {}
- X trace var x w traceScalar
- X set x
- X set info
- X} {}
- Xtest trace-2.5 {trace variable writes} {
- X catch {unset x}
- X set x 1234
- X set info {}
- X trace var x w traceScalar
- X unset x
- X set info
- X} {}
- X
- X# Basic unset-tracing on variables
- X
- Xtest trace-3.1 {trace variable unsets} {
- X catch {unset x}
- X set info {}
- X trace var x u traceScalar
- X catch {unset x}
- X set info
- X} {x {} u 1 {can't read "x": no such variable}}
- Xtest trace-3.2 {variable mustn't exist during unset trace} {
- X catch {unset x}
- X set x 1234
- X set info {}
- X trace var x u traceScalar
- X unset x
- X set info
- X} {x {} u 1 {can't read "x": no such variable}}
- Xtest trace-3.3 {unset traces mustn't be called during reads and writes} {
- X catch {unset x}
- X set info {}
- X trace var x u traceScalar
- X set x 44
- X set x
- X set info
- X} {}
- Xtest trace-3.4 {trace unsets on array elements} {
- X catch {unset x}
- X set x(0) 18
- X set info {}
- X trace var x(1) u traceArray
- X catch {unset x(1)}
- X set info
- X} {x 1 u 1 {can't read "x(1)": no such element in array}}
- Xtest trace-3.5 {trace unsets on array elements} {
- X catch {unset x}
- X set x(1) 18
- X set info {}
- X trace var x(1) u traceArray
- X unset x(1)
- X set info
- X} {x 1 u 1 {can't read "x(1)": no such element in array}}
- Xtest trace-3.6 {trace unsets on array elements} {
- X catch {unset x}
- X set x(1) 18
- X set info {}
- X trace var x(1) u traceArray
- X unset x
- X set info
- X} {x 1 u 1 {can't read "x(1)": no such variable}}
- Xtest trace-3.7 {trace unsets on whole arrays} {
- X catch {unset x}
- X set x(1) 18
- X set info {}
- X trace var x u traceProc
- X catch {unset x(0)}
- X set info
- X} {}
- Xtest trace-3.8 {trace unsets on whole arrays} {
- X catch {unset x}
- X set x(1) 18
- X set info {}
- X trace var x u traceProc
- X unset x(1)
- X set info
- X} {x 1 u}
- Xtest trace-3.9 {trace unsets on whole arrays} {
- X catch {unset x}
- X set x(1) 18
- X set info {}
- X trace var x u traceProc
- X unset x
- X set info
- X} {x {} u}
- X
- X# Trace multiple trace types at once.
- X
- Xtest trace-4.1 {multiple ops traced at once} {
- X catch {unset x}
- X set info {}
- X trace var x rwu traceProc
- X catch {set x}
- X set x 22
- X set x
- X set x 33
- X unset x
- X set info
- X} {x {} r x {} w x {} r x {} w x {} u}
- Xtest trace-4.2 {multiple ops traced on array element} {
- X catch {unset x}
- X set info {}
- X trace var x(0) rwu traceProc
- X catch {set x(0)}
- X set x(0) 22
- X set x(0)
- X set x(0) 33
- X unset x(0)
- X unset x
- X set info
- X} {x 0 r x 0 w x 0 r x 0 w x 0 u}
- Xtest trace-4.3 {multiple ops traced on whole array} {
- X catch {unset x}
- X set info {}
- X trace var x rwu traceProc
- X catch {set x(0)}
- X set x(0) 22
- X set x(0)
- X set x(0) 33
- X unset x(0)
- X unset x
- X set info
- X} {x 0 w x 0 r x 0 w x 0 u x {} u}
- X
- X# Check order of invocation of traces
- X
- Xtest trace-5.1 {order of invocation of traces} {
- X catch {unset x}
- X set info {}
- X trace var x r "traceTag 1"
- X trace var x r "traceTag 2"
- X trace var x r "traceTag 3"
- X catch {set x}
- X set x 22
- X set x
- X set info
- X} {3 2 1 3 2 1}
- Xtest trace-5.2 {order of invocation of traces} {
- X catch {unset x}
- X set x(0) 44
- X set info {}
- X trace var x(0) r "traceTag 1"
- X trace var x(0) r "traceTag 2"
- X trace var x(0) r "traceTag 3"
- X set x(0)
- X set info
- X} {3 2 1}
- Xtest trace-5.3 {order of invocation of traces} {
- X catch {unset x}
- X set x(0) 44
- X set info {}
- X trace var x(0) r "traceTag 1"
- X trace var x r "traceTag A1"
- X trace var x(0) r "traceTag 2"
- X trace var x r "traceTag A2"
- X trace var x(0) r "traceTag 3"
- X trace var x r "traceTag A3"
- X set x(0)
- X set info
- X} {A3 A2 A1 3 2 1}
- X
- X# Check effects of errors in trace procedures
- X
- Xtest trace-6.1 {error returns from traces} {
- X catch {unset x}
- X set x 123
- X set info {}
- X trace var x r "traceTag 1"
- X trace var x r error
- X list [catch {set x} msg] $msg $info
- X} {1 {can't read "x": access disallowed by trace command} {}}
- Xtest trace-6.2 {error returns from traces} {
- X catch {unset x}
- X set x 123
- X set info {}
- X trace var x w "traceTag 1"
- X trace var x w error
- X list [catch {set x 44} msg] $msg $info
- X} {1 {can't set "x": access disallowed by trace command} {}}
- Xtest trace-6.3 {error returns from traces} {
- X catch {unset x}
- X set x 123
- X set info {}
- X trace var x u "traceTag 1"
- X trace var x u error
- X list [catch {unset x} msg] $msg $info
- X} {0 {} 1}
- Xtest trace-6.4 {error returns from traces} {
- X catch {unset x}
- X set x(0) 123
- X set info {}
- X trace var x(0) r "traceTag 1"
- X trace var x r "traceTag 2"
- X trace var x r error
- X trace var x r "traceTag 3"
- X list [catch {set x(0)} msg] $msg $info
- X} {1 {can't read "x(0)": access disallowed by trace command} 3}
- X
- X# Check to see that variables are expunged before trace
- X# procedures are invoked, so trace procedure can even manipulate
- X# a new copy of the variables.
- X
- Xtest trace-7.1 {be sure variable is unset before trace is called} {
- X catch {unset x}
- X set x 33
- X set info {}
- X trace var x u {traceCheck {uplevel set x}}
- X unset x
- X set info
- X} {1 {can't read "x": no such variable}}
- Xtest trace-7.2 {be sure variable is unset before trace is called} {
- X catch {unset x}
- X set x 33
- X set info {}
- X trace var x u {traceCheck {uplevel set x 22}}
- X unset x
- X concat $info [list [catch {set x} msg] $msg]
- X} {0 22 0 22}
- Xtest trace-7.3 {be sure traces are cleared before unset trace called} {
- X catch {unset x}
- X set x 33
- X set info {}
- X trace var x u {traceCheck {uplevel trace vinfo x}}
- X unset x
- X set info
- X} {0 {}}
- Xtest trace-7.4 {set new trace during unset trace} {
- X catch {unset x}
- X set x 33
- X set info {}
- X trace var x u {traceCheck {global x; trace var x u traceProc}}
- X unset x
- X concat $info [trace vinfo x]
- X} {0 {} {u traceProc}}
- X
- Xtest trace-8.1 {make sure array elements are unset before traces are called} {
- X catch {unset x}
- X set x(0) 33
- X set info {}
- X trace var x(0) u {traceCheck {uplevel set x(0)}}
- X unset x(0)
- X set info
- X} {1 {can't read "x(0)": no such element in array}}
- Xtest trace-8.2 {make sure array elements are unset before traces are called} {
- X catch {unset x}
- X set x(0) 33
- X set info {}
- X trace var x(0) u {traceCheck {uplevel set x(0) zzz}}
- X unset x(0)
- X concat $info [list [catch {set x(0)} msg] $msg]
- X} {0 zzz 0 zzz}
- Xtest trace-8.3 {array elements are unset before traces are called} {
- X catch {unset x}
- X set x(0) 33
- X set info {}
- X trace var x(0) u {traceCheck {global x; trace vinfo x(0)}}
- X unset x(0)
- X set info
- X} {0 {}}
- Xtest trace-8.4 {set new array element trace during unset trace} {
- X catch {unset x}
- X set x(0) 33
- X set info {}
- X trace var x(0) u {traceCheck {uplevel {trace variable x(0) r {}}}}
- X catch {unset x(0)}
- X concat $info [trace vinfo x(0)]
- X} {0 {} {r {}}}
- X
- Xtest trace-9.1 {make sure arrays are unset before traces are called} {
- X catch {unset x}
- X set x(0) 33
- X set info {}
- X trace var x u {traceCheck {uplevel set x(0)}}
- X unset x
- X set info
- X} {1 {can't read "x(0)": no such variable}}
- Xtest trace-9.2 {make sure arrays are unset before traces are called} {
- X catch {unset x}
- X set x(y) 33
- X set info {}
- X trace var x u {traceCheck {uplevel set x(y) 22}}
- X unset x
- X concat $info [list [catch {set x(y)} msg] $msg]
- X} {0 22 0 22}
- Xtest trace-9.3 {make sure arrays are unset before traces are called} {
- X catch {unset x}
- X set x(y) 33
- X set info {}
- X trace var x u {traceCheck {uplevel array names x}}
- X unset x
- X set info
- X} {1 {"x" isn't an array}}
- Xtest trace-9.4 {make sure arrays are unset before traces are called} {
- X catch {unset x}
- X set x(y) 33
- X set info {}
- X set cmd {traceCheck {uplevel {trace vinfo x}}}
- X trace var x u $cmd
- X unset x
- X set info
- X} {0 {}}
- Xtest trace-9.5 {set new array trace during unset trace} {
- X catch {unset x}
- X set x(y) 33
- X set info {}
- X trace var x u {traceCheck {global x; trace var x r {}}}
- X unset x
- X concat $info [trace vinfo x]
- X} {0 {} {r {}}}
- Xtest trace-9.6 {create scalar during array unset trace} {
- X catch {unset x}
- X set x(y) 33
- X set info {}
- X trace var x u {traceCheck {global x; set x 44}}
- X unset x
- X concat $info [list [catch {set x} msg] $msg]
- X} {0 44 0 44}
- X
- X# Check special conditions (e.g. errors) in Tcl_TraceVar2.
- X
- Xtest trace-10.1 {creating array when setting variable traces} {
- X catch {unset x}
- X set info {}
- X trace var x(0) w traceProc
- X list [catch {set x 22} msg] $msg
- X} {1 {can't set "x": variable is array}}
- Xtest trace-10.2 {creating array when setting variable traces} {
- X catch {unset x}
- X set info {}
- X trace var x(0) w traceProc
- X list [catch {set x(0)} msg] $msg
- X} {1 {can't read "x(0)": no such variable}}
- Xtest trace-10.3 {creating array when setting variable traces} {
- X catch {unset x}
- X set info {}
- X trace var x(0) w traceProc
- X set x(0) 22
- X set info
- X} {x 0 w}
- Xtest trace-10.4 {creating variable when setting variable traces} {
- X catch {unset x}
- X set info {}
- X trace var x w traceProc
- X list [catch {set x} msg] $msg
- X} {1 {can't read "x": no such variable}}
- Xtest trace-10.5 {creating variable when setting variable traces} {
- X catch {unset x}
- X set info {}
- X trace var x w traceProc
- X set x 22
- X set info
- X} {x {} w}
- Xtest trace-10.6 {creating variable when setting variable traces} {
- X catch {unset x}
- X set info {}
- X trace var x w traceProc
- X set x(0) 22
- X set info
- X} {x 0 w}
- Xtest trace-10.7 {errors when setting variable traces} {
- X catch {unset x}
- X set x 44
- X list [catch {trace var x(0) w traceProc} msg] $msg
- X} {1 {variable isn't array}}
- X
- X# Check deleting one trace from another.
- X
- Xtest trace-11.1 {delete one trace from another} {
- X proc delTraces {args} {
- X global x
- X trace vdel x r {traceTag 2}
- X trace vdel x r {traceTag 3}
- X trace vdel x r {traceTag 4}
- X }
- X catch {unset x}
- X set x 44
- X set info {}
- X trace var x r {traceTag 1}
- X trace var x r {traceTag 2}
- X trace var x r {traceTag 3}
- X trace var x r {traceTag 4}
- X trace var x r delTraces
- X trace var x r {traceTag 5}
- X set x
- X set info
- X} {5 1}
- X
- X# Check operation and syntax of "trace" command.
- X
- Xtest trace-12.1 {trace command (overall)} {
- X list [catch {trace} msg] $msg
- X} {1 {too few args: should be "trace option [arg arg ...]"}}
- Xtest trace-12.2 {trace command (overall)} {
- X list [catch {trace gorp} msg] $msg
- X} {1 {bad option "gorp": should be variable, vdelete, or vinfo}}
- Xtest trace-12.3 {trace command ("variable" option)} {
- X list [catch {trace variable x y} msg] $msg
- X} {1 {wrong # args: should be "trace variable name ops command"}}
- Xtest trace-12.4 {trace command ("variable" option)} {
- X list [catch {trace var x y z z2} msg] $msg
- X} {1 {wrong # args: should be "trace variable name ops command"}}
- Xtest trace-12.5 {trace command ("variable" option)} {
- X list [catch {trace var x y z} msg] $msg
- X} {1 {bad operations "y": should be one or more of rwu}}
- Xtest trace-12.6 {trace command ("vdelete" option)} {
- X list [catch {trace vdelete x y} msg] $msg
- X} {1 {wrong # args: should be "trace vdelete name ops command"}}
- Xtest trace-12.7 {trace command ("vdelete" option)} {
- X list [catch {trace vdelete x y z foo} msg] $msg
- X} {1 {wrong # args: should be "trace vdelete name ops command"}}
- Xtest trace-12.8 {trace command ("vdelete" option)} {
- X list [catch {trace vdelete x y z} msg] $msg
- X} {1 {bad operations "y": should be one or more of rwu}}
- Xtest trace-12.9 {trace command ("vdelete" option)} {
- X catch {unset x}
- X set info {}
- X trace var x w traceProc
- X trace vdelete x w traceProc
- X} {}
- Xtest trace-12.10 {trace command ("vdelete" option)} {
- X catch {unset x}
- X set info {}
- X trace var x w traceProc
- X trace vdelete x w traceProc
- X set x 12345
- X set info
- X} {}
- Xtest trace-12.11 {trace command ("vdelete" option)} {
- X catch {unset x}
- X set info {}
- X trace var x w {traceTag 1}
- X trace var x w traceProc
- X trace var x w {traceTag 2}
- X set x yy
- X trace vdelete x w traceProc
- X set x 12345
- X trace vdelete x w {traceTag 1}
- X set x foo
- X trace vdelete x w {traceTag 2}
- X set x gorp
- X set info
- X} {2 x {} w 1 2 1 2}
- Xtest trace-12.12 {trace command ("vdelete" option)} {
- X catch {unset x}
- X set info {}
- X trace var x w {traceTag 1}
- X trace vdelete x w non_existent
- X set x 12345
- X set info
- X} {1}
- Xtest trace-12.13 {trace command ("vinfo" option)} {
- X list [catch {trace vinfo} msg] $msg]
- X} {1 {wrong # args: should be "trace vinfo name"]}}
- Xtest trace-12.14 {trace command ("vinfo" option)} {
- X list [catch {trace vinfo x y} msg] $msg]
- X} {1 {wrong # args: should be "trace vinfo name"]}}
- Xtest trace-12.15 {trace command ("vinfo" option)} {
- X catch {unset x}
- X trace var x w {traceTag 1}
- X trace var x w traceProc
- X trace var x w {traceTag 2}
- X trace vinfo x
- X} {{w {traceTag 2}} {w traceProc} {w {traceTag 1}}}
- Xtest trace-12.16 {trace command ("vinfo" option)} {
- X catch {unset x}
- X trace vinfo x
- X} {}
- Xtest trace-12.17 {trace command ("vinfo" option)} {
- X catch {unset x}
- X trace vinfo x(0)
- X} {}
- Xtest trace-12.18 {trace command ("vinfo" option)} {
- X catch {unset x}
- X set x 44
- X trace vinfo x(0)
- X} {}
- Xtest trace-12.19 {trace command ("vinfo" option)} {
- X catch {unset x}
- X set x 44
- X trace var x w {traceTag 1}
- X proc check {} {global x; trace vinfo x}
- X check
- X} {{w {traceTag 1}}}
- X
- X# Check fancy trace commands (long ones, weird arguments, etc.)
- X
- Xtest trace-13.1 {long trace command} {
- X catch {unset x}
- X set info {}
- X trace var x w {traceTag {This is a very very long argument. It's \
- X designed to test out the facilities of TraceVarProc for dealing \
- X with such long arguments by malloc-ing space. One possibility \
- X is that space doesn't get freed properly. If this happens, then \
- X invoking this test over and over again will eventually leak memory.}}
- X set x 44
- X set info
- X} {This is a very very long argument. It's \
- X designed to test out the facilities of TraceVarProc for dealing \
- X with such long arguments by malloc-ing space. One possibility \
- X is that space doesn't get freed properly. If this happens, then \
- X invoking this test over and over again will eventually leak memory.}
- Xtest trace-13.2 {long trace command result to ignore} {
- X proc longResult {args} {return "quite a bit of text, designed to
- X generate a core leak if this command file is invoked over and over again
- X and memory isn't being recycled correctly"}
- X catch {unset x}
- X trace var x w longResult
- X set x 44
- X set x 5
- X set x abcde
- X} abcde
- Xtest trace-13.3 {special list-handling in trace commands} {
- X catch {unset "x y z"}
- X set "x y z(a\n\{)" 44
- X set info {}
- X trace var "x y z(a\n\{)" w traceProc
- X set "x y z(a\n\{)" 33
- X set info
- X} "{x y z} a\\n\{ w"
- X
- X# Check for things that are illegal while a trace is active (such
- X# as deleting a variable).
- X
- Xtest trace-14.1 {unsets must be disallowed during traces} {
- X catch {unset x}
- X set x 123
- X set info {}
- X trace var x r {traceCheck {global x; unset x}}
- X set x
- X concat $info [list [catch {set x} msg] $msg]
- X} {1 {can't unset "x": trace is active on variable} 0 123}
- Xtest trace-14.2 {unsets must be disallowed during traces} {
- X catch {unset x}
- X set x 123
- X set info {}
- X trace var x r {traceCheck {uplevel {unset x}}}
- X set x
- X concat $info [list [catch {set x} msg] $msg]
- X} {1 {can't unset "x": trace is active on variable} 0 123}
- Xtest trace-14.3 {unsets must be disallowed during traces} {
- X catch {unset x}
- X set x(14) 123
- X set info {}
- X trace var x(14) r {traceCheck {uplevel {unset x}}}
- X set x(14)
- X concat $info [list [catch {set x(14)} msg] $msg]
- X} {1 {can't unset "x": trace is active on variable} 0 123}
- X
- X# Check various non-interference between traces and other things.
- X
- Xtest trace-15.1 {trace doesn't prevent unset errors} {
- X catch {unset x}
- X set info {}
- X trace var x u {traceProc}
- X list [catch {unset x} msg] $msg $info
- X} {1 {can't set "x": no such element in array} {x {} u}}
- Xtest trace-15.2 {traced variables must survive procedure exits} {
- X catch {unset x}
- X proc p1 {} {global x; trace var x w traceProc}
- X p1
- X trace vinfo x
- X} {{w traceProc}}
- Xtest trace-15.3 {traced variables must survive procedure exits} {
- X catch {unset x}
- X set info {}
- X proc p1 {} {global x; trace var x w traceProc}
- X p1
- X set x 44
- X set info
- X} {x {} w}
- X
- X# Be sure that procedure frames are released before unset traces
- X# are invoked.
- X
- Xtest trace-16.1 {unset traces on procedure returns} {
- X proc p1 {x y} {set a 44; p2 14}
- X proc p2 {z} {trace var z u {traceCheck {lsort [uplevel {info vars}]}}}
- X set info {}
- X p1 foo bar
- X set info
- X} {0 {a x y}}
- X
- X# Delete arrays when done, so they can be re-used as scalars
- X# elsewhere.
- X
- Xcatch {unset x}
- Xreturn ""
- END_OF_FILE
- if test 20398 -ne `wc -c <'tcl6.1/tests/trace.test'`; then
- echo shar: \"'tcl6.1/tests/trace.test'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/tests/trace.test'
- fi
- echo shar: End of archive 15 \(of 33\).
- cp /dev/null ark15isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 33 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-