Skip to content

Commit cf5bfe0

Browse files
committed
ci: replace test_file Make target with generated test_xxx per module
Details: - Was: FILE=tests/test_ai.lua make test_file - Now: make test_ai
1 parent f0d6e89 commit cf5bfe0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ If your contribution updates code, please make sure that it doesn't break existi
9999

100100
- From command line:
101101
- Execute `make test` to run all tests (with `nvim` as executable).
102-
- Execute `FILE=tests/test_xxx.lua make test_file` to run tests only from file `tests/test_xxx.lua` (with `nvim` as executable).
102+
- Execute `make test_xxx` to run tests only from file `tests/test_xxx.lua` (with `nvim` as executable). For example, `make test_ai`.
103103
- If you have multiple Neovim executables (say, `nvim_07`, `nvim_08`, `nvim_09`, `nvim_010`), you can use `NVIM_EXEC` variable to tests against multiple versions like this:
104-
`NVIM_EXEC="nvim_07 nvim_08 nvim_09 nvim_010" make test` or `NVIM_EXEC="nvim_07 nvim_08 nvim_09 nvim_010" FILE=tests/test_xxx.lua make test_file`.
104+
`NVIM_EXEC="nvim_07 nvim_08 nvim_09 nvim_010" make test` or `NVIM_EXEC="nvim_07 nvim_08 nvim_09 nvim_010" make test_xxx`.
105105
- Inside Neovim instance execute `:lua require('mini.test').setup(); MiniTest.run()` to run all tests or `:lua require('mini.test').setup(); MiniTest.run_file()` to run tests only from current buffer.
106106

107107
This plugin uses 'mini.test' to manage its tests. For a more hands-on introduction, see [TESTING.md](TESTING.md).

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ NVIM_EXEC ?= nvim
33

44
all: test documentation
55

6+
# Use `make test` to run tests for all modules
67
test:
78
for nvim_exec in $(NVIM_EXEC); do \
89
printf "\n======\n\n" ; \
@@ -12,13 +13,16 @@ test:
1213
-c "lua MiniTest.run({ execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = $(GROUP_DEPTH) }) } })" ; \
1314
done
1415

15-
test_file:
16+
# Use `make test_xxx` to run tests for module 'mini.xxx'
17+
TEST_MODULES = $(basename $(notdir $(wildcard tests/test_*.lua)))
18+
19+
$(TEST_MODULES):
1620
for nvim_exec in $(NVIM_EXEC); do \
1721
printf "\n======\n\n" ; \
1822
$$nvim_exec --version | head -n 1 && echo '' ; \
1923
$$nvim_exec --headless --noplugin -u ./scripts/minimal_init.lua \
2024
-c "lua require('mini.test').setup()" \
21-
-c "lua MiniTest.run_file('$(FILE)', { execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = $(GROUP_DEPTH) }) } })" ; \
25+
-c "lua MiniTest.run_file('tests/$@.lua', { execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = $(GROUP_DEPTH) }) } })" ; \
2226
done
2327

2428
documentation:

0 commit comments

Comments
 (0)