summaryrefslogtreecommitdiffstats
path: root/tests/compile.test
diff options
context:
space:
mode:
authorstanton <stanton>1999-04-16 00:46:29 (GMT)
committerstanton <stanton>1999-04-16 00:46:29 (GMT)
commit97464e6cba8eb0008cf2727c15718671992b913f (patch)
treece9959f2747257d98d52ec8d18bf3b0de99b9535 /tests/compile.test
parenta8c96ddb94d1483a9de5e340b740cb74ef6cafa7 (diff)
downloadtcl-97464e6cba8eb0008cf2727c15718671992b913f.zip
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.gz
tcl-97464e6cba8eb0008cf2727c15718671992b913f.tar.bz2
merged tcl 8.1 branch back into the main trunk
Diffstat (limited to 'tests/compile.test')
-rw-r--r--tests/compile.test58
1 files changed, 42 insertions, 16 deletions
diff --git a/tests/compile.test b/tests/compile.test
index 14f8864..382e85e 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -5,13 +5,16 @@
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1997 by Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: compile.test,v 1.5 1999/02/02 22:26:12 stanton Exp $
+# RCS: @(#) $Id: compile.test,v 1.6 1999/04/16 00:47:25 stanton Exp $
-if {[string compare test [info procs test]] == 1} then {source defs}
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ source [file join [pwd] [file dirname [info script]] defs.tcl]
+}
# The following tests are very incomplete, although the rest of the
# test suite covers this file fairly well.
@@ -69,6 +72,15 @@ test compile-2.4 {TclCompileDollarVar: global scalar name with ::s} {
list [p] $::a(1) [expr {[lsearch -exact [info globals] a] != 0}]
} {1 1 1}
+test compile-3.1 {TclCompileCatchCmd: only catch cmds with scalar vars are compiled inline} {
+ catch {unset a}
+ set a(1) xyzzyx
+ proc p {} {
+ global a
+ catch {set x 123} a(1)
+ }
+ list [p] $a(1)
+} {0 123}
test compile-3.2 {TclCompileCatchCmd: non-local variables} {
set ::foo 1
proc catch-test {} {
@@ -78,8 +90,7 @@ test compile-3.2 {TclCompileCatchCmd: non-local variables} {
set ::foo
} 3
-
-test compile-1.16 {TclCompileForCmd: command substituted test expression} {
+test compile-4.1 {TclCompileForCmd: command substituted test expression} {
set i 0
set j 0
# Should be "forever"
@@ -90,7 +101,7 @@ test compile-1.16 {TclCompileForCmd: command substituted test expression} {
set j
} {4}
-test compile-3.1 {TclCompileForeachCmd: exception stack} {
+test compile-5.1 {TclCompileForeachCmd: exception stack} {
proc foreach-exception-test {} {
foreach array(index) [list 1 2 3] break
foreach array(index) [list 1 2 3] break
@@ -98,7 +109,7 @@ test compile-3.1 {TclCompileForeachCmd: exception stack} {
}
list [catch foreach-exception-test result] $result
} {0 {}}
-test compile-3.2 {TclCompileForeachCmd: non-local variables} {
+test compile-5.2 {TclCompileForeachCmd: non-local variables} {
set ::foo 1
proc foreach-test {} {
foreach ::foo {1 2 3} {}
@@ -107,7 +118,7 @@ test compile-3.2 {TclCompileForeachCmd: non-local variables} {
set ::foo
} 3
-test compile-4.1 {TclCompileSetCmd: global scalar names with ::s} {
+test compile-6.1 {TclCompileSetCmd: global scalar names with ::s} {
catch {unset x}
catch {unset y}
set x 123
@@ -118,7 +129,7 @@ test compile-4.1 {TclCompileSetCmd: global scalar names with ::s} {
list $::x [expr {[lsearch -exact [info globals] x] != 0}] \
[p] $::y [expr {[lsearch -exact [info globals] y] != 0}]
} {123 1 789 789 1}
-test compile-4.2 {TclCompileSetCmd: global array names with ::s} {
+test compile-6.2 {TclCompileSetCmd: global array names with ::s} {
catch {unset a}
set ::a(1) 2
proc p {} {
@@ -127,7 +138,7 @@ test compile-4.2 {TclCompileSetCmd: global array names with ::s} {
}
list $::a(1) [p] [set ::a($::a(1)) 3] $::a(1) [expr {[lsearch -exact [info globals] a] != 0}]
} {2 1 3 3 1}
-test compile-4.3 {TclCompileSetCmd: namespace var names with ::s} {
+test compile-6.3 {TclCompileSetCmd: namespace var names with ::s} {
catch {namespace delete test_ns_compile}
catch {unset x}
namespace eval test_ns_compile {
@@ -139,7 +150,7 @@ test compile-4.3 {TclCompileSetCmd: namespace var names with ::s} {
list $::x $::test_ns_compile::arr(1)
} {hello 123}
-test compile-1.15 {TclCompileWhileCmd: command substituted test expression} {
+test compile-7.1 {TclCompileWhileCmd: command substituted test expression} {
set i 0
set j 0
# Should be "forever"
@@ -150,17 +161,17 @@ test compile-1.15 {TclCompileWhileCmd: command substituted test expression} {
set j
} {4}
-test compile-5.1 {CollectArgInfo: binary data} {
+test compile-8.1 {CollectArgInfo: binary data} {
list [catch "string length \000foo" msg] $msg
} {0 4}
-test compile-5.2 {CollectArgInfo: binary data} {
+test compile-8.2 {CollectArgInfo: binary data} {
list [catch "string length foo\000" msg] $msg
} {0 4}
-test compile-5.3 {CollectArgInfo: handle "]" at end of command properly} {
+test compile-8.3 {CollectArgInfo: handle "]" at end of command properly} {
set x ]
} {]}
-test compile-6.1 {UpdateStringOfByteCode: called for duplicate of compiled empty object} {
+test compile-9.1 {UpdateStringOfByteCode: called for duplicate of compiled empty object} {
proc p {} {
set x {}
eval $x
@@ -170,7 +181,7 @@ test compile-6.1 {UpdateStringOfByteCode: called for duplicate of compiled empty
p
} {}
-test compile-7.1 {BLACKBOX: exception stack overflow} {
+test compile-10.1 {BLACKBOX: exception stack overflow} {
set x {{0}}
set y 0
while {$y < 100} {
@@ -179,10 +190,25 @@ test compile-7.1 {BLACKBOX: exception stack overflow} {
} {}
+
+# cleanup
catch {rename p ""}
catch {namespace delete test_ns_compile}
catch {unset x}
catch {unset y}
catch {unset a}
-
+::tcltest::cleanupTests
return
+
+
+
+
+
+
+
+
+
+
+
+
+