1
0
mirror of https://github.com/dylanaraps/pure-bash-bible.git synced 2025-09-09 22:51:16 +02:00

cleanup tests

This commit is contained in:
Dylan Araps
2018-06-15 10:17:17 +10:00
parent 9ba26572cb
commit 6119fc7b20

10
test.sh
View File

@@ -121,20 +121,18 @@ test_date() {
} }
assert_equals() { assert_equals() {
local status
((tests+=1)) ((tests+=1))
[[ "$1" == "$2" ]] && status="✔"
printf '%s\n' " ${status:-} | ${FUNCNAME[1]/test_}"
if [[ "$1" == "$2" ]]; then if [[ "$1" == "$2" ]]; then
((pass+=1)) ((pass+=1))
return 0 status=$'\e[32m✔'
else else
:>/tmp/err :>/tmp/err
((err+=1)) ((err+=1))
return 1 status=$'\e[31m✖'
fi fi
printf ' %s\e[m | %s\n' "$status" "${FUNCNAME[1]/test_}"
} }
main() { main() {