mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 07:23:00 +00:00
Add syntax check
This commit is contained in:
parent
f7cda8c817
commit
7ef3d694a7
1 changed files with 11 additions and 0 deletions
11
tests.sh
11
tests.sh
|
@ -2,6 +2,12 @@
|
||||||
# Make sure the current directory is the location of this script to simplify matters
|
# Make sure the current directory is the location of this script to simplify matters
|
||||||
cd "$(dirname "$(readlink -f "$0")")" || { echo "Error: Failed to cd to script directory" >&2; exit 1; };
|
cd "$(dirname "$(readlink -f "$0")")" || { echo "Error: Failed to cd to script directory" >&2; exit 1; };
|
||||||
|
|
||||||
|
# To run Luacheck:
|
||||||
|
#
|
||||||
|
# luacheck . --ignore 631 61[124] 412 21[123] --globals minetest worldedit worldeditadditions worldeditadditions_commands worldeditadditions_core vector assert bit it describe bonemeal --codes -j "$(nproc)" --quiet --exclude-files .luarocks/*
|
||||||
|
#
|
||||||
|
# This is a work-in-progress, as it currently throws an *enormous* number of warnings.
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
log_msg() {
|
log_msg() {
|
||||||
|
@ -35,6 +41,10 @@ run_setup() {
|
||||||
luarocks --tree "${luarocks_root}" install busted;
|
luarocks --tree "${luarocks_root}" install busted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_syntax_check() {
|
||||||
|
find . -type f -name '*.lua' -not -path '*luarocks*' -not -path '*.git/*' -print0 | xargs -0 -n1 -P "$(nproc)" luac -p;
|
||||||
|
}
|
||||||
|
|
||||||
run_test() {
|
run_test() {
|
||||||
.luarocks/bin/busted --no-auto-insulate --pattern ".test.lua" .tests;
|
.luarocks/bin/busted --no-auto-insulate --pattern ".test.lua" .tests;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +58,7 @@ case "${mode}" in
|
||||||
if [[ ! -d "${luarocks_root}" ]]; then
|
if [[ ! -d "${luarocks_root}" ]]; then
|
||||||
run_setup;
|
run_setup;
|
||||||
fi
|
fi
|
||||||
|
run_syntax_check;
|
||||||
run_test;
|
run_test;
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue