diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-01 12:52:28 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-01 12:52:28 +0300 |
commit | 9dd0d4f8b9217f711fff32e9f47674e556a8fab0 (patch) | |
tree | 7a6fa451d674859d3c7aca308f443709446e56b3 /test/functional/helpers.lua | |
parent | 046d6a8dfe8ef5b319fdd7139303d46b56b5daa6 (diff) | |
download | rneovim-9dd0d4f8b9217f711fff32e9f47674e556a8fab0.tar.gz rneovim-9dd0d4f8b9217f711fff32e9f47674e556a8fab0.tar.bz2 rneovim-9dd0d4f8b9217f711fff32e9f47674e556a8fab0.zip |
unittests: Add trace description right to the error message
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index ab36508262..335cf3c3ff 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -16,6 +16,7 @@ local eq = global_helpers.eq local ok = global_helpers.ok local map = global_helpers.map local filter = global_helpers.filter +local dedent = global_helpers.dedent local start_dir = lfs.currentdir() -- XXX: NVIM_PROG takes precedence, QuickBuild sets it. @@ -191,28 +192,6 @@ local function nvim_feed(input) end end -local function dedent(str) - -- find minimum common indent across lines - local indent = nil - for line in str:gmatch('[^\n]+') do - local line_indent = line:match('^%s+') or '' - if indent == nil or #line_indent < #indent then - indent = line_indent - end - end - if indent == nil or #indent == 0 then - -- no minimum common indent - return str - end - -- create a pattern for the indent - indent = indent:gsub('%s', '[ \t]') - -- strip it from the first line - str = str:gsub('^'..indent, '') - -- strip it from the remaining lines - str = str:gsub('[\n]'..indent, '\n') - return str -end - local function feed(...) for _, v in ipairs({...}) do nvim_feed(dedent(v)) |