fix(testutils): validate provided cursor position
This commit is contained in:
parent
b6d3815f9b
commit
d6b41494f1
1 changed files with 4 additions and 0 deletions
|
|
@ -78,6 +78,8 @@ end
|
|||
---@param pos? number[]
|
||||
---@return gopher.TestUtilsSetup
|
||||
function testutils.setup_test(fixture, child, pos)
|
||||
vim.validate("pos", pos, "table", true)
|
||||
|
||||
local tmp = testutils.tmpfile()
|
||||
local fixtures = testutils.get_fixtures(fixture)
|
||||
|
||||
|
|
@ -86,6 +88,8 @@ function testutils.setup_test(fixture, child, pos)
|
|||
|
||||
local bufnr = child.fn.bufnr(tmp)
|
||||
if pos then
|
||||
assert(#pos == 2, "invalid cursor position")
|
||||
|
||||
child.fn.setpos(".", { bufnr, unpack(pos) })
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue