Skip to content

Commit

Permalink
vim.wait2
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-x committed Feb 9, 2024
1 parent a765508 commit d7ce359
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/tests/go_gopls_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,20 @@ describe('should run gopls releated functions', function()

print('workspaces:', vim.inspect(vim.lsp.buf.list_workspace_folders()))
local fmt
require('go.utils').log(vim.inspect(expected))
require('go.utils').log('waiting for import')
vim.cmd([[wa]])
local success = vim.wait(2000, function()
local success, no = vim.wait(2000, function()
fmt = vim.fn.join(vim.fn.readfile(path), '\n')
require('go.utils').log(vim.inspect(fmt))
if expected == fmt then
require('go.utils').log('success:', fmt, expected)
return true
end
return false
end, 200)

require('go.utils').log('success:', success, no, fmt, expected)
if success then
eq(1, 1)
else
Expand Down

0 comments on commit d7ce359

Please sign in to comment.