2015-01-23 17:43:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cd "$(dirname $0)"
|
|
|
|
|
2015-08-27 14:44:04 +00:00
|
|
|
. ./mo
|
2015-01-23 17:43:08 +00:00
|
|
|
PASS=0
|
|
|
|
FAIL=0
|
|
|
|
|
|
|
|
for TEST in tests/*.expected; do
|
|
|
|
BASE="${TEST%.expected}"
|
|
|
|
|
|
|
|
echo -n "$BASE ... "
|
2015-01-23 18:05:27 +00:00
|
|
|
echo "Do not read this input" | (
|
2015-01-23 17:43:08 +00:00
|
|
|
. "${BASE}.env"
|
2015-08-27 14:44:04 +00:00
|
|
|
mo "${BASE}.template"
|
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
|