mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-11 09:52:31 +00:00
build: added plenary test runner
This commit is contained in:
parent
08f4804916
commit
f51eb0d957
3 changed files with 37 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
tt.lua
|
tt.lua
|
||||||
|
.tests
|
||||||
|
doc/tags
|
||||||
|
|
32
tests/init.lua
Normal file
32
tests/init.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.root(root)
|
||||||
|
local f = debug.getinfo(1, "S").source:sub(2)
|
||||||
|
return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (root or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param plugin string
|
||||||
|
function M.load(plugin)
|
||||||
|
local name = plugin:match(".*/(.*)")
|
||||||
|
local package_root = M.root(".tests/site/pack/deps/start/")
|
||||||
|
if not vim.loop.fs_stat(package_root .. name) then
|
||||||
|
print("Installing " .. plugin)
|
||||||
|
vim.fn.mkdir(package_root, "p")
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--depth=1",
|
||||||
|
"https://github.com/" .. plugin .. ".git",
|
||||||
|
package_root .. "/" .. name,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
vim.cmd([[set runtimepath=$VIMRUNTIME]])
|
||||||
|
vim.opt.runtimepath:append(M.root())
|
||||||
|
vim.opt.packpath = { M.root(".tests/site") }
|
||||||
|
M.load("nvim-lua/plenary.nvim")
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup()
|
3
tests/run
Executable file
3
tests/run
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}"
|
Loading…
Add table
Reference in a new issue