feat(test): testing infrastructure
This commit is contained in:
parent
d974567a8d
commit
ae1df3e7a8
9 changed files with 668 additions and 3 deletions
23
spec/helpers.lua
Normal file
23
spec/helpers.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
vim.cmd([[set runtimepath=$VIMRUNTIME]])
|
||||
vim.opt.runtimepath:append(vim.fn.getcwd())
|
||||
vim.opt.packpath = {}
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.create_buffer(lines)
|
||||
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines or {})
|
||||
return bufnr
|
||||
end
|
||||
|
||||
function M.delete_buffer(bufnr)
|
||||
if bufnr and vim.api.nvim_buf_is_valid(bufnr) then
|
||||
vim.api.nvim_buf_delete(bufnr, { force = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_extmarks(bufnr, ns)
|
||||
return vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, { details = true })
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue