2018-09-16 10:11:03 -07:00
|
|
|
#!/usr/bin/env bash
|
2015-12-05 17:47:43 -08:00
|
|
|
# quicktest runs the ShellCheck unit tests in an interpreted mode.
|
|
|
|
|
# This allows running tests without compiling, which can be faster.
|
|
|
|
|
# 'cabal test' remains the source of truth.
|
|
|
|
|
|
2021-10-15 18:03:05 -07:00
|
|
|
path=$(find . -type f -path './dist*/Paths_ShellCheck.hs' | sort | head -n 1)
|
|
|
|
|
if [ -z "$path" ]
|
|
|
|
|
then
|
|
|
|
|
echo >&2 "Unable to find Paths_ShellCheck.hs. Please 'cabal build' once."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
path="${path%/*}"
|
|
|
|
|
|
|
|
|
|
|
2015-12-05 17:47:43 -08:00
|
|
|
(
|
2021-10-15 18:03:05 -07:00
|
|
|
var=$(echo 'main' | ghci -isrc -i"$path" test/shellcheck.hs 2>&1 | tee /dev/stderr)
|
2019-01-07 22:25:09 -08:00
|
|
|
if [[ $var == *ExitSuccess* ]]
|
2015-12-05 17:47:43 -08:00
|
|
|
then
|
|
|
|
|
exit 0
|
|
|
|
|
else
|
2016-03-19 16:14:55 -07:00
|
|
|
grep -C 3 -e "Fail" -e "Tracing" <<< "$var"
|
2015-12-05 17:47:43 -08:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
) 2>&1
|