Add `_compare()` function to test_helper.bash.

This commit is contained in:
William Melody 2016-01-25 17:20:10 -08:00
parent 8e267fafd7
commit 8faa7a0ab6
1 changed files with 19 additions and 0 deletions

View File

@ -24,3 +24,22 @@ teardown() {
rm "${HOSTS_PATH}"
fi
}
###############################################################################
# Helpers
###############################################################################
# _compare()
#
# Usage:
# _compare <expected> <actual>
#
# Descriotion:
# Compare the content of a variable against an expected value. When used
# within a `@test` block the output is only displayed when the test fails.
_compare() {
local _expected="${1:-}"
local _actual="${2:-}"
printf "expected:\n%s\n" "${_expected}"
printf "actual:\n%s\n" "${_actual}"
}