tests: Run tests in an anon function to catch global variables

This would have caught #593.
This commit is contained in:
Matthew Martin 2019-01-06 21:23:46 -06:00
parent 9bd38c6fc0
commit ba2d8fcf76

View File

@ -33,6 +33,7 @@ setopt NO_UNSET WARN_CREATE_GLOBAL
local -r root=${0:h:h}
(){
# Check an highlighter was given as argument.
[[ -n "$1" ]] || {
echo >&2 "Bail out! You must provide the name of a valid highlighter as argument."
@ -219,3 +220,4 @@ for data_file in $root/highlighters/$1/test-data/*.zsh; do
done
exit $something_failed
} "$@"