pipeline updates as treesitter-master no-longer supports nvim 0.6.1. First github 500 stars
This commit is contained in:
parent
4bc6b563ce
commit
331e14d728
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
manager: sudo snap
|
||||
packages: go
|
||||
- os: ubuntu-22.04
|
||||
url: https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-linux64.tar.gz
|
||||
url: https://github.com/neovim/neovim/releases/download/v0.7.2/nvim-linux64.tar.gz
|
||||
manager: sudo snap
|
||||
packages: go
|
||||
- os: ubuntu-20.04
|
||||
|
32
lua/tests/fixtures/fill/fill_struct_golden.txt
vendored
Normal file
32
lua/tests/fixtures/fill/fill_struct_golden.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
package fill
|
||||
|
||||
type Server struct {
|
||||
Name string
|
||||
ID int
|
||||
MyHomeAddress string
|
||||
SubDomains []string
|
||||
Empty string
|
||||
Example int64
|
||||
Example2 string
|
||||
Bar struct {
|
||||
Four string
|
||||
Five string
|
||||
}
|
||||
Lala interface{}
|
||||
} // eos
|
||||
// eof
|
||||
|
||||
func fillServer() {
|
||||
sv := Server{
|
||||
Name: "",
|
||||
ID: 0,
|
||||
MyHomeAddress: "",
|
||||
SubDomains: []string{},
|
||||
Empty: "",
|
||||
Example: 0,
|
||||
Example2: "",
|
||||
Bar: struct{Four string; Five string}{},
|
||||
Lala: nil,
|
||||
}
|
||||
_ = sv
|
||||
}
|
22
lua/tests/fixtures/fill/fill_struct_input.go
vendored
Normal file
22
lua/tests/fixtures/fill/fill_struct_input.go
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
package fill
|
||||
|
||||
type Server struct {
|
||||
Name string
|
||||
ID int
|
||||
MyHomeAddress string
|
||||
SubDomains []string
|
||||
Empty string
|
||||
Example int64
|
||||
Example2 string
|
||||
Bar struct {
|
||||
Four string
|
||||
Five string
|
||||
}
|
||||
Lala interface{}
|
||||
} // eos
|
||||
// eof
|
||||
|
||||
func fillServer() {
|
||||
sv := Server{}
|
||||
_ = sv
|
||||
}
|
3
lua/tests/fixtures/fill/go.mod
vendored
Normal file
3
lua/tests/fixtures/fill/go.mod
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module fill
|
||||
|
||||
go 1.17
|
45
lua/tests/go_fillstruct_spec.lua
Normal file
45
lua/tests/go_fillstruct_spec.lua
Normal file
@ -0,0 +1,45 @@
|
||||
local _ = require("plenary/busted")
|
||||
|
||||
local eq = assert.are.same
|
||||
local cur_dir = vim.fn.expand("%:p:h")
|
||||
-- local status = require("plenary.reload").reload_module("go.nvim")
|
||||
-- status = require("plenary.reload").reload_module("nvim-treesitter")
|
||||
-- local ulog = require('go.utils').log
|
||||
describe("should run fillstruct", function()
|
||||
vim.cmd([[packadd go.nvim]])
|
||||
vim.cmd([[packadd nvim-treesitter]])
|
||||
|
||||
status = require("plenary.reload").reload_module("go.nvim")
|
||||
status = require("plenary.reload").reload_module("nvim-treesitter/nvim-treesitter")
|
||||
require("go").setup({ verbose = true })
|
||||
_GO_NVIM_CFG.fillstruct = "fillstruct"
|
||||
it("should run fillstruct", function()
|
||||
--
|
||||
local name = vim.fn.tempname() .. ".go"
|
||||
local path = cur_dir .. "/lua/tests/fixtures/fill/fill_struct_input.go" -- %:p:h ? %:p
|
||||
local lines = vim.fn.readfile(path)
|
||||
vim.fn.writefile(lines, name)
|
||||
vim.o.ft = "go"
|
||||
local expected = vim.fn.join(vim.fn.readfile(cur_dir .. "/lua/tests/fixtures/fill/fill_struct_golden.txt"), "\n")
|
||||
local cmd = " silent exe 'e " .. path .. "'"
|
||||
vim.cmd(cmd)
|
||||
|
||||
vim.cmd("sleep 100m") -- allow gopls startup
|
||||
vim.fn.setpos(".", { 0, 20, 14, 0 })
|
||||
|
||||
vim.bo.filetype = "go"
|
||||
|
||||
require("go.reftool").fillstruct()
|
||||
|
||||
vim.cmd("sleep 100m") -- allow cleanup
|
||||
vim.wait(100, function()
|
||||
local filled = vim.api.nvim_buf_get_lines(0, 0, 40, false)
|
||||
|
||||
-- local path = cur_dir .. "/lua/tests/fixtures/fill/fill_struct_input.go2" -- %:p:h ? %:p
|
||||
-- vim.fn.writefile(filled, path)
|
||||
|
||||
filled = vim.fn.join(filled, "\n")
|
||||
eq(expected, filled)
|
||||
end)
|
||||
end)
|
||||
end)
|
@ -8,6 +8,10 @@ local cur_dir = vim.fn.expand("%:p:h")
|
||||
describe("should run fixplurals", function()
|
||||
vim.cmd([[packadd go.nvim]])
|
||||
vim.cmd([[packadd nvim-treesitter]])
|
||||
if vim.fn.has('nvim-0.7') == 0 then
|
||||
-- treesitter master require nvim-0.7+
|
||||
return eq(1, 1)
|
||||
end
|
||||
|
||||
status = require("plenary.reload").reload_module("go.nvim")
|
||||
status = require("plenary.reload").reload_module("nvim-treesitter/nvim-treesitter")
|
||||
|
Loading…
Reference in New Issue
Block a user