mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
Merge #10733 from justinmk/test-fixes
test: use shell-test (avoid system shell)
This commit is contained in:
@@ -302,6 +302,10 @@ end
|
|||||||
local function nvim_feed(input)
|
local function nvim_feed(input)
|
||||||
while #input > 0 do
|
while #input > 0 do
|
||||||
local written = module.request('nvim_input', input)
|
local written = module.request('nvim_input', input)
|
||||||
|
if written == nil then
|
||||||
|
module.assert_alive()
|
||||||
|
error('nvim_input returned nil (Nvim process terminated?)')
|
||||||
|
end
|
||||||
input = input:sub(written + 1)
|
input = input:sub(written + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -586,6 +590,11 @@ function module.expect_any(contents)
|
|||||||
return ok(nil ~= string.find(module.curbuf_contents(), contents, 1, true))
|
return ok(nil ~= string.find(module.curbuf_contents(), contents, 1, true))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Checks that the Nvim session did not terminate.
|
||||||
|
function module.assert_alive()
|
||||||
|
eq(2, module.eval('1+1'))
|
||||||
|
end
|
||||||
|
|
||||||
local function do_rmdir(path)
|
local function do_rmdir(path)
|
||||||
if lfs.attributes(path, 'mode') ~= 'directory' then
|
if lfs.attributes(path, 'mode') ~= 'directory' then
|
||||||
return -- Don't complain.
|
return -- Don't complain.
|
||||||
|
@@ -27,11 +27,7 @@ describe(':terminal', function()
|
|||||||
echomsg "msg3"
|
echomsg "msg3"
|
||||||
]])
|
]])
|
||||||
-- Invoke a command that emits frequent terminal activity.
|
-- Invoke a command that emits frequent terminal activity.
|
||||||
if iswin() then
|
feed([[:terminal "]]..nvim_dir..[[/shell-test" REP 9999 !terminal_output!<cr>]])
|
||||||
feed_command([[terminal for /L \%I in (1,0,2) do echo \%I]])
|
|
||||||
else
|
|
||||||
feed_command([[terminal while true; do echo X; done]])
|
|
||||||
end
|
|
||||||
feed([[<C-\><C-N>]])
|
feed([[<C-\><C-N>]])
|
||||||
wait()
|
wait()
|
||||||
-- Wait for some terminal activity.
|
-- Wait for some terminal activity.
|
||||||
|
@@ -16,8 +16,8 @@ local retry = helpers.retry
|
|||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local wait = helpers.wait
|
local wait = helpers.wait
|
||||||
local nvim = helpers.nvim
|
local nvim = helpers.nvim
|
||||||
local iswin = helpers.iswin
|
|
||||||
local sleep = helpers.sleep
|
local sleep = helpers.sleep
|
||||||
|
local nvim_dir = helpers.nvim_dir
|
||||||
|
|
||||||
local default_text = [[
|
local default_text = [[
|
||||||
Inc substitution on
|
Inc substitution on
|
||||||
@@ -2555,56 +2555,18 @@ it(':substitute with inccommand during :terminal activity', function()
|
|||||||
clear()
|
clear()
|
||||||
|
|
||||||
command("set cmdwinheight=3")
|
command("set cmdwinheight=3")
|
||||||
if iswin() then
|
feed([[:terminal "]]..nvim_dir..[[/shell-test" REP 5000 xxx<cr>]])
|
||||||
feed([[:terminal for /L \%I in (1,1,5000) do @(echo xxx & echo xxx & echo xxx)<cr>]])
|
|
||||||
else
|
|
||||||
feed([[:terminal for i in $(seq 1 5000); do printf 'xxx\nxxx\nxxx\n'; done<cr>]])
|
|
||||||
end
|
|
||||||
command('file term')
|
command('file term')
|
||||||
|
feed('G') -- Follow :terminal output.
|
||||||
command('new')
|
command('new')
|
||||||
common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz')
|
common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz')
|
||||||
command('wincmd =')
|
command('wincmd =')
|
||||||
|
|
||||||
-- Wait for terminal output.
|
|
||||||
screen:expect([[
|
|
||||||
bar baz fox |
|
|
||||||
bar foo ba^z |
|
|
||||||
{15:~ }|
|
|
||||||
{15:~ }|
|
|
||||||
{15:~ }|
|
|
||||||
{15:~ }|
|
|
||||||
{11:[No Name] [+] }|
|
|
||||||
xxx |
|
|
||||||
xxx |
|
|
||||||
xxx |
|
|
||||||
xxx |
|
|
||||||
xxx |
|
|
||||||
xxx |
|
|
||||||
{10:term }|
|
|
||||||
|
|
|
||||||
]])
|
|
||||||
|
|
||||||
feed('gg')
|
feed('gg')
|
||||||
feed(':%s/foo/ZZZ')
|
feed(':%s/foo/ZZZ')
|
||||||
sleep(20) -- Allow some terminal activity.
|
sleep(20) -- Allow some terminal activity.
|
||||||
screen:expect([[
|
helpers.wait()
|
||||||
{12:ZZZ} bar baz |
|
screen:expect_unchanged()
|
||||||
bar baz fox |
|
|
||||||
bar {12:ZZZ} baz |
|
|
||||||
{15:~ }|
|
|
||||||
{15:~ }|
|
|
||||||
{15:~ }|
|
|
||||||
{11:[No Name] [+] }|
|
|
||||||
xxx |
|
|
||||||
xxx |
|
|
||||||
{10:term }|
|
|
||||||
|1| {12:ZZZ} bar baz |
|
|
||||||
|3| bar {12:ZZZ} baz |
|
|
||||||
{15:~ }|
|
|
||||||
{10:[Preview] }|
|
|
||||||
:%s/foo/ZZZ^ |
|
|
||||||
]])
|
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@ local funcs = helpers.funcs
|
|||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
|
local nvim_dir = helpers.nvim_dir
|
||||||
|
|
||||||
describe("'wildmenu'", function()
|
describe("'wildmenu'", function()
|
||||||
local screen
|
local screen
|
||||||
@@ -83,13 +84,8 @@ describe("'wildmenu'", function()
|
|||||||
it('is preserved during :terminal activity', function()
|
it('is preserved during :terminal activity', function()
|
||||||
command('set wildmenu wildmode=full')
|
command('set wildmenu wildmode=full')
|
||||||
command('set scrollback=4')
|
command('set scrollback=4')
|
||||||
if iswin() then
|
feed([[:terminal "]]..nvim_dir..[[/shell-test" REP 5000 !terminal_output!<cr>]])
|
||||||
feed([[:terminal for /L \%I in (1,1,5000) do @(echo foo & echo foo & echo foo)<cr>]])
|
feed('G') -- Follow :terminal output.
|
||||||
else
|
|
||||||
feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]])
|
|
||||||
end
|
|
||||||
|
|
||||||
feed([[<C-\><C-N>gg]])
|
|
||||||
feed([[:sign <Tab>]]) -- Invoke wildmenu.
|
feed([[:sign <Tab>]]) -- Invoke wildmenu.
|
||||||
-- NB: in earlier versions terminal output was redrawn during cmdline mode.
|
-- NB: in earlier versions terminal output was redrawn during cmdline mode.
|
||||||
-- For now just assert that the screen remains unchanged.
|
-- For now just assert that the screen remains unchanged.
|
||||||
@@ -114,13 +110,7 @@ describe("'wildmenu'", function()
|
|||||||
|
|
||||||
-- Exiting cmdline should show the buffer.
|
-- Exiting cmdline should show the buffer.
|
||||||
feed([[<C-\><C-N>]])
|
feed([[<C-\><C-N>]])
|
||||||
screen:expect([[
|
screen:expect{any=[[!terminal_output!]]}
|
||||||
^foo |
|
|
||||||
foo |
|
|
||||||
foo |
|
|
||||||
foo |
|
|
||||||
|
|
|
||||||
]])
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('ignores :redrawstatus called from a timer #7108', function()
|
it('ignores :redrawstatus called from a timer #7108', function()
|
||||||
|
Reference in New Issue
Block a user