Improve test framework

In the assert() function, if --message option is given, append the details
of the failed command to the message.
This commit is contained in:
Andrew Bettison 2017-12-06 15:09:32 +10:30
parent bc6396ec28
commit 988250a576

View File

@ -1608,7 +1608,7 @@ end_fixture() {
assert() {
_tfw_getopts assert "$@"
shift $_tfw_getopts_shift
[ -z "$_tfw_message" ] && _tfw_message=$(shellarg "$@")
_tfw_message="${_tfw_message:+$_tfw_message }("$@")"
_tfw_assert "$@" || _tfw_failexit || return $?
$_tfw_assert_noise && tfw_log "# assert $_tfw_message"
return 0