navi/test/core.sh
Denis Isidoro 2753e84ea6
Revert "Use dictionaries (#47)" (#48)
This reverts commit 9848d7b39a.
2019-09-23 15:08:36 -03:00

35 lines
529 B
Bash

#!/usr/bin/env bash
source "${SCRIPT_DIR}/src/main.sh"
PASSED=0
FAILED=0
test::success() {
PASSED=$((PASSED+1))
echo "Test passed!"
}
test::fail() {
FAILED=$((FAILED+1))
echo "Test failed..."
return
}
test::run() {
echo
echo "-> $1"
shift
eval "$*" && test::success || test::fail
}
test::finish() {
echo
if [ $FAILED -gt 0 ]; then
echo "${PASSED} tests passed but ${FAILED} failed... :("
exit "${FAILED}"
else
echo "All ${PASSED} tests passed! :)"
exit 0
fi
}