aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index 0bc62da5d7..6f7281db7c 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -90,6 +90,24 @@ local function tmpname()
end
end
+local function map(func, tab)
+ local rettab = {}
+ for k, v in pairs(tab) do
+ rettab[k] = func(v)
+ end
+ return rettab
+end
+
+local function filter(filter_func, tab)
+ local rettab = {}
+ for _, entry in pairs(tab) do
+ if filter_func(entry) then
+ table.insert(rettab, entry)
+ end
+ end
+ return rettab
+end
+
return {
eq = eq,
neq = neq,
@@ -97,4 +115,6 @@ return {
check_logs = check_logs,
uname = uname,
tmpname = tmpname,
+ map = map,
+ filter = filter,
}