Improving test report and return values

This commit is contained in:
2022-03-23 10:56:37 +01:00
parent bf303a608b
commit eb626d0f90
3 changed files with 22 additions and 7 deletions

View File

@@ -85,7 +85,7 @@ rl::test() {
# Check if assertion tests need to be performed
(( ! flag_onlycompete )) && [[ ! "$@" ]] && toassert_init
# Compare against expected result
if (( ${#toassert[@]} )) ; then
rl::printTitle
@@ -173,15 +173,15 @@ rl::test() {
done
rl::printTestSummary $tests_success $tests_failed $tests_skipped
(( testend )) && return 1 || return 0
return ${tests_failed}
}
rl::printTitle() {
(( flag_title )) && return 0
flag_title=1
# See if some tests will be performed
printf "# Testing rdlink version %s\n" "${tool_rdlink_version}"
printf "# Testing rdlink version %s\n\n" "${tool_rdlink_version}"
printf " Testdate: %s\n" "$(date -u +"%Y-%m-%d %H:%M:%S UTC")"
}
@@ -229,7 +229,7 @@ rl::testcmp() {
local testresult=0 #failed
local testresult_graphic="${color_red}${color_less}" # alt. symbol ≠
local link="$(readlink -- "${input}")"
if [[ "${expect}" == "${actual}" ]] ; then
# Don't print success for this flag
(( flag_printerror )) && return 0
@@ -273,3 +273,4 @@ rl::testcmp() {
#time rl::test "$@"
rl::test "$@"