diff options
author | stanton <stanton> | 1998-09-21 23:39:52 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-09-21 23:39:52 (GMT) |
commit | 494c2de3a748b449c69ce322a1a741f5a31fd4d5 (patch) | |
tree | c3ece48c0ae3f4ba54787e0e8e729b65752ef3f9 /tests/info.test | |
parent | 7a698c0488d99c0af42022714638ae1ba2afaa49 (diff) | |
download | tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.zip tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.gz tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.bz2 |
Added contents of Tcl 8.1a2
Diffstat (limited to 'tests/info.test')
-rw-r--r-- | tests/info.test | 194 |
1 files changed, 53 insertions, 141 deletions
diff --git a/tests/info.test b/tests/info.test index 784dad1..7bc5e84 100644 --- a/tests/info.test +++ b/tests/info.test @@ -5,15 +5,27 @@ # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1994 The Regents of the University of California. -# Copyright (c) 1994-1995 Sun Microsystems, Inc. +# Copyright (c) 1994-1997 Sun Microsystems, Inc. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# SCCS: @(#) info.test 1.39 97/08/01 11:10:24 +# SCCS: @(#) info.test 1.43 98/02/11 17:28:43 if {[string compare test [info procs test]] == 1} then {source defs} +# Set up namespaces needed to test operation of "info args", "info body", +# "info default", and "info procs" with imported procedures. + +catch {namespace delete test_ns_info1 test_ns_info2} + +namespace eval test_ns_info1 { + namespace export * + proc p {x} {return "x=$x"} + proc q {{y 27} z} {return "y=$y"} +} + + test info-1.1 {info args option} { proc t1 {a bbb c} {return foo} info args t1 @@ -38,6 +50,13 @@ test info-1.6 {info args option} { t1 1 2 info args t1 } {a b} +test info-1.7 {info args option} { + catch {namespace delete test_ns_info2} + namespace eval test_ns_info2 { + namespace import ::test_ns_info1::* + list [info args p] [info args q] + } +} {x {y z}} test info-2.1 {info body option} { proc t1 {} {body of t1} @@ -49,6 +68,13 @@ test info-2.2 {info body option} { test info-2.3 {info body option} { list [catch {info args set 1} msg] $msg } {1 {wrong # args: should be "info args procname"}} +test info-2.4 {info body option} { + catch {namespace delete test_ns_info2} + namespace eval test_ns_info2 { + namespace import ::test_ns_info1::* + list [info body p] [info body q] + } +} {{return "x=$x"} {return "y=$y"}} # "info cmdcount" is no longer accurate for compiled commands! The expected # result for info-3.1 used to be "3" and is now "1" since the "set"s have @@ -59,7 +85,7 @@ test info-3.1 {info cmdcount option} { set z [info cm] expr $z-$x } 1 -test info-3.2 {info body option} { +test info-3.2 {info cmdcount option} { list [catch {info cmdcount 1} msg] $msg } {1 {wrong # args: should be "info cmdcount"}} @@ -93,145 +119,13 @@ test info-4.5 {info commands option} { } {1 {wrong # args: should be "info commands ?pattern?"}} test info-5.1 {info complete option} { - info complete "" -} 1 + list [catch {info complete} msg] $msg +} {1 {wrong # args: should be "info complete command"}} test info-5.2 {info complete option} { - info complete " \n" -} 1 -test info-5.3 {info complete option} { - info complete "abc def" -} 1 -test info-5.4 {info complete option} { - info complete "a b c d e f \t\n" -} 1 -test info-5.5 {info complete option} { - info complete {a b c"d} -} 1 -test info-5.6 {info complete option} { - info complete {a b "c d" e} -} 1 -test info-5.7 {info complete option} { - info complete {a b "c d"} -} 1 -test info-5.8 {info complete option} { - info complete {a b "c d"} -} 1 -test info-5.9 {info complete option} { - info complete {a b "c d} -} 0 -test info-5.10 {info complete option} { - info complete {a b "} -} 0 -test info-5.11 {info complete option} { - info complete {a b "cd"xyz} -} 1 -test info-5.12 {info complete option} { - info complete {a b "c $d() d"} -} 1 -test info-5.13 {info complete option} { - info complete {a b "c $dd("} -} 0 -test info-5.14 {info complete option} { - info complete {a b "c \"} -} 0 -test info-5.15 {info complete option} { - info complete {a b "c [d e f]"} -} 1 -test info-5.16 {info complete option} { - info complete {a b "c [d e f] g"} -} 1 -test info-5.17 {info complete option} { - info complete {a b "c [d e f"} -} 0 -test info-5.18 {info complete option} { - info complete {a {b c d} e} -} 1 -test info-5.19 {info complete option} { - info complete {a {b c d}} -} 1 -test info-5.20 {info complete option} { - info complete "a b\{c d" -} 1 -test info-5.21 {info complete option} { - info complete "a b \{c" -} 0 -test info-5.22 {info complete option} { - info complete "a b \{c{ }" -} 0 -test info-5.23 {info complete option} { - info complete "a b {c d e}xxx" -} 1 -test info-5.24 {info complete option} { - info complete "a b {c \\\{d e}xxx" -} 1 -test info-5.25 {info complete option} { - info complete {a b [ab cd ef]} -} 1 -test info-5.26 {info complete option} { - info complete {a b x[ab][cd][ef] gh} -} 1 -test info-5.27 {info complete option} { - info complete {a b x[ab][cd[ef] gh} -} 0 -test info-5.28 {info complete option} { - info complete {a b x[ gh} -} 0 -test info-5.29 {info complete option} { - info complete {[]]]} -} 1 -test info-5.30 {info complete option} { - info complete {abc x$yyy} -} 1 -test info-5.31 {info complete option} { - info complete "abc x\${abc\[\\d} xyz" -} 1 -test info-5.32 {info complete option} { - info complete "abc x\$\{ xyz" -} 0 -test info-5.33 {info complete option} { - info complete {word $a(xyz)} -} 1 -test info-5.34 {info complete option} { - info complete {word $a(} -} 0 -test info-5.35 {info complete option} { - info complete "set a \\\n" -} 0 -test info-5.36 {info complete option} { - info complete "set a \\n " + info complete abc } 1 -test info-5.37 {info complete option} { - info complete "set a \\" -} 1 -test info-5.38 {info complete option} { - info complete "foo \\\n\{" -} 0 -test info-5.39 {info complete option} { - info complete " # \{" -} 1 -test info-5.40 {info complete option} { - info complete "foo bar;# \{" -} 1 -test info-5.41 {info complete option} { - info complete "a\nb\n# \{\n# \{\nc\n" -} 1 -test info-5.42 {info complete option} { - info complete "#Incomplete comment\\\n" -} 0 -test info-5.43 {info complete option} { - info complete "#Incomplete comment\\\nBut now it's complete.\n" -} 1 -test info-5.44 {info complete option} { - info complete "# Complete comment\\\\\n" -} 1 -test info-5.45 {info complete option} { - info complete "abc\\\n def" -} 1 -test info-5.46 {info complete option} { - info complete "abc\\\n " -} 1 -test info-5.47 {info complete option} { - info complete "abc\\\n" +test info-5.2 {info complete option} { + info complete "\{abcd " } 0 test info-6.1 {info default option} { @@ -282,6 +176,13 @@ test info-6.10 {info default option} { proc t1 {{a 18} b} {} list [catch {info default t1 a a} msg] $msg } {1 {couldn't store default value in variable "a"}} +test info-6.11 {info default option} { + catch {namespace delete test_ns_info2} + namespace eval test_ns_info2 { + namespace import ::test_ns_info1::* + list [info default p x foo] $foo [info default q y bar] $bar + } +} {0 {} 1 27} catch {unset a} test info-7.1 {info exists option} { @@ -410,7 +311,7 @@ test info-11.1 {info loaded option} { } {1 {wrong # args: should be "info loaded ?interp?"}} test info-11.2 {info loaded option} { list [catch {info loaded {}}] [catch {info loaded gorp} msg] $msg -} {0 1 {couldn't find slave interpreter named "gorp"}} +} {0 1 {could not find interpreter "gorp"}} test info-12.1 {info locals option} { set a 22 @@ -486,6 +387,14 @@ catch {rename _tt2 {}} test info-15.3 {info procs option} { list [catch {info procs 2 3} msg] $msg } {1 {wrong # args: should be "info procs ?pattern?"}} +test info-15.4 {info procs option} { + catch {namespace delete test_ns_info2} + namespace eval test_ns_info2 { + namespace import ::test_ns_info1::* + proc r {} {} + list [info procs] [info procs p*] + } +} {{p q r} p} set self info.test if {$tcl_platform(os) == "Win32s"} { @@ -574,3 +483,6 @@ test info-20.4 {miscellaneous error conditions} { test info-20.5 {miscellaneous error conditions} { list [catch {info s} msg] $msg } {1 {ambiguous option "s": must be args, body, cmdcount, commands, complete, default, exists, globals, hostname, level, library, loaded, locals, nameofexecutable, patchlevel, procs, script, sharedlibextension, tclversion, or vars}} + +catch {namespace delete test_ns_info1 test_ns_info2} +return |