Skip to content

Commit 63cd226

Browse files
committed
chore: plenary tests POC: add make entry, specify tests
1 parent f9dc294 commit 63cd226

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ help-update:
4343
help-check: help-update
4444
git diff --exit-code doc/nvim-tree-lua.txt
4545

46+
#
47+
# test
48+
#
49+
test: plenary.nvim
50+
scripts/test.sh $$TEST_NAME
51+
52+
#
53+
# Dependencies
54+
#
55+
# no plenary tags or releases available
56+
plenary.nvim:
57+
git clone git@github.com:nvim-lua/plenary.nvim.git
58+
4659

4760
.PHONY: all lint style check luacheck style-check style-doc luals style-fix help-update help-check
4861

scripts/test.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
set -e
44

5-
# TODO add ability for user to specify a test file or directory
6-
7-
# TODO clone plenary
8-
95
DIR_REPO="$(git rev-parse --show-toplevel)"
106
export DIR_REPO
117

128
DIR_PLENARY="${DIR_REPO}/plenary.nvim"
139
export DIR_PLENARY
1410

11+
if [ "${#}" -eq 1 ]; then
12+
TEST_NAME="${1}"
13+
else
14+
TEST_NAME="tests"
15+
fi
16+
export TEST_NAME
17+
1518
nvim --headless \
1619
--clean \
1720
-u "${DIR_REPO}/tests/minimal_init.lua" \

tests/test_init.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
local test_harness = require('plenary.test_harness')
2-
3-
local DIR_TEST = vim.env.DIR_REPO .. '/tests'
4-
local FILE_MINIMAL_INIT = DIR_TEST .. '/minimal_init.lua'
5-
6-
test_harness.test_directory(DIR_TEST, { minimal_init = FILE_MINIMAL_INIT })
1+
local test_harness = require("plenary.test_harness")
72

3+
test_harness.test_directory(
4+
vim.env.TEST_NAME,
5+
{
6+
minimal_init = vim.env.DIR_REPO .. "/tests/minimal_init.lua",
7+
sequential = true,
8+
}
9+
)

tests/unit/utils_spec.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ describe("utils.path_add_trailing", function()
1818
end)
1919

2020
describe("utils.canonical_path", function()
21-
2221
before_each(function()
2322
stub(vim.fn, "has")
2423
end)

0 commit comments

Comments
 (0)