summaryrefslogtreecommitdiffstats
path: root/tests/lmap.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-03-01 18:47:20 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-03-01 18:47:20 (GMT)
commit2e7dd9a8aae2880a577342d8dad1b7f4ad89fbbb (patch)
tree15cb4f88703f99efc1c469c0ecaef4f7238fbf71 /tests/lmap.test
parentb4bcf67ad8744ef06f1ee21b89b776f53790d932 (diff)
downloadtcl-2e7dd9a8aae2880a577342d8dad1b7f4ad89fbbb.zip
tcl-2e7dd9a8aae2880a577342d8dad1b7f4ad89fbbb.tar.gz
tcl-2e7dd9a8aae2880a577342d8dad1b7f4ad89fbbb.tar.bz2
[Bug 3606397]: Make test work in isolation, and corrected what was being tested.
Diffstat (limited to 'tests/lmap.test')
-rw-r--r--tests/lmap.test19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/lmap.test b/tests/lmap.test
index 7baa77b..08035d9 100644
--- a/tests/lmap.test
+++ b/tests/lmap.test
@@ -18,7 +18,7 @@ if {"::tcltest" ni [namespace children]} {
namespace import -force ::tcltest::*
}
-unset -nocomplain a i x
+unset -nocomplain a b i x
# ----- Non-compiled operation -----------------------------------------------
@@ -404,14 +404,21 @@ test lmap-7.6 {lmap: related to "foreach" [Bug 1671087]} -setup {
rename demo {}
} -result {2 4}
# Huge lists must not overflow the bytecode interpreter (development bug)
-test lmap-7.7 {huge list non-compiled} {
+test lmap-7.7 {huge list non-compiled} -setup {
+ unset -nocomplain a b x
+} -body {
set x [lmap a [lrepeat 1000000 x] { set b y$a }]
list $b [llength $x] [string length $x]
-} {yx 1000000 2999999}
-test lmap-7.8 {huge list compiled} {
- set x [apply {{times} { lmap a [lrepeat $times x] { set b y$a }}} 1000000]
+} -result {yx 1000000 2999999}
+test lmap-7.8 {huge list compiled} -setup {
+ unset -nocomplain a b x
+} -body {
+ set x [apply {{times} {
+ global b
+ lmap a [lrepeat $times x] { set b Y$a }
+ }} 1000000]
list $b [llength $x] [string length $x]
-} {yx 1000000 2999999}
+} -result {Yx 1000000 2999999}
test lmap-7.9 {error then dereference loop var (dev bug)} {
catch { lmap a 0 b {1 2 3} { error x } }
set a