test: add headless test framework
This commit is contained in:
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
emmylua_check --output-format=json . 2> >(grep -v '^Check finished$' >&2) \
|
||||
| jq -r '
|
||||
.[]
|
||||
| .file as $f
|
||||
| .diagnostics[]
|
||||
| "\($f):\(.range.start.line + 1):\(.range.start.character + 1)"
|
||||
+ ": \(["error","warning","info","hint"][.severity-1])"
|
||||
+ ": \(.message | rtrimstr(" ")) [\(.code)]"
|
||||
' \
|
||||
| sed "s|^$PWD/||"
|
||||
|
||||
exit "${PIPESTATUS[0]}"
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: ${0##*/} [--help] [TARGET ...]
|
||||
|
||||
Run Neovim integration tests in a single 'nvim --headless' instance.
|
||||
|
||||
With no targets, runs every test/**/*_test.lua. Each TARGET may be a
|
||||
test file or a directory; directories expand to all _test.lua files
|
||||
beneath them.
|
||||
|
||||
Exit status is 0 if all tests passed, non-zero otherwise.
|
||||
EOF
|
||||
}
|
||||
|
||||
if [[ ${1:-} == --help || ${1:-} == -h ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
if [[ -t 1 ]]; then
|
||||
export TEST_COLOR=1
|
||||
fi
|
||||
|
||||
exec nvim --headless --clean -l test/runner.lua "$@"
|
||||
Reference in New Issue
Block a user