mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 05:24:46 +08:00
Add basic Lua ALE functions and test coverage
Ensure that basic ALE functions `ale.var`, `ale.escape`, and `ale.env` are available in Lua. Cover all Lua code so far with busted tests, fixing bugs where ALE variables can be set with Boolean values instead of numbers. Document all functionality so far.
This commit is contained in:
57
test/script/run-lua-tests
Executable file
57
test/script/run-lua-tests
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin/test/lua "$DOCKER_RUN_IMAGE")
|
||||
|
||||
quiet=0
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-q)
|
||||
quiet=1
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-?*)
|
||||
echo "Invalid argument: $1" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
function filter-busted-output() {
|
||||
local hit_failure_line=0
|
||||
|
||||
while read -r; do
|
||||
if ((quiet)); then
|
||||
# If we're using the quiet flag, the filter out lines until we hit
|
||||
# the first line with "Failure" and then print the rest.
|
||||
if ((hit_failure_line)); then
|
||||
echo "$REPLY"
|
||||
elif [[ "$REPLY" = *'Failure'* ]]; then
|
||||
hit_failure_line=1
|
||||
echo "$REPLY"
|
||||
fi
|
||||
else
|
||||
echo "$REPLY"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
exit_code=0
|
||||
|
||||
set -o pipefail
|
||||
"$DOCKER" run -a stdout "${docker_flags[@]}" /usr/bin/busted-5.1 \
|
||||
-m '../../lua/?.lua;../../lua/?/init.lua' . \
|
||||
--output utfTerminal | filter-busted-output || exit_code=$?
|
||||
set +o pipefail
|
||||
|
||||
exit "$exit_code"
|
||||
Reference in New Issue
Block a user