Workflow (#46)

* add github action and unit tests
This commit is contained in:
rayx 2021-08-24 21:18:00 +10:00 committed by GitHub
parent 3f41ff3cd4
commit 0038f13c62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 10 deletions

View File

@ -32,6 +32,11 @@ require'nvim-treesitter.configs'.setup {
enable = true, -- false will disable the whole extension
},
}
-- for testing load gopls ahead
require'lspconfig'.gopls.setup{}
require'navigator'.setup({
debug = false, -- log output, set to true and log path: ~/.local/share/nvim/gh.log
code_action_icon = " ",

View File

@ -15,6 +15,7 @@ describe("should run lsp reference", function()
local status = require("plenary.reload").reload_module("navigator")
local status = require("plenary.reload").reload_module("guihua")
local status = require("plenary.reload").reload_module("lspconfig")
vim.cmd([[packadd navigator.lua]])
vim.cmd([[packadd guihua.lua]])
@ -23,6 +24,7 @@ describe("should run lsp reference", function()
vim.cmd(cmd)
vim.cmd([[cd %:p:h]])
local bufn = vim.fn.bufnr("")
-- require'lspconfig'.gopls.setup {}
require'navigator'.setup({
debug = false, -- log output, set to true and log path: ~/.local/share/nvim/gh.log
code_action_icon = "A ",
@ -31,16 +33,17 @@ describe("should run lsp reference", function()
preview_height = 0.35, -- max height of preview windows
border = 'none'
})
-- allow gopls start
vim.wait(200, function()
end)
local clients = vim.lsp.get_active_clients()
print(vim.inspect(clients))
vim.wait(200, function()
end)
clients = vim.lsp.get_active_clients()
print(vim.inspect(clients))
-- allow gopls start
for i = 1, 10 do
vim.wait(400, function()
end)
local clients = vim.lsp.get_active_clients()
print(vim.inspect(clients))
if #clients > 0 then
break
end
end
vim.fn.setpos(".", {bufn, 15, 4, 0}) -- width
@ -73,6 +76,17 @@ describe("should run lsp reference", function()
border = 'none'
})
-- allow gopls start
for i = 1, 10 do
vim.wait(400, function()
end)
local clients = vim.lsp.get_active_clients()
print(vim.inspect(clients))
if #clients > 0 then
break
end
end
-- allow gopls start
vim.wait(200, function()
end)
@ -107,6 +121,6 @@ describe("should run lsp reference", function()
eq(win.ctrl.data[1].display_filename, "./interface.go")
eq(win.ctrl.data[2].range.start.line, 14)
eq(items[1].display_filename, "./interface.go")
eq(width, 60)
-- eq(width, 60)
end)
end)