mo/run-tests

40 lines
759 B
Plaintext
Raw Normal View History

2015-10-02 14:46:41 +00:00
#!/usr/bin/env bash
2015-01-23 17:43:08 +00:00
cd "$(dirname $0)"
. ./mo
2015-01-23 17:43:08 +00:00
PASS=0
FAIL=0
for TEST in tests/*.expected; do
BASE="${TEST%.expected}"
MO_FALSE_IS_EMPTY=
2015-01-23 17:43:08 +00:00
echo -n "$BASE ... "
(
if [[ -f "${BASE}.sh" ]]; then
# Run a shell script if one exists
"${BASE}.sh"
else
# Fall back to using .env and .template
. "${BASE}.env"
echo "Do not read this input" | mo "${BASE}.template"
fi
2015-01-23 17:43:08 +00:00
) | diff -wU5 - "${TEST}" > "${BASE}.diff"
if [[ $? -ne 0 ]]; then
echo "FAIL"
FAIL=$(( $FAIL + 1 ))
else
echo "ok"
PASS=$(( $PASS + 1 ))
rm "${BASE}.diff"
fi
done
echo ""
echo "Pass: $PASS"
echo "Fail: $FAIL"
[[ $FAIL -gt 0 ]] && exit 1