mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Improve test framework
- assertStderrIs/assertStdoutIs now support echo options; can use -e to interpolate backlash sequences
This commit is contained in:
parent
ee09ea92f3
commit
3c27f7efeb
@ -48,7 +48,7 @@
|
|||||||
# test_feature2() {
|
# test_feature2() {
|
||||||
# execute programUnderTest --feature2 arg1 arg2
|
# execute programUnderTest --feature2 arg1 arg2
|
||||||
# assertExitStatus '==' 1
|
# assertExitStatus '==' 1
|
||||||
# assertStdoutIs ""
|
# assertStdoutIs -e "Response:\tok\n"
|
||||||
# assertStderrGrep "^ERROR: missing arg3$"
|
# assertStderrGrep "^ERROR: missing arg3$"
|
||||||
# }
|
# }
|
||||||
# runTests "$@"
|
# runTests "$@"
|
||||||
@ -474,13 +474,14 @@ _tfw_assert_stdxxx_is() {
|
|||||||
local qual="$1"
|
local qual="$1"
|
||||||
shift
|
shift
|
||||||
_tfw_getopts_assert filecontent --$qual "$@"
|
_tfw_getopts_assert filecontent --$qual "$@"
|
||||||
shift $_tfw_getopts_shift
|
shift $((_tfw_getopts_shift - 1))
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
_tfw_error "incorrect arguments"
|
_tfw_error "incorrect arguments"
|
||||||
return 254
|
return 254
|
||||||
fi
|
fi
|
||||||
local message="${_tfw_message:-$qual of ${_tfw_last_argv0##*/} is \"$1\"}"
|
local message="${_tfw_message:-$qual of ${_tfw_last_argv0##*/} is $*}"
|
||||||
if ! [ "$1" = $(/bin/cat $_tfw_tmp/$qual) ]; then
|
echo -n "$@" >$_tfw_tmp/stdxxx_is.tmp
|
||||||
|
if ! /usr/bin/cmp --quiet $_tfw_tmp/stdxxx_is.tmp "$_tfw_tmp/$qual"; then
|
||||||
_tfw_failmsg "assertion failed: $message"
|
_tfw_failmsg "assertion failed: $message"
|
||||||
_tfw_backtrace >&2
|
_tfw_backtrace >&2
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user