diff options
Diffstat (limited to 'contrib/tcl/tests/compile.test')
-rw-r--r-- | contrib/tcl/tests/compile.test | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/contrib/tcl/tests/compile.test b/contrib/tcl/tests/compile.test index 6d8e032..9e30fb3 100644 --- a/contrib/tcl/tests/compile.test +++ b/contrib/tcl/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.5 97/06/25 11:43:49 +# SCCS: @(#) compile.test 1.7 97/08/12 13:34:13 if {[string compare test [info procs test]] == 1} then {source defs} @@ -22,12 +22,32 @@ catch {unset x} catch {unset y} catch {unset a} -test compile-1.1 {TclCompileDollarVar: global scalar name with ::s} { +test compile-1.1 {TclCompileString: look up cmds in proc ns, not current ns} { + catch {namespace delete test_ns_compile} + catch {unset x} + set x 123 + namespace eval test_ns_compile { + proc set {args} { + global x + lappend x test_ns_compile::set + } + proc p {} { + set 0 + } + } + list [test_ns_compile::p] [set x] +} {{123 test_ns_compile::set} {123 test_ns_compile::set}} +test compile-1.2 {TclCompileString, error result is reset if TclGetLong determines word isn't an integer} { + proc p {x} {info commands 3m} + list [catch {p} msg] $msg +} {1 {no value given for parameter "x" to "p"}} + +test compile-2.1 {TclCompileDollarVar: global scalar name with ::s} { catch {unset x} set x 123 list $::x [expr {[lsearch -exact [info globals] x] != 0}] } {123 1} -test compile-1.2 {TclCompileDollarVar: global scalar name with ::s} { +test compile-2.2 {TclCompileDollarVar: global scalar name with ::s} { catch {unset y} proc p {} { set ::y 789 @@ -35,12 +55,12 @@ test compile-1.2 {TclCompileDollarVar: global scalar name with ::s} { } list [p] $::y [expr {[lsearch -exact [info globals] y] != 0}] } {789 789 1} -test compile-1.3 {TclCompileDollarVar: global array name with ::s} { +test compile-2.3 {TclCompileDollarVar: global array name with ::s} { catch {unset a} set ::a(1) 2 list $::a(1) [set ::a($::a(1)) 3] $::a(2) [expr {[lsearch -exact [info globals] a] != 0}] } {2 3 3 1} -test compile-1.4 {TclCompileDollarVar: global scalar name with ::s} { +test compile-2.4 {TclCompileDollarVar: global scalar name with ::s} { catch {unset a} proc p {} { set ::a(1) 1 @@ -49,7 +69,7 @@ test compile-1.4 {TclCompileDollarVar: global scalar name with ::s} { list [p] $::a(1) [expr {[lsearch -exact [info globals] a] != 0}] } {1 1 1} -test compile-2.1 {TclCompileSetCmd: global scalar names with ::s} { +test compile-3.1 {TclCompileSetCmd: global scalar names with ::s} { catch {unset x} catch {unset y} set x 123 @@ -60,7 +80,7 @@ test compile-2.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-2.2 {TclCompileSetCmd: global array names with ::s} { +test compile-3.2 {TclCompileSetCmd: global array names with ::s} { catch {unset a} set ::a(1) 2 proc p {} { @@ -69,7 +89,7 @@ test compile-2.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-2.3 {TclCompileSetCmd: namespace var names with ::s} { +test compile-3.3 {TclCompileSetCmd: namespace var names with ::s} { catch {namespace delete test_ns_compile} catch {unset x} namespace eval test_ns_compile { @@ -81,17 +101,17 @@ test compile-2.3 {TclCompileSetCmd: namespace var names with ::s} { list $::x $::test_ns_compile::arr(1) } {hello 123} -test compile-3.1 {CollectArgInfo: binary data} { +test compile-4.1 {CollectArgInfo: binary data} { list [catch "string length \000foo" msg] $msg } {0 4} -test compile-3.2 {CollectArgInfo: binary data} { +test compile-4.2 {CollectArgInfo: binary data} { list [catch "string length foo\000" msg] $msg } {0 4} -test compile-3.3 {CollectArgInfo: handle "]" at end of command properly} { +test compile-4.3 {CollectArgInfo: handle "]" at end of command properly} { set x ] } {]} -test compile-4.1 {UpdateStringOfByteCode: called for duplicate of compiled empty object} { +test compile-5.1 {UpdateStringOfByteCode: called for duplicate of compiled empty object} { proc p {} { set x {} eval $x |