summaryrefslogtreecommitdiff
path: root/tests/support/util.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/support/util.tcl')
-rw-r--r--tests/support/util.tcl22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index 8153ad8bb..c7aef0f50 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -1039,3 +1039,25 @@ proc memory_usage {key} {
}
return $usage
}
+
+# forward compatibility, lmap missing in TCL 8.5
+proc lmap args {
+ set body [lindex $args end]
+ set args [lrange $args 0 end-1]
+ set n 0
+ set pairs [list]
+ foreach {varnames listval} $args {
+ set varlist [list]
+ foreach varname $varnames {
+ upvar 1 $varname var$n
+ lappend varlist var$n
+ incr n
+ }
+ lappend pairs $varlist $listval
+ }
+ set temp [list]
+ foreach {*}$pairs {
+ lappend temp [uplevel 1 $body]
+ }
+ set temp
+}