summaryrefslogtreecommitdiffstats
path: root/tests/nre.test
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2008-08-04 15:32:38 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2008-08-04 15:32:38 (GMT)
commitf78f8e7da883b378770d2136210a8e22ffc3791e (patch)
tree064cf9ffc0aaf5529a51b9b402dc1f32b2220123 /tests/nre.test
parentd0175ffdeb40da28f971392eecbb97ac221d776f (diff)
downloadtcl-f78f8e7da883b378770d2136210a8e22ffc3791e.zip
tcl-f78f8e7da883b378770d2136210a8e22ffc3791e.tar.gz
tcl-f78f8e7da883b378770d2136210a8e22ffc3791e.tar.bz2
* tests/nre.test: added tests for [if], [while] and [for]. A test
for [foreach] has been added and marked as knownbug, awaiting for it to be NR-enabled.
Diffstat (limited to 'tests/nre.test')
-rw-r--r--tests/nre.test47
1 files changed, 45 insertions, 2 deletions
diff --git a/tests/nre.test b/tests/nre.test
index c926de5..28861de 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.1 2008/08/02 14:12:56 msofer Exp $
+# RCS: @(#) $Id: nre.test,v 1.2 2008/08/04 15:32:40 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -190,9 +190,52 @@ test nre-7.1 {[catch] is not recursive} -setup {
a 0
} -cleanup {
rename a {}
- unset x abs
+ unset abs
} -result {{0 3 3 0} 0}
+test nre-7.2 {[if] is not recursive} -setup {
+ setabs
+ proc a i [makebody {uplevel 1 "if 1 {a $i}"}]
+} -body {
+ a 0
+} -cleanup {
+ rename a {}
+ unset abs
+} -result {{0 2 2 0} 0}
+
+test nre-7.3 {[while] is not recursive} -setup {
+ setabs
+ proc a i [makebody {uplevel 1 "while 1 {set res \[a $i\]; break}; set res"}]
+} -body {
+ a 0
+} -cleanup {
+ rename a {}
+ unset abs
+} -result {{0 2 2 0} 0}
+
+test nre-7.4 {[for] is not recursive} -setup {
+ setabs
+ proc a i [makebody {uplevel 1 "for {set j 0} {\$j < 10} {incr j} {set res \[a $i\]; break}; set res"}]
+} -body {
+ a 0
+} -cleanup {
+ rename a {}
+ unset abs
+} -result {{0 2 2 0} 0}
+
+test nre-7.5 {[foreach] is not recursive} -constraints {knownbug} -setup {
+ #
+ # Enable once [foreach] is NR-enabled
+ #
+ setabs
+ proc a i [makebody {uplevel 1 "foreach j {1 2 3 4 5 6} {set res \[a $i\]; break}; set res"}]
+} -body {
+ a 0
+} -cleanup {
+ rename a {}
+ unset abs
+} -result {{0 2 2 0} 0}
+
#
# Basic TclOO tests
#