mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
functests: Add tests
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user