wait a bit more
This commit is contained in:
parent
f1b983addb
commit
dfc692486b
170
.luacheckcache
Normal file
170
.luacheckcache
Normal file
File diff suppressed because one or more lines are too long
@ -2,6 +2,7 @@ local eq = assert.are.same
|
|||||||
local cur_dir = vim.fn.expand('%:p:h')
|
local cur_dir = vim.fn.expand('%:p:h')
|
||||||
local busted = require('plenary/busted')
|
local busted = require('plenary/busted')
|
||||||
|
|
||||||
|
local godir = cur_dir .. '/lua/tests/fixtures'
|
||||||
describe('should run gopls releated functions', function()
|
describe('should run gopls releated functions', function()
|
||||||
-- vim.fn.readfile('minimal.vim')
|
-- vim.fn.readfile('minimal.vim')
|
||||||
-- vim.fn.writefile(vim.fn.readfile('fixtures/fmt/hello.go'), name)
|
-- vim.fn.writefile(vim.fn.readfile('fixtures/fmt/hello.go'), name)
|
||||||
@ -10,15 +11,15 @@ describe('should run gopls releated functions', function()
|
|||||||
vim.cmd(cmd)
|
vim.cmd(cmd)
|
||||||
require('go').setup({ goimport = 'gopls', lsp_cfg = true })
|
require('go').setup({ goimport = 'gopls', lsp_cfg = true })
|
||||||
it('should run import from file with gopls', function()
|
it('should run import from file with gopls', function()
|
||||||
local path = cur_dir .. '/lua/tests/fixtures/fmt/goimports2.go' -- %:p:h ? %:p
|
local path = './fmt/goimports2.go' -- %:p:h ? %:p
|
||||||
local expected =
|
local expected =
|
||||||
vim.fn.join(vim.fn.readfile(cur_dir .. '/lua/tests/fixtures/fmt/goimports2_golden.go'), '\n')
|
vim.fn.join(vim.fn.readfile(cur_dir .. '/lua/tests/fixtures/fmt/goimports2_golden.go'), '\n')
|
||||||
|
|
||||||
vim.cmd('%bdelete!')
|
vim.cmd('%bdelete!')
|
||||||
|
vim.cmd('cd ' .. godir)
|
||||||
local cmd = " silent exe 'e " .. path .. "'"
|
local cmd = " silent exe 'e " .. path .. "'"
|
||||||
vim.cmd(cmd)
|
vim.cmd(cmd)
|
||||||
|
|
||||||
vim.cmd([[cd %:p:h]])
|
|
||||||
_GO_NVIM_CFG.goimport = 'gopls'
|
_GO_NVIM_CFG.goimport = 'gopls'
|
||||||
vim.wait(2000, function()
|
vim.wait(2000, function()
|
||||||
return false
|
return false
|
||||||
@ -40,14 +41,16 @@ describe('should run gopls releated functions', function()
|
|||||||
end)
|
end)
|
||||||
it('should run import from file with gopls', function()
|
it('should run import from file with gopls', function()
|
||||||
vim.cmd('%bdelete!')
|
vim.cmd('%bdelete!')
|
||||||
local path = cur_dir .. '/lua/tests/fixtures/fmt/goimports3.go' -- %:p:h ? %:p
|
local path = 'fmt/goimports3.go' -- %:p:h ? %:p
|
||||||
local expected =
|
local expected =
|
||||||
vim.fn.join(vim.fn.readfile(cur_dir .. '/lua/tests/fixtures/fmt/goimports3_golden.go'), '\n')
|
vim.fn.join(vim.fn.readfile(cur_dir .. '/lua/tests/fixtures/fmt/goimports3_golden.go'), '\n')
|
||||||
|
|
||||||
|
vim.cmd('cd ' .. godir)
|
||||||
local cmd = " silent exe 'e " .. path .. "'"
|
local cmd = " silent exe 'e " .. path .. "'"
|
||||||
vim.cmd(cmd)
|
vim.cmd(cmd)
|
||||||
|
|
||||||
vim.cmd([[cd %:p:h]])
|
vim.cmd([[cd %:p:h]])
|
||||||
vim.wait(500, function()
|
vim.wait(2000, function()
|
||||||
return false
|
return false
|
||||||
end)
|
end)
|
||||||
require('go.format').goimport()
|
require('go.format').goimport()
|
||||||
|
Loading…
Reference in New Issue
Block a user