test(iferr): add test
chore(ci): install go, and go bins for tests
This commit is contained in:
parent
ecb9919e02
commit
8b1bb40baa
6 changed files with 103 additions and 6 deletions
27
spec/integration/iferr_test.lua
Normal file
27
spec/integration/iferr_test.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local t = require "spec.testutils"
|
||||
|
||||
local child = MiniTest.new_child_neovim()
|
||||
local T = MiniTest.new_set {
|
||||
hooks = {
|
||||
post_once = child.stop,
|
||||
pre_case = function()
|
||||
child.restart { "-u", "scripts/minimal_init.lua" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
T["iferr"] = MiniTest.new_set {}
|
||||
T["iferr"]["works"] = function()
|
||||
local tmp = vim.env.HOME .. "/test.go"
|
||||
|
||||
local fixtures = t.fixtures.read "iferr/iferr"
|
||||
t.fixtures.write(tmp, fixtures.input)
|
||||
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.fn.setpos(".", { child.fn.bufnr "%", 8, 2, 0 })
|
||||
child.cmd "GoIfErr"
|
||||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(tmp), fixtures.output)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
@ -1,9 +1,27 @@
|
|||
local t = require "spec.testutils"
|
||||
|
||||
local T = MiniTest.new_set {}
|
||||
local child = MiniTest.new_child_neovim()
|
||||
local T = MiniTest.new_set {
|
||||
hooks = {
|
||||
post_once = child.stop,
|
||||
pre_case = function()
|
||||
child.restart { "-u", "scripts/minimal_init.lua" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
T["struct_tags"] = MiniTest.new_set {}
|
||||
T["struct_tags"]["fuck it"] = function()
|
||||
t.eq(1, 1)
|
||||
T["struct_tags"][".add"] = function()
|
||||
local tmp = vim.env.HOME .. "/test.go"
|
||||
|
||||
local fixtures = t.fixtures.read "tags/add"
|
||||
t.fixtures.write(tmp, fixtures.input)
|
||||
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.fn.setpos(".", { child.fn.bufnr "%", 3, 6, 0 })
|
||||
child.cmd "GoTagAdd json"
|
||||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(tmp), fixtures.output)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue