From f78f8e7da883b378770d2136210a8e22ffc3791e Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Mon, 4 Aug 2008 15:32:38 +0000 Subject: * 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. --- ChangeLog | 4 ++++ tests/nre.test | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index feccf40..265d556 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-08-04 Miguel Sofer + * 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. + * generic/tclBasic.c: made atProcExit commands run * generic/tclCompile.h: inconditionally, streamlined * generic/tclExecute.c: atProcExit/tailcall processing 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 # -- cgit v0.12