2016-03-06 03:53:07 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
2016-03-14 22:50:24 +00:00
|
|
|
DIR="${0:a:h}"
|
2016-03-06 03:53:07 +00:00
|
|
|
ROOT_DIR="$DIR/.."
|
|
|
|
TEST_DIR="$ROOT_DIR/test"
|
|
|
|
|
|
|
|
header() {
|
|
|
|
local message="$1"
|
|
|
|
|
|
|
|
cat <<-EOF
|
|
|
|
|
|
|
|
#====================================================================#
|
|
|
|
# $message
|
|
|
|
#====================================================================#
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2016-03-15 15:03:57 +00:00
|
|
|
# ZSH binary to use
|
|
|
|
local zsh_bin="zsh"
|
|
|
|
|
|
|
|
while getopts ":z:" opt; do
|
|
|
|
case $opt in
|
|
|
|
z)
|
|
|
|
zsh_bin="$OPTARG"
|
|
|
|
;;
|
|
|
|
\?)
|
|
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
:)
|
|
|
|
echo "Option -$OPTARG requires an argument" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $((OPTIND -1))
|
2016-03-06 03:53:07 +00:00
|
|
|
|
|
|
|
# Test suites to run
|
2016-03-15 15:03:57 +00:00
|
|
|
local -a tests
|
|
|
|
if [ $#@ -gt 0 ]; then
|
|
|
|
tests=($@)
|
|
|
|
else
|
|
|
|
tests=($TEST_DIR/**/*_test.zsh)
|
|
|
|
fi
|
|
|
|
|
|
|
|
local -i retval=0
|
2016-03-06 03:53:07 +00:00
|
|
|
|
|
|
|
for suite in $tests; do
|
2016-03-15 15:20:07 +00:00
|
|
|
header "${suite#"$ROOT_DIR/"}"
|
2016-03-15 15:03:57 +00:00
|
|
|
"$zsh_bin" -f "$suite" || retval=$?
|
2016-03-06 03:53:07 +00:00
|
|
|
done
|
|
|
|
|
2016-03-15 15:03:57 +00:00
|
|
|
exit $retval
|