From 234eb4d7556c017fc6dee98267a56c844150ee5c Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 25 Jun 2009 19:24:16 +0000 Subject: Made namespace scope corrections to some of the testing machinery surrounding [testnrelevels]. Fixes up some -singleproc 1 failures. --- tests/coroutine.test | 8 +++++--- tests/nre.test | 29 +++++++---------------------- tests/tailcall.test | 8 +++++--- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/tests/coroutine.test b/tests/coroutine.test index fd3a3a1..7820e9a 100644 --- a/tests/coroutine.test +++ b/tests/coroutine.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. # -# RCS: @(#) $Id: coroutine.test,v 1.1 2009/03/19 23:31:37 msofer Exp $ +# RCS: @(#) $Id: coroutine.test,v 1.2 2009/06/25 19:24:16 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -20,6 +20,7 @@ testConstraint testnrelevels [llength [info commands testnrelevels]] if {[testConstraint testnrelevels]} { namespace eval testnre { + namespace path ::tcl::mathop # # [testnrelevels] returns a 6-list with: C-stack depth, iPtr->numlevels, # cmdFrame level, callFrame level, tosPtr and callback depth @@ -36,13 +37,14 @@ if {[testConstraint testnrelevels]} { return $res } proc setabs {} { - uplevel 1 variable abs -[lindex [testnrelevels] 0] + variable abs [- [lindex [testnrelevels] 0] } variable body0 { set x [depthDiff] if {[incr i] > 10} { - variable abs + namespace upvar [namespace qualifiers \ + [namespace origin depthDiff]] abs abs incr abs [lindex [testnrelevels] 0] return [list [lrange $x 0 3] $abs] } diff --git a/tests/nre.test b/tests/nre.test index b0ee702..2c91e7a 100644 --- a/tests/nre.test +++ b/tests/nre.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. # -# RCS: @(#) $Id: nre.test,v 1.10 2009/03/21 10:20:04 msofer Exp $ +# RCS: @(#) $Id: nre.test,v 1.11 2009/06/25 19:24:16 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -25,6 +25,7 @@ testConstraint testnrelevels [llength [info commands testnrelevels]] if {[testConstraint testnrelevels]} { namespace eval testnre { + namespace path ::tcl::mathop # # [testnrelevels] returns a 6-list with: C-stack depth, iPtr->numlevels, # cmdFrame level, callFrame level, tosPtr and callback depth @@ -41,13 +42,14 @@ if {[testConstraint testnrelevels]} { return $res } proc setabs {} { - uplevel 1 variable abs -[lindex [testnrelevels] 0] + variable abs [- [lindex [testnrelevels] 0]] } variable body0 { set x [depthDiff] if {[incr i] > 10} { - variable abs + namespace upvar [namespace qualifiers \ + [namespace origin depthDiff]] abs abs incr abs [lindex [testnrelevels] 0] return [list [lrange $x 0 3] $abs] } @@ -68,7 +70,6 @@ test nre-1.1 {self-recursive procs} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 1 1 1} 0} @@ -79,7 +80,7 @@ test nre-1.2 {self-recursive lambdas} -setup { setabs apply $a 0 } -cleanup { - unset a abs + unset a } -constraints { testnrelevels } -result {{0 1 1 1} 0} @@ -94,7 +95,7 @@ test nre-1.3 {mutually recursive procs and lambdas} -setup { a 0 } -cleanup { rename a {} - unset b abs + unset b } -constraints { testnrelevels } -result {{0 2 2 2} 0} @@ -112,7 +113,6 @@ test nre-2.1 {alias is not recursive} -setup { } -cleanup { rename a {} rename b {} - unset abs } -constraints { testnrelevels } -result {{0 2 1 1} 0} @@ -148,7 +148,6 @@ test nre-4.1 {ensembles are not recursive} -setup { } -cleanup { rename a {} rename b {} - unset abs } -constraints { testnrelevels } -result {{0 2 1 1} 0} @@ -186,7 +185,6 @@ test nre-6.1 {[uplevel] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 2 2 0} 0} @@ -198,7 +196,6 @@ test nre-6.2 {[uplevel] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 2 2 0} 0} @@ -210,7 +207,6 @@ test nre-7.1 {[catch] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 3 3 0} 0} @@ -222,7 +218,6 @@ test nre-7.2 {[if] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 2 2 0} 0} @@ -234,7 +229,6 @@ test nre-7.3 {[while] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 2 2 0} 0} @@ -246,7 +240,6 @@ test nre-7.4 {[for] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 2 2 0} 0} @@ -261,7 +254,6 @@ test nre-7.5 {[foreach] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 3 3 0} 0} @@ -273,7 +265,6 @@ test nre-7.6 {[eval] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 2 2 1} 0} @@ -285,7 +276,6 @@ test nre-7.7 {[eval] is not recursive} -setup { a 0 } -cleanup { rename a {} - unset abs } -constraints { testnrelevels } -result {{0 2 2 1} 0} @@ -335,7 +325,6 @@ test nre-oo.1 {really deep calls in oo - direct} -setup { foo bar 0 } -cleanup { foo destroy - unset abs } -constraints { testnrelevels } -result {{0 1 1 1} 0} @@ -348,7 +337,6 @@ test nre-oo.2 {really deep calls in oo - call via [self]} -setup { foo bar 0 } -cleanup { foo destroy - unset abs } -constraints { testnrelevels } -result {{0 1 1 1} 0} @@ -361,7 +349,6 @@ test nre-oo.3 {really deep calls in oo - private calls} -setup { foo bar 0 } -cleanup { foo destroy - unset abs } -constraints { testnrelevels } -result {{0 1 1 1} 0} @@ -379,7 +366,6 @@ test nre-oo.4 {really deep calls in oo - overriding} -setup { [boo new] bar 0 } -cleanup { foo destroy - unset abs } -constraints { testnrelevels } -result {{0 1 1 1} 0} @@ -396,7 +382,6 @@ test nre-oo.5 {really deep calls in oo - forwards} -setup { foo bar 0 } -cleanup { foo destroy - unset abs } -constraints { testnrelevels } -result {{0 2 1 1} 0} diff --git a/tests/tailcall.test b/tests/tailcall.test index 8eea3e9..335492a 100644 --- a/tests/tailcall.test +++ b/tests/tailcall.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. # -# RCS: @(#) $Id: tailcall.test,v 1.8 2009/06/24 15:17:41 dgp Exp $ +# RCS: @(#) $Id: tailcall.test,v 1.9 2009/06/25 19:24:16 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -25,6 +25,7 @@ testConstraint testnrelevels [llength [info commands testnrelevels]] if {[testConstraint testnrelevels]} { namespace eval testnre { + namespace path ::tcl::mathop # # [testnrelevels] returns a 6-list with: C-stack depth, iPtr->numlevels, # cmdFrame level, callFrame level, tosPtr and callback depth @@ -41,13 +42,14 @@ if {[testConstraint testnrelevels]} { return $res } proc setabs {} { - uplevel 1 variable abs -[lindex [testnrelevels] 0] + variable abs [- [lindex [testnrelevels] 0]] } variable body0 { set x [depthDiff] if {[incr i] > 10} { - variable abs + namespace upvar [namespace qualifiers \ + [namespace origin depthDiff]] abs abs incr abs [lindex [testnrelevels] 0] return [list [lrange $x 0 3] $abs] } -- cgit v0.12