chore: plenary tests POC: add make entry, specify tests

This commit is contained in:
Alexander Courtis 2025-02-03 15:31:33 +11:00
parent f9dc294829
commit 63cd226c3e
4 changed files with 28 additions and 11 deletions

View File

@ -43,6 +43,19 @@ help-update:
help-check: help-update
git diff --exit-code doc/nvim-tree-lua.txt
#
# test
#
test: plenary.nvim
scripts/test.sh $$TEST_NAME
#
# Dependencies
#
# no plenary tags or releases available
plenary.nvim:
git clone git@github.com:nvim-lua/plenary.nvim.git
.PHONY: all lint style check luacheck style-check style-doc luals style-fix help-update help-check

View File

@ -2,16 +2,19 @@
set -e
# TODO add ability for user to specify a test file or directory
# TODO clone plenary
DIR_REPO="$(git rev-parse --show-toplevel)"
export DIR_REPO
DIR_PLENARY="${DIR_REPO}/plenary.nvim"
export DIR_PLENARY
if [ "${#}" -eq 1 ]; then
TEST_NAME="${1}"
else
TEST_NAME="tests"
fi
export TEST_NAME
nvim --headless \
--clean \
-u "${DIR_REPO}/tests/minimal_init.lua" \

View File

@ -1,7 +1,9 @@
local test_harness = require('plenary.test_harness')
local DIR_TEST = vim.env.DIR_REPO .. '/tests'
local FILE_MINIMAL_INIT = DIR_TEST .. '/minimal_init.lua'
test_harness.test_directory(DIR_TEST, { minimal_init = FILE_MINIMAL_INIT })
local test_harness = require("plenary.test_harness")
test_harness.test_directory(
vim.env.TEST_NAME,
{
minimal_init = vim.env.DIR_REPO .. "/tests/minimal_init.lua",
sequential = true,
}
)

View File

@ -18,7 +18,6 @@ describe("utils.path_add_trailing", function()
end)
describe("utils.canonical_path", function()
before_each(function()
stub(vim.fn, "has")
end)