diff options
author | stanton <stanton> | 1998-09-24 23:58:14 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-09-24 23:58:14 (GMT) |
commit | 9995355714bc90faf7c2e345b3d6a1d041447097 (patch) | |
tree | 2ad97c5b1994495118cef4df947cf16b55e326f2 /tests/compile.test | |
parent | e13392595faf8e8d0d1c3c514ce160cfadc3d372 (diff) | |
download | tcl-9995355714bc90faf7c2e345b3d6a1d041447097.zip tcl-9995355714bc90faf7c2e345b3d6a1d041447097.tar.gz tcl-9995355714bc90faf7c2e345b3d6a1d041447097.tar.bz2 |
merging changes from 8.0.3 into 8.1a2
Diffstat (limited to 'tests/compile.test')
-rw-r--r-- | tests/compile.test | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/tests/compile.test b/tests/compile.test index 53dc3d8..e5995c8 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# SCCS: @(#) compile.test 1.9 97/12/16 13:32:14 +# RCS: @(#) $Id: compile.test,v 1.1.2.2 1998/09/24 23:59:21 stanton Exp $ if {[string compare test [info procs test]] == 1} then {source defs} @@ -78,8 +78,44 @@ test compile-3.1 {TclCompileCatchCmd: only catch cmds with scalar vars are compi } list [p] $a(1) } {0 123} +test compile-3.2 {TclCompileCatchCmd: non-local variables} { + set ::foo 1 + proc catch-test {} { + catch {set x 3} ::foo + } + catch-test + set ::foo +} 3 + +test compile-4.1 {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-4.1 {TclCompileSetCmd: global scalar names with ::s} { +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 + foreach scalar [list 1 2 3] break + } + list [catch foreach-exception-test result] $result +} {0 {}} +test compile-5.2 {TclCompileForeachCmd: non-local variables} { + set ::foo 1 + proc foreach-test {} { + foreach ::foo {1 2 3} {} + } + foreach-test + set ::foo +} 3 + +test compile-6.1 {TclCompileSetCmd: global scalar names with ::s} { catch {unset x} catch {unset y} set x 123 @@ -90,7 +126,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 {} { @@ -99,7 +135,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 { @@ -111,17 +147,28 @@ test compile-4.3 {TclCompileSetCmd: namespace var names with ::s} { list $::x $::test_ns_compile::arr(1) } {hello 123} -test compile-5.1 {CollectArgInfo: binary data} { +test compile-7.1 {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-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 @@ -138,3 +185,4 @@ catch {unset y} catch {unset a} return + |