summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2008-07-21 03:43:26 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2008-07-21 03:43:26 (GMT)
commit456ffc75f24234b21ad5de58e70e33366df2563c (patch)
tree5143da8d1a32265e2d66e5305ac3a4f2e99fe30e /tests
parent2083b945305b771d513727a999ee374dd051f321 (diff)
downloadtcl-456ffc75f24234b21ad5de58e70e33366df2563c.zip
tcl-456ffc75f24234b21ad5de58e70e33366df2563c.tar.gz
tcl-456ffc75f24234b21ad5de58e70e33366df2563c.tar.bz2
* generic/tclBasic.c: NRE: enabled calling NR commands
* generic/tclExecute.c: from the callbacks. Completely * generic/tclInt.h: redone tailcall implementation * generic/tclNRE.h: using the new feature. * generic/tclProc.c: * tests/NRE.test:
Diffstat (limited to 'tests')
-rw-r--r--tests/NRE.test35
1 files changed, 23 insertions, 12 deletions
diff --git a/tests/NRE.test b/tests/NRE.test
index 19bb38f..a881675 100644
--- a/tests/NRE.test
+++ b/tests/NRE.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: NRE.test,v 1.4 2008/07/20 23:57:27 das Exp $
+# RCS: @(#) $Id: NRE.test,v 1.5 2008/07/21 03:43:32 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -332,22 +332,33 @@ namespace import tcl::unsupported::tailcall
test NRE-T.1 {tailcall} -constraints {tailcall} -body {
namespace eval a {
- unset -nocomplain x
- proc aset args {uplevel 1 [list set {*}$args]}
- proc foo {} {tailcall aset x 1}
+ variable x *::a
+ proc xset {} {
+ set tmp {}
+ set ns {[namespace current]}
+ set level [info level]
+ for {set i 0} {$i <= [info level]} {incr i} {
+ uplevel #$i "set x $i$ns"
+ lappend tmp "$i [info level $i]"
+ }
+ lrange $tmp 1 end
+ }
+ proc foo {} {tailcall xset; set x noreach}
}
namespace eval b {
- unset -nocomplain x
- proc aset args {error b::aset}
- proc moo {} {set x 0; ::a::foo; set x}
+ variable x *::b
+ proc xset args {error b::xset}
+ proc moo {} {set x 0; variable y [::a::foo]; set x}
}
- unset -nocomplain x
- proc aset args {error ::aset}
- ::b::moo
+ variable x *::
+ proc xset args {error ::xset}
+ list [::b::moo] | $x $a::x $b::x | $::b::y
} -cleanup {
- rename aset {}
+ unset x
+ rename xset {}
namespace delete a b
-} -result 1
+} -result {1::b | 0:: *::a *::b | {{1 ::b::moo} {2 xset}}}
+
test NRE-T.2 {tailcall in non-proc} -constraints {tailcall} -body {
list [catch {namespace eval a [list tailcall set x 1]} msg] $msg