fix(tests): some how i now i need to run vim.treesitter.start() to make it work
This commit is contained in:
parent
47bdebe67d
commit
867d57cfbc
3 changed files with 9 additions and 2 deletions
|
|
@ -30,7 +30,6 @@ vim.env.XDG_DATA_HOME = root ".tests/data"
|
|||
vim.env.XDG_STATE_HOME = root ".tests/state"
|
||||
vim.env.XDG_CACHE_HOME = root ".tests/cache"
|
||||
|
||||
vim.cmd [[set runtimepath=$VIMRUNTIME]]
|
||||
vim.opt.runtimepath:append(root())
|
||||
vim.opt.packpath:append(root ".tests/site")
|
||||
vim.notify = vim.print
|
||||
|
|
|
|||
|
|
@ -44,12 +44,16 @@ T["struct_tags"]["should add more than one tag"] = function()
|
|||
|
||||
--- with comma, like gomodifytags
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.lua "vim.treesitter.start()"
|
||||
|
||||
child.fn.setpos(".", { child.fn.bufnr(tmp), 3, 1 })
|
||||
child.cmd "GoTagAdd test4,test5"
|
||||
child.cmd "write"
|
||||
|
||||
-- without comma
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.lua "vim.treesitter.start()"
|
||||
|
||||
child.fn.setpos(".", { child.fn.bufnr(tmp), 3, 1 })
|
||||
child.cmd "GoTagAdd test1 test2"
|
||||
child.cmd "write"
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ end
|
|||
---@class gopher.TestUtilsSetup
|
||||
---@field tmp string
|
||||
---@field fixtures gopher.TestUtilsFixtures
|
||||
---@field bufnr number
|
||||
|
||||
---@param fixture string
|
||||
---@param child MiniTest.child
|
||||
|
|
@ -80,13 +81,16 @@ function testutils.setup_test(fixture, child, pos)
|
|||
|
||||
testutils.writefile(tmp, fixtures.input)
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.lua "vim.treesitter.start()"
|
||||
|
||||
local bufnr = child.fn.bufnr(tmp)
|
||||
if pos then
|
||||
child.fn.setpos(".", { child.fn.bufnr(tmp), unpack(pos) })
|
||||
child.fn.setpos(".", { bufnr, unpack(pos) })
|
||||
end
|
||||
|
||||
return {
|
||||
tmp = tmp,
|
||||
bufnr = bufnr,
|
||||
fixtures = fixtures,
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue