diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-06-21 23:56:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-21 23:56:00 +0200 |
commit | 144f584948a0183382411dd583df9b18cd95b473 (patch) | |
tree | 0ea38fa17b41f5e2871cf0259944f67310f6479d /test/helpers.lua | |
parent | cb8e47c4f88f12e2a107698a250410561807395a (diff) | |
parent | 476c28f433ebd7e3c8dfc2d31c59b3fc4c1c02e5 (diff) | |
download | rneovim-144f584948a0183382411dd583df9b18cd95b473.tar.gz rneovim-144f584948a0183382411dd583df9b18cd95b473.tar.bz2 rneovim-144f584948a0183382411dd583df9b18cd95b473.zip |
Merge #6914 from ZyX-I/func-def-trailing-error
Allow multiple function definitions in one :execute
Diffstat (limited to 'test/helpers.lua')
-rw-r--r-- | test/helpers.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/helpers.lua b/test/helpers.lua index 7a0e4b8c3c..260f10002e 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -284,7 +284,7 @@ local function concat_tables(...) return ret end -local function dedent(str) +local function dedent(str, leave_indent) -- find minimum common indent across lines local indent = nil for line in str:gmatch('[^\n]+') do @@ -297,12 +297,13 @@ local function dedent(str) -- no minimum common indent return str end + local left_indent = (' '):rep(leave_indent or 0) -- create a pattern for the indent indent = indent:gsub('%s', '[ \t]') -- strip it from the first line - str = str:gsub('^'..indent, '') + str = str:gsub('^'..indent, left_indent) -- strip it from the remaining lines - str = str:gsub('[\n]'..indent, '\n') + str = str:gsub('[\n]'..indent, '\n' .. left_indent) return str end |