aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua55
1 files changed, 10 insertions, 45 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index 3a766b99f5..2a6285e685 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -1,8 +1,10 @@
require('vim.compat')
+local shared = require('vim.shared')
local assert = require('luassert')
local luv = require('luv')
local lfs = require('lfs')
local relpath = require('pl.path').relpath
+local Paths = require('test.config.paths')
local quote_me = '[^.%w%+%-%@%_%/]' -- complement (needn't quote)
local function shell_quote(str)
@@ -235,6 +237,11 @@ local function hasenv(name)
return nil
end
+local function deps_prefix()
+ local env = os.getenv('DEPS_PREFIX')
+ return (env and env ~= '') and env or '.deps/usr'
+end
+
local tests_skipped = 0
local function check_cores(app, force)
@@ -263,7 +270,7 @@ local function check_cores(app, force)
else
initial_path = '.'
re = '/core[^/]*$'
- exc_re = { '^/%.deps$', local_tmpdir, '^/%node_modules$' }
+ exc_re = { '^/%.deps$', '^/%'..deps_prefix()..'$', local_tmpdir, '^/%node_modules$' }
db_cmd = gdb_db_cmd
random_skip = true
end
@@ -329,30 +336,6 @@ local function shallowcopy(orig)
return copy
end
-local deepcopy
-
-local function id(v)
- return v
-end
-
-local deepcopy_funcs = {
- table = function(orig)
- local copy = {}
- for k, v in pairs(orig) do
- copy[deepcopy(k)] = deepcopy(v)
- end
- return copy
- end,
- number = id,
- string = id,
- ['nil'] = id,
- boolean = id,
-}
-
-deepcopy = function(orig)
- return deepcopy_funcs[type(orig)](orig)
-end
-
local REMOVE_THIS = {}
local function mergedicts_copy(d1, d2)
@@ -415,6 +398,7 @@ local function updated(d, d2)
return d
end
+-- Concat list-like tables.
local function concat_tables(...)
local ret = {}
for i = 1, select('#', ...) do
@@ -604,24 +588,6 @@ 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
-
local function hexdump(str)
local len = string.len(str)
local dump = ""
@@ -742,7 +708,6 @@ local module = {
check_logs = check_logs,
concat_tables = concat_tables,
dedent = dedent,
- deepcopy = deepcopy,
dictdiff = dictdiff,
eq = eq,
expect_err = expect_err,
@@ -770,7 +735,6 @@ local module = {
repeated_read_cmd = repeated_read_cmd,
shallowcopy = shallowcopy,
sleep = sleep,
- table_flatten = table_flatten,
tmpname = tmpname,
uname = uname,
updated = updated,
@@ -778,5 +742,6 @@ local module = {
write_file = write_file,
trim = trim,
}
+module = shared.tbl_extend('error', module, Paths, shared)
return module