mirror of
https://github.com/octoleo/hosts.git
synced 2025-01-01 05:31:49 +00:00
Add _compare()
function to test_helper.bash.
This commit is contained in:
parent
8e267fafd7
commit
8faa7a0ab6
@ -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}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user