parent
76e817b5e1
commit
f23cb97d1a
37 changed files with 188 additions and 472 deletions
|
|
@ -6,11 +6,9 @@ local testutils = {}
|
|||
testutils.mininit_path = vim.fs.joinpath(base_dir, "scripts", "minimal_init.lua")
|
||||
testutils.fixtures_dir = vim.fs.joinpath(base_dir, "spec/fixtures")
|
||||
|
||||
---@param mod string Module name for which to create a nested test set.
|
||||
---@return MiniTest.child child nvim client.
|
||||
---@return table T root test set created by `MiniTest.new_set()`.
|
||||
---@return table mod_name nested set of tests in `T[mod]`.
|
||||
function testutils.setup(mod)
|
||||
---@param name string
|
||||
---@return MiniTest.child, table
|
||||
function testutils.setup(name)
|
||||
local child = MiniTest.new_child_neovim()
|
||||
local T = MiniTest.new_set {
|
||||
hooks = {
|
||||
|
|
@ -21,8 +19,8 @@ function testutils.setup(mod)
|
|||
},
|
||||
}
|
||||
|
||||
T[mod] = MiniTest.new_set {}
|
||||
return child, T, T[mod]
|
||||
T[name] = MiniTest.new_set {}
|
||||
return child, T
|
||||
end
|
||||
|
||||
---@generic T
|
||||
|
|
@ -78,8 +76,6 @@ 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)
|
||||
|
||||
|
|
@ -88,8 +84,6 @@ 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