mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 00:22:41 +00:00
tests: Fix repeated_popen_r usage, rename the function
This commit is contained in:
@@ -9,7 +9,7 @@ local nvim_prog = helpers.nvim_prog
|
|||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
|
|
||||||
local popen_w = global_helpers.popen_w
|
local popen_w = global_helpers.popen_w
|
||||||
local repeated_popen_r = global_helpers.repeated_popen_r
|
local repeated_read_cmd = global_helpers.repeated_read_cmd
|
||||||
|
|
||||||
describe('Command-line option', function()
|
describe('Command-line option', function()
|
||||||
describe('-s', function()
|
describe('-s', function()
|
||||||
@@ -48,10 +48,9 @@ describe('Command-line option', function()
|
|||||||
eq(nil, lfs.attributes(fname))
|
eq(nil, lfs.attributes(fname))
|
||||||
eq(true, not not dollar_fname:find('%$%w+'))
|
eq(true, not not dollar_fname:find('%$%w+'))
|
||||||
write_file(dollar_fname, ':call setline(1, "100500")\n:wqall!\n')
|
write_file(dollar_fname, ':call setline(1, "100500")\n:wqall!\n')
|
||||||
local pipe = repeated_popen_r(
|
local stdout = repeated_read_cmd(
|
||||||
nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '-s', dollar_fname,
|
nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '-s', dollar_fname,
|
||||||
fname)
|
fname)
|
||||||
local stdout = pipe:read('*a')
|
|
||||||
eq('', stdout)
|
eq('', stdout)
|
||||||
local attrs = lfs.attributes(fname)
|
local attrs = lfs.attributes(fname)
|
||||||
eq(#('100500\n'), attrs.size)
|
eq(#('100500\n'), attrs.size)
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ local function which(exe)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function repeated_popen_r(...)
|
local function repeated_read_cmd(...)
|
||||||
for _ = 1, 10 do
|
for _ = 1, 10 do
|
||||||
local stream = popen_r(...)
|
local stream = popen_r(...)
|
||||||
local ret = stream:read('*a')
|
local ret = stream:read('*a')
|
||||||
@@ -286,5 +286,5 @@ return {
|
|||||||
argss_to_cmd = argss_to_cmd,
|
argss_to_cmd = argss_to_cmd,
|
||||||
popen_r = popen_r,
|
popen_r = popen_r,
|
||||||
popen_w = popen_w,
|
popen_w = popen_w,
|
||||||
repeated_popen_r = repeated_popen_r,
|
repeated_read_cmd = repeated_read_cmd,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ local ffi = require("ffi")
|
|||||||
local global_helpers = require('test.helpers')
|
local global_helpers = require('test.helpers')
|
||||||
|
|
||||||
local argss_to_cmd = global_helpers.argss_to_cmd
|
local argss_to_cmd = global_helpers.argss_to_cmd
|
||||||
local repeated_popen_r = global_helpers.repeated_popen_r
|
local repeated_read_cmd = global_helpers.repeated_read_cmd
|
||||||
|
|
||||||
local ccs = {}
|
local ccs = {}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ function Gcc:filter_standard_defines(defines)
|
|||||||
local pseudoheader_fname = 'tmp_empty_pseudoheader.h'
|
local pseudoheader_fname = 'tmp_empty_pseudoheader.h'
|
||||||
local pseudoheader_file = io.open(pseudoheader_fname, 'w')
|
local pseudoheader_file = io.open(pseudoheader_fname, 'w')
|
||||||
pseudoheader_file:close()
|
pseudoheader_file:close()
|
||||||
local standard_defines = repeated_popen_r(self.path,
|
local standard_defines = repeated_read_cmd(self.path,
|
||||||
self.preprocessor_extra_flags,
|
self.preprocessor_extra_flags,
|
||||||
self.get_defines_extra_flags,
|
self.get_defines_extra_flags,
|
||||||
{pseudoheader_fname})
|
{pseudoheader_fname})
|
||||||
@@ -194,7 +194,7 @@ function Gcc:preprocess(previous_defines, ...)
|
|||||||
pseudoheader_file:flush()
|
pseudoheader_file:flush()
|
||||||
pseudoheader_file:close()
|
pseudoheader_file:close()
|
||||||
|
|
||||||
local defines = repeated_popen_r(self.path, self.preprocessor_extra_flags,
|
local defines = repeated_read_cmd(self.path, self.preprocessor_extra_flags,
|
||||||
self.get_defines_extra_flags,
|
self.get_defines_extra_flags,
|
||||||
{pseudoheader_fname})
|
{pseudoheader_fname})
|
||||||
defines = self:filter_standard_defines(defines)
|
defines = self:filter_standard_defines(defines)
|
||||||
@@ -205,7 +205,7 @@ function Gcc:preprocess(previous_defines, ...)
|
|||||||
-- io.stderr\write("CWD: #{lfs.currentdir!}\n")
|
-- io.stderr\write("CWD: #{lfs.currentdir!}\n")
|
||||||
-- io.stderr\write("CMD: #{cmd}\n")
|
-- io.stderr\write("CMD: #{cmd}\n")
|
||||||
|
|
||||||
local declarations = repeated_popen_r(self.path,
|
local declarations = repeated_read_cmd(self.path,
|
||||||
self.preprocessor_extra_flags,
|
self.preprocessor_extra_flags,
|
||||||
self.get_declarations_extra_flags,
|
self.get_declarations_extra_flags,
|
||||||
{pseudoheader_fname})
|
{pseudoheader_fname})
|
||||||
|
|||||||
Reference in New Issue
Block a user