Show link target for input (if available)

Revert run rdlink from release (cannot show debug with -xd)
This commit is contained in:
2022-03-22 18:18:58 +01:00
parent 21024f24af
commit ac939e3bb9

View File

@@ -17,15 +17,15 @@
# Internal tests will be executed if no arguments are found
readonly test_dir="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
readonly tool_rdlink="${test_dir}/../release/rdlink.sh"
readonly tool_rdlink="${test_dir}/../rdlink.sh"
readonly tool_readlink="$(command -v readlink) -f --"
readonly build_cmd="${test_dir}/../build.sh"
readonly config_path_width=45
readonly color_red='\033[1;31m'
readonly color_yellow='\033[1;33m'
readonly color_green='\033[1;32m'
readonly color_blue='\033[1;34m'
readonly color_less='\033[0m'
flag_runall=0
@@ -83,7 +83,8 @@ rl::testcmp() {
local actual="${4:-"-"}"
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
@@ -91,10 +92,11 @@ rl::testcmp() {
testresult_graphic="${color_green}${color_less}" # alt. symbol ✓
fi
# Show only reslult as quick overview
# Show result as table (without debug)
if (( flag_extendedOutput )); then
rl::printPath ${testnum} "${input}"
printf " %b\n" "${testresult_graphic}"
[[ "$link" ]] && printf "%10s %b %s%b\n" "" "${color_blue}" "${link}" "${color_less}"
if (( ! testresult )); then
# Test failed
printf " Result: %s\n Exp: %s\n" "${actual}" "${expect}"
@@ -115,6 +117,7 @@ rl::testcmp() {
(( ! testresult )) && testresult_graphic="→" # "${color_green}→${color_less}"
rl::printPath "" "${input}"
printf " %b %s\n" "${testresult_graphic}" "${expect}"
[[ "$link" ]] && printf "%b" "${color_blue}" && rl::printPath "" "${link}" && printf " %b\n" "${color_less}" #⤷
# Print actual result if test failed
if (( ! testresult )); then
printf "%$((config_path_width))s %b %s\n" " " "${color_red}${color_less}" "${actual}"
@@ -164,8 +167,6 @@ rl::test() {
esac
done
[[ ! -e "${tool_rdlink}" ]] && "${build_cmd}"
# Cmd line arguments
(( ! flag_onlycompete )) && [[ ! "$@" ]] && toassert_init