Skip to content

Commit

Permalink
Add test run script
Browse files Browse the repository at this point in the history
  • Loading branch information
MisanthropicBit committed Jan 10, 2025
1 parent 50e2e30 commit ac2c12d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
doc/tags
.test_output.tmp
lua_modules/
luarocks
.luarocks/
26 changes: 26 additions & 0 deletions run-tests.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---@param command string
---@param args string[]
---@return string
local function run_command(command, args)
local result = vim.fn.system(vim.list_extend({ command }, args))

if vim.v.shell_error ~= 0 then
error("Failed to run command")
end

return result
end

-- Path for the plugin being tested
vim.opt.rtp:append(".")

local lua_path = run_command("luarocks", { "path", "--lr-path" })
local lua_cpath = run_command("luarocks", { "path", "--lr-cpath" })

-- Paths for the project-local luarocks packages
package.path = package.path .. ";" .. lua_path

-- Paths for the project-local shared libraries
package.cpath = package.cpath .. ";" .. lua_cpath

require("busted.runner")({ standalone = false })
4 changes: 0 additions & 4 deletions tests/minimal_init.lua

This file was deleted.

4 changes: 2 additions & 2 deletions winmove.nvim-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ build = {

test_dependencies = {
"busted >= 2.2.0",
"neotest-busted >= 0.3.0",
}

test = {
type = "busted",
type = "command",
command = "nvim -l ./run-tests.lua",
}

0 comments on commit ac2c12d

Please sign in to comment.