mirror of
https://github.com/tests-always-included/mo.git
synced 2024-12-18 16:27:52 +00:00
7a271b58f6
This lets me run tests in a terminal. If I mess up and the terminal is being read by `cat` or similar, this input is used instead and now my tests will automatically fail properly.
31 lines
529 B
Bash
Executable File
31 lines
529 B
Bash
Executable File
#!/bin/bash
|
|
|
|
cd "$(dirname $0)"
|
|
|
|
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
|