Fix truncate grahic placing and reduce summary to two lines
This commit is contained in:
@@ -42,14 +42,22 @@ tocompete=()
|
||||
rl::printPath() {
|
||||
local testnum="${1:-0}"
|
||||
local input="${2:-"-"}"
|
||||
local truncate_graphic=
|
||||
local inputwidth=${config_path_width}
|
||||
|
||||
if (( flag_extendedOutput )); then
|
||||
printf -- "%-3d Inp: %-${config_path_width}s ---" ${testnum} "${input}"
|
||||
else
|
||||
# Truncate input string on the left if longer than $config_path_width
|
||||
(( ${#input} > ${config_path_width} )) && input="${input:$(( ${#input} - ${config_path_width} + 1 ))}" && truncate_graphic="✀"
|
||||
if (( ${#input} > ${config_path_width} )) ; then
|
||||
# +1 : prepending truncate_graphic
|
||||
input="${input:$(( ${#input} - ${config_path_width} + 1 ))}"
|
||||
# -1 : prepending truncate_graphic
|
||||
inputwidth=$((config_path_width - 1))
|
||||
truncate_graphic="✀"
|
||||
fi
|
||||
# Print input and expected
|
||||
printf "%b%${config_path_width}s" "${truncate_graphic}" "${input}"
|
||||
printf "%b%${inputwidth}s" "${truncate_graphic}" "${input}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -58,18 +66,11 @@ rl::printTestSummary() {
|
||||
local failed=${2:-0}
|
||||
local skipped=${3:-0}
|
||||
local total=$(( success + failed + skipped ))
|
||||
local separator="--------------------"
|
||||
readonly columnwidth=7
|
||||
readonly tableformat="%${columnwidth}s | %${columnwidth}s | %${columnwidth}s | %${columnwidth}s\n"
|
||||
|
||||
cat <<TEST_SUMMARY_EOF
|
||||
|
||||
# Test summary:
|
||||
successful: ${success}
|
||||
failed: ${failed}
|
||||
skipped: ${skipped}
|
||||
TEST_SUMMARY_EOF
|
||||
|
||||
printf "%15s-%s\n" "------" "${separator:0:${#total}}"
|
||||
printf "%15s %d\n" "total:" ${total}
|
||||
printf "\n# Result : ${tableformat}" "success" "failed" "skipped" "total"
|
||||
printf " ${tableformat}" "${success}" "${failed}" "${skipped}" "${total}"
|
||||
}
|
||||
|
||||
# rl::testcmp <TEST NUMBER> <TEST INPUT> <EXPECTED RESULT> <ACTUAL RESULT>
|
||||
@@ -81,7 +82,6 @@ rl::testcmp() {
|
||||
local actual="${4:-"-"}"
|
||||
local testresult=0 #failed
|
||||
local testresult_graphic="${color_red}✗${color_less}" # alt. symbol ≠
|
||||
local truncate_graphic=
|
||||
|
||||
if [[ "${expect}" == "${actual}" ]] ; then
|
||||
# Don't print success for this flag
|
||||
|
Reference in New Issue
Block a user