aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua65
1 files changed, 42 insertions, 23 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index 1c64f41b65..91ceed4df1 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -7,13 +7,13 @@ local check_logs_useless_lines = {
['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
}
-local eq = function(exp, act)
- return assert.are.same(exp, act)
+local function eq(expected, actual)
+ return assert.are.same(expected, actual)
end
-local neq = function(exp, act)
- return assert.are_not.same(exp, act)
+local function neq(expected, actual)
+ return assert.are_not.same(expected, actual)
end
-local ok = function(res)
+local function ok(res)
return assert.is_true(res)
end
@@ -534,30 +534,49 @@ local function fixtbl_rec(tbl)
return fixtbl(tbl)
end
+-- From https://github.com/premake/premake-core/blob/master/src/base/table.lua
+local function table_flatten(arr)
+ local result = {}
+ local function _table_flatten(_arr)
+ local n = #_arr
+ for i = 1, n do
+ local v = _arr[i]
+ if type(v) == "table" then
+ _table_flatten(v)
+ elseif v then
+ table.insert(result, v)
+ end
+ end
+ end
+ _table_flatten(arr)
+ return result
+end
+
return {
- eq = eq,
- neq = neq,
- ok = ok,
- check_logs = check_logs,
- uname = uname,
- tmpname = tmpname,
- map = map,
- filter = filter,
- glob = glob,
- check_cores = check_cores,
- hasenv = hasenv,
- which = which,
- shallowcopy = shallowcopy,
- deepcopy = deepcopy,
- mergedicts_copy = mergedicts_copy,
- dictdiff = dictdiff,
REMOVE_THIS = REMOVE_THIS,
+ check_cores = check_cores,
+ check_logs = check_logs,
concat_tables = concat_tables,
dedent = dedent,
+ deepcopy = deepcopy,
+ dictdiff = dictdiff,
+ eq = eq,
+ filter = filter,
+ fixtbl = fixtbl,
+ fixtbl_rec = fixtbl_rec,
format_luav = format_luav,
format_string = format_string,
+ glob = glob,
+ hasenv = hasenv,
intchar2lua = intchar2lua,
+ map = map,
+ mergedicts_copy = mergedicts_copy,
+ neq = neq,
+ ok = ok,
+ shallowcopy = shallowcopy,
+ table_flatten = table_flatten,
+ tmpname = tmpname,
+ uname = uname,
updated = updated,
- fixtbl = fixtbl,
- fixtbl_rec = fixtbl_rec,
+ which = which,
}