mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 17:58:18 +00:00
test: move trim to global helpers
This commit is contained in:
@@ -11,6 +11,7 @@ local retry = helpers.retry
|
|||||||
local rmdir = helpers.rmdir
|
local rmdir = helpers.rmdir
|
||||||
local sleep = helpers.sleep
|
local sleep = helpers.sleep
|
||||||
local read_file = helpers.read_file
|
local read_file = helpers.read_file
|
||||||
|
local trim = helpers.trim
|
||||||
|
|
||||||
describe('fileio', function()
|
describe('fileio', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
@@ -79,11 +80,11 @@ describe('fileio', function()
|
|||||||
feed('Abar<esc>')
|
feed('Abar<esc>')
|
||||||
command('write')
|
command('write')
|
||||||
|
|
||||||
local foo_contents = read_file('Xtest_startup_file1')
|
local foobar_contents = trim(read_file('Xtest_startup_file1'))
|
||||||
local bar_contents = read_file('Xtest_startup_file1~')
|
local bar_contents = trim(read_file('Xtest_startup_file1~'))
|
||||||
|
|
||||||
eq('foobar\n', foo_contents);
|
eq('foobar', foobar_contents);
|
||||||
eq('foo\n', bar_contents);
|
eq('foo', bar_contents);
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@@ -25,6 +25,7 @@ local read_file = global_helpers.read_file
|
|||||||
local sleep = global_helpers.sleep
|
local sleep = global_helpers.sleep
|
||||||
local table_flatten = global_helpers.table_flatten
|
local table_flatten = global_helpers.table_flatten
|
||||||
local write_file = global_helpers.write_file
|
local write_file = global_helpers.write_file
|
||||||
|
local trim = global_helpers.trim
|
||||||
|
|
||||||
local start_dir = lfs.currentdir()
|
local start_dir = lfs.currentdir()
|
||||||
-- XXX: NVIM_PROG takes precedence, QuickBuild sets it.
|
-- XXX: NVIM_PROG takes precedence, QuickBuild sets it.
|
||||||
@@ -797,6 +798,7 @@ local module = {
|
|||||||
window = window,
|
window = window,
|
||||||
winmeths = winmeths,
|
winmeths = winmeths,
|
||||||
write_file = write_file,
|
write_file = write_file,
|
||||||
|
trim = trim,
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(after_each)
|
return function(after_each)
|
||||||
|
@@ -731,6 +731,10 @@ local function read_nvim_log()
|
|||||||
return log
|
return log
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function trim(s)
|
||||||
|
return s:match('^%s*(.*%S)') or ''
|
||||||
|
end
|
||||||
|
|
||||||
local module = {
|
local module = {
|
||||||
REMOVE_THIS = REMOVE_THIS,
|
REMOVE_THIS = REMOVE_THIS,
|
||||||
argss_to_cmd = argss_to_cmd,
|
argss_to_cmd = argss_to_cmd,
|
||||||
@@ -772,6 +776,7 @@ local module = {
|
|||||||
updated = updated,
|
updated = updated,
|
||||||
which = which,
|
which = which,
|
||||||
write_file = write_file,
|
write_file = write_file,
|
||||||
|
trim = trim,
|
||||||
}
|
}
|
||||||
|
|
||||||
return module
|
return module
|
||||||
|
@@ -16,6 +16,7 @@ local neq = global_helpers.neq
|
|||||||
local map = global_helpers.map
|
local map = global_helpers.map
|
||||||
local eq = global_helpers.eq
|
local eq = global_helpers.eq
|
||||||
local ok = global_helpers.ok
|
local ok = global_helpers.ok
|
||||||
|
local trim = global_helpers.trim
|
||||||
|
|
||||||
-- C constants.
|
-- C constants.
|
||||||
local NULL = ffi.cast('void*', 0)
|
local NULL = ffi.cast('void*', 0)
|
||||||
@@ -120,10 +121,6 @@ local deinit = only_separate(function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function trim(s)
|
|
||||||
return s:match('^%s*(.*%S)') or ''
|
|
||||||
end
|
|
||||||
|
|
||||||
-- a Set that keeps around the lines we've already seen
|
-- a Set that keeps around the lines we've already seen
|
||||||
local cdefs_init = Set:new()
|
local cdefs_init = Set:new()
|
||||||
local cdefs_mod = nil
|
local cdefs_mod = nil
|
||||||
|
Reference in New Issue
Block a user