Skip to content

Commit

Permalink
fixup! poke
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Jun 13, 2023
1 parent 31ed599 commit 9a4c215
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/gitdir_watcher_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe('gitdir_watcher', function()
command('Gitsigns clear_debug')

local test_file3 = test_file..'3'

git{'mv', test_file2, test_file3}

match_debug_messages {
Expand Down Expand Up @@ -114,7 +115,6 @@ describe('gitdir_watcher', function()
}

eq({[1] = test_file}, get_bufs())

end)

end)
1 change: 0 additions & 1 deletion test/gitsigns_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ describe('gitsigns', function()
status = {head='master', added=1, changed=0, removed=0},
signs = {untracked=1}
}
command('Gitsigns clear_debug')

git{"add", newfile}

Expand Down
2 changes: 2 additions & 0 deletions test/gs_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ local test_file_text = {

function M.git(args)
system{"git", "-C", M.scratch, unpack(args)}
helpers.sleep(10)
end

function M.cleanup()
Expand Down Expand Up @@ -267,6 +268,7 @@ function M.check(attrs, interval)
local bstatus2 = exec_lua[[return require'gitsigns.status'[vim.api.nvim_get_current_buf()] ]]
eq(bstatus, bstatus2)

helpers.poke_eventloop()
for _, i in ipairs{'added', 'changed', 'removed', 'head'} do
eq(status[i], bstatus[i],
string.format("status['%s'] did not match gitsigns_status_dict", i))
Expand Down
6 changes: 6 additions & 0 deletions test/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ function M.exec_lua(code, ...)
return M.meths.exec_lua(code, {...})
end

function M.poke_eventloop()
-- Execute 'nvim_eval' (a deferred function) to
-- force at least one main_loop iteration
session:request('nvim_eval', '1')
end

return function(after_each)
if after_each then
after_each(function()
Expand Down

0 comments on commit 9a4c215

Please sign in to comment.