diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-08 10:24:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 10:24:46 +0800 |
commit | 970b60aa7c899851973285f9b33f5f49cae55f76 (patch) | |
tree | cd5e42d1a31ce04809719dd5659bc71fe847f224 | |
parent | d0b3c872192152d5b09a92e53e3986b9fe64a3d9 (diff) | |
download | rneovim-970b60aa7c899851973285f9b33f5f49cae55f76.tar.gz rneovim-970b60aa7c899851973285f9b33f5f49cae55f76.tar.bz2 rneovim-970b60aa7c899851973285f9b33f5f49cae55f76.zip |
test(tohtml_spec): don't use hard-coded sleeping time (#27770)
Instead cause some changes to screen state and use screen:expect().
-rw-r--r-- | test/functional/plugin/tohtml_spec.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua index 0d0f10671f..2ac0fe1fa3 100644 --- a/test/functional/plugin/tohtml_spec.lua +++ b/test/functional/plugin/tohtml_spec.lua @@ -115,18 +115,20 @@ end ---@param func function? local function run_tohtml_and_assert(screen, func) exec('norm! ggO-;') - exec('norm! gg0f;:\r') - screen:sleep(10) - local snapshot = { grid = screen:get_snapshot().grid, attr_ids = screen:get_snapshot().attr_ids } + screen:expect({ any = vim.pesc('-^;') }) + exec('norm! :\rh') + screen:expect({ any = vim.pesc('^-;') }) + local expected = screen:get_snapshot() do (func or exec)('TOhtml') end exec('only') html_syntax_match() html_to_extmarks() - exec('norm! gg0f;:\r') - screen:sleep(10) - eq(snapshot, { grid = screen:get_snapshot().grid, attr_ids = screen:get_snapshot().attr_ids }) + exec('norm! gg0f;') + screen:expect({ any = vim.pesc('-^;') }) + exec('norm! :\rh') + screen:expect({ grid = expected.grid, attr_ids = expected.attr_ids }) end 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'}) run_tohtml_and_assert(screen) end) - it('highlgith', function() + it('highlight', function() insert [[ line1 ]] |