summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2009-03-21 01:23:38 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2009-03-21 01:23:38 (GMT)
commit613d3aaac8fffe35fccf988a875051486deb383d (patch)
tree049ab9b0054761e534c0b975fe50722f912a4458 /tests
parentdfe41925f76a800c5abaaffdbe7b7676fca1430c (diff)
downloadtcl-613d3aaac8fffe35fccf988a875051486deb383d.zip
tcl-613d3aaac8fffe35fccf988a875051486deb383d.tar.gz
tcl-613d3aaac8fffe35fccf988a875051486deb383d.tar.bz2
* tests/tailcall.test: slightly improved tests
Diffstat (limited to 'tests')
-rw-r--r--tests/tailcall.test32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/tailcall.test b/tests/tailcall.test
index a3cf88e..0c91488 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.1 2009/03/19 23:31:37 msofer Exp $
+# RCS: @(#) $Id: tailcall.test,v 1.2 2009/03/21 01:23:38 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -221,7 +221,7 @@ test tailcall-9 {tailcall factorial} -setup {
rename fact {}
} -result {1 120 3628800 1307674368000}
-test tailcall-10 {tailcall and eval} -constraints {knownBug} -setup {
+test tailcall-10a {tailcall and eval} -constraints {knownBug} -setup {
proc a {} {
eval [list tailcall lappend ::x 2]
set ::x 1
@@ -230,9 +230,20 @@ test tailcall-10 {tailcall and eval} -constraints {knownBug} -setup {
list [a] $::x
} -cleanup {
unset -nocomplain ::x
-} -result {1 2}
+} -result {{1 2} {1 2}}
-test tailcall-11 {tailcall and uplevel} -constraints {knownBug} -setup {
+test tailcall-10b {tailcall and eval} -setup {
+ proc a {} {
+ eval {tailcall lappend ::x 2}
+ set ::x 1
+ }
+} -body {
+ list [a] $::x
+} -cleanup {
+ unset -nocomplain ::x
+} -result {{1 2} {1 2}}
+
+test tailcall-11a {tailcall and uplevel} -setup {
proc a {} {
uplevel 1 [list tailcall set ::x 2]
set ::x 1
@@ -241,7 +252,18 @@ test tailcall-11 {tailcall and uplevel} -constraints {knownBug} -setup {
list [a] $::x
} -cleanup {
unset -nocomplain ::x
-} -result {1 2}
+} -match glob -result *tailcall* -returnCodes error
+
+test tailcall-11b {tailcall and uplevel} -setup {
+ proc a {} {
+ uplevel 1 {tailcall set ::x 2}
+ set ::x 1
+ }
+} -body {
+ list [a] $::x
+} -cleanup {
+ unset -nocomplain ::x
+} -match glob -result *tailcall* -returnCodes error
# cleanup
::tcltest::cleanupTests