From d05b8500c3b1c01ffad193fadad136200c5e324f Mon Sep 17 00:00:00 2001 From: Oleksandr Smirnov Date: Fri, 29 Aug 2025 20:00:27 +0300 Subject: [PATCH] fix(testutils): validate provided cursor position --- spec/testutils.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/testutils.lua b/spec/testutils.lua index fe50300..0b24511 100644 --- a/spec/testutils.lua +++ b/spec/testutils.lua @@ -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