summaryrefslogtreecommitdiffstats
path: root/tests/compile.test
diff options
context:
space:
mode:
authorstanton <stanton>1998-06-18 18:25:58 (GMT)
committerstanton <stanton>1998-06-18 18:25:58 (GMT)
commite27be7921a7f70adf89b0c59b976c96c32fae7a8 (patch)
tree0e642457c83579949f1c862535263886e6e1b374 /tests/compile.test
parent75b521227f47c2241a4edb7d1e913ac348f05f12 (diff)
downloadtcl-e27be7921a7f70adf89b0c59b976c96c32fae7a8.zip
tcl-e27be7921a7f70adf89b0c59b976c96c32fae7a8.tar.gz
tcl-e27be7921a7f70adf89b0c59b976c96c32fae7a8.tar.bz2
*** empty log message ***
Diffstat (limited to 'tests/compile.test')
-rw-r--r--tests/compile.test55
1 files changed, 48 insertions, 7 deletions
diff --git a/tests/compile.test b/tests/compile.test
index 9e30fb3..4720d35 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -69,7 +69,35 @@ 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 {TclCompileSetCmd: global scalar names with ::s} {
+test compile-1.16 {TclCompileForCmd: command substituted test expression} {
+ set i 0
+ set j 0
+ # Should be "forever"
+ for {} [expr $i < 3] {} {
+ set j [incr i]
+ if {$j > 3} break
+ }
+ set j
+} {4}
+
+test compile-3.1 {TclCompileForeachCmd: exception stack} {
+ proc foreach-exception-test {} {
+ foreach array(index) [list 1 2 3] break
+ foreach array(index) [list 1 2 3] break
+ foreach scalar [list 1 2 3] break
+ }
+ list [catch foreach-exception-test result] $result
+} {0 {}}
+test compile-3.2 {TclCompileForeachCmd: non-local variables} {
+ set ::foo 1
+ proc foreach-test {} {
+ foreach ::foo {1 2 3} {}
+ }
+ foreach-test
+ set ::foo
+} 3
+
+test compile-4.1 {TclCompileSetCmd: global scalar names with ::s} {
catch {unset x}
catch {unset y}
set x 123
@@ -80,7 +108,7 @@ test compile-3.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-3.2 {TclCompileSetCmd: global array names with ::s} {
+test compile-4.2 {TclCompileSetCmd: global array names with ::s} {
catch {unset a}
set ::a(1) 2
proc p {} {
@@ -89,7 +117,7 @@ test compile-3.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-3.3 {TclCompileSetCmd: namespace var names with ::s} {
+test compile-4.3 {TclCompileSetCmd: namespace var names with ::s} {
catch {namespace delete test_ns_compile}
catch {unset x}
namespace eval test_ns_compile {
@@ -101,17 +129,28 @@ test compile-3.3 {TclCompileSetCmd: namespace var names with ::s} {
list $::x $::test_ns_compile::arr(1)
} {hello 123}
-test compile-4.1 {CollectArgInfo: binary data} {
+test compile-1.15 {TclCompileWhileCmd: command substituted test expression} {
+ set i 0
+ set j 0
+ # Should be "forever"
+ while [expr $i < 3] {
+ set j [incr i]
+ if {$j > 3} break
+ }
+ set j
+} {4}
+
+test compile-5.1 {CollectArgInfo: binary data} {
list [catch "string length \000foo" msg] $msg
} {0 4}
-test compile-4.2 {CollectArgInfo: binary data} {
+test compile-5.2 {CollectArgInfo: binary data} {
list [catch "string length foo\000" msg] $msg
} {0 4}
-test compile-4.3 {CollectArgInfo: handle "]" at end of command properly} {
+test compile-5.3 {CollectArgInfo: handle "]" at end of command properly} {
set x ]
} {]}
-test compile-5.1 {UpdateStringOfByteCode: called for duplicate of compiled empty object} {
+test compile-6.1 {UpdateStringOfByteCode: called for duplicate of compiled empty object} {
proc p {} {
set x {}
eval $x
@@ -126,3 +165,5 @@ catch {namespace delete test_ns_compile}
catch {unset x}
catch {unset y}
catch {unset a}
+
+return