mo/run-tests
Tyler Akins b16d73b5a7 Updates for how to source "mo" and then use it
When you source mo, it adds the "mo" function to the environment.
2015-08-27 09:44:04 -05:00

32 lines
532 B
Bash
Executable File

#!/bin/bash
cd "$(dirname $0)"
. ./mo
PASS=0
FAIL=0
for TEST in tests/*.expected; do
BASE="${TEST%.expected}"
echo -n "$BASE ... "
echo "Do not read this input" | (
. "${BASE}.env"
mo "${BASE}.template"
) | 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