Skip to content

Commit 9ac1e05

Browse files
committed
chore: plenary tests POC
1 parent d05881f commit 9ac1e05

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/luals-out/
22
/luals/
3+
/plenary.nvim/
34
# backup vim files
45
*~

.luarc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"workspace": {
55
"library": [
66
"$VIMRUNTIME/lua/vim",
7-
"${3rd}/luv/library"
7+
"${3rd}/luv/library",
8+
"plenary.nvim"
89
]
910
},
1011
"diagnostics": {

scripts/test.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# TODO add ability for user to specify a test file or directory
6+
7+
REPO_DIR="$(git rev-parse --show-toplevel)"
8+
PLENARY_DIR="${REPO_DIR}/plenary.nvim"
9+
10+
nvim --headless \
11+
--clean \
12+
--noplugin \
13+
-c "set runtimepath+=${PLENARY_DIR}" \
14+
-c "lua require('plenary.test_harness').test_directory('tests/', { minimal_init = './tests/minimal_init.lua' })" \
15+
-c "qa!"
16+

tests/minimal_init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- this file is necessary for the minimal_init option which directs the spawned nvim test instances be run with --noplugin

tests/unit/utils_spec.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---@type Luassert
2+
local assert = require("luassert")
3+
4+
local utils = require("nvim-tree.utils")
5+
6+
describe("utils.path_add_trailing", function()
7+
before_each(function()
8+
end)
9+
10+
it("trailing added", function()
11+
assert.equals(utils.path_add_trailing("foo"), "foo/")
12+
end)
13+
14+
it("trailing already present", function()
15+
assert.equals(utils.path_add_trailing("foo/"), "foo/")
16+
end)
17+
end)

0 commit comments

Comments
 (0)