mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
test(tohtml_spec): don't use hard-coded sleeping time (#27770)
Instead cause some changes to screen state and use screen:expect().
This commit is contained in:
@@ -115,18 +115,20 @@ end
|
|||||||
---@param func function?
|
---@param func function?
|
||||||
local function run_tohtml_and_assert(screen, func)
|
local function run_tohtml_and_assert(screen, func)
|
||||||
exec('norm! ggO-;')
|
exec('norm! ggO-;')
|
||||||
exec('norm! gg0f;:\r')
|
screen:expect({ any = vim.pesc('-^;') })
|
||||||
screen:sleep(10)
|
exec('norm! :\rh')
|
||||||
local snapshot = { grid = screen:get_snapshot().grid, attr_ids = screen:get_snapshot().attr_ids }
|
screen:expect({ any = vim.pesc('^-;') })
|
||||||
|
local expected = screen:get_snapshot()
|
||||||
do
|
do
|
||||||
(func or exec)('TOhtml')
|
(func or exec)('TOhtml')
|
||||||
end
|
end
|
||||||
exec('only')
|
exec('only')
|
||||||
html_syntax_match()
|
html_syntax_match()
|
||||||
html_to_extmarks()
|
html_to_extmarks()
|
||||||
exec('norm! gg0f;:\r')
|
exec('norm! gg0f;')
|
||||||
screen:sleep(10)
|
screen:expect({ any = vim.pesc('-^;') })
|
||||||
eq(snapshot, { grid = screen:get_snapshot().grid, attr_ids = screen:get_snapshot().attr_ids })
|
exec('norm! :\rh')
|
||||||
|
screen:expect({ grid = expected.grid, attr_ids = expected.attr_ids })
|
||||||
end
|
end
|
||||||
|
|
||||||
describe(':TOhtml', function()
|
describe(':TOhtml', function()
|
||||||
@@ -288,7 +290,7 @@ describe(':TOhtml', function()
|
|||||||
--api.nvim_buf_set_extmark(0,ns,3,0,{virt_text={{'foo'}},virt_text_pos='right_align'})
|
--api.nvim_buf_set_extmark(0,ns,3,0,{virt_text={{'foo'}},virt_text_pos='right_align'})
|
||||||
run_tohtml_and_assert(screen)
|
run_tohtml_and_assert(screen)
|
||||||
end)
|
end)
|
||||||
it('highlgith', function()
|
it('highlight', function()
|
||||||
insert [[
|
insert [[
|
||||||
line1
|
line1
|
||||||
]]
|
]]
|
||||||
|
Reference in New Issue
Block a user