Use released rdlink for testing and build it if missing

This commit is contained in:
2022-03-22 10:54:22 +01:00
parent 24cd62e720
commit 3fcfe89c19
2 changed files with 16 additions and 14 deletions

View File

@@ -17,8 +17,9 @@
# 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}/../rdlink.sh"
readonly tool_rdlink="${test_dir}/../release/rdlink.sh"
readonly tool_readlink="$(command -v readlink) -f --"
readonly build_cmd="${test_dir}/../build.sh"
readonly config_path_width=45
@@ -163,6 +164,8 @@ rl::test() {
esac
done
[[ ! -e "${tool_rdlink}" ]] && "${build_cmd}"
# Cmd line arguments
(( ! flag_onlycompete )) && [[ ! "$@" ]] && toassert_init
@@ -183,13 +186,12 @@ rl::test() {
# Save first element for string compare
firstelement="${path}"
# Check for excludes
elif excludemsg="$(toexclude "${firstelement}")"; then
# Current path is excluded
(( tests_skipped++ ))
rl::printPath "$(( i/2 ))" "${firstelement}" && printf " %b skip (%s)\n" "🛇" "${excludemsg}"
# Execute tests
else
# Do the compare between two following elements
# Execute test case
if ! rl::testcmp "$(( i/2 ))" "${firstelement}" \
"${path}" "$($tool_rdlink -- "${firstelement}")"; then
(( tests_failed++ ))
@@ -231,13 +233,13 @@ rl::test() {
(( ! flag_extendedOutput )) && printf "%${config_path_width}s %s %s\n" "<INPUT>" "<EXPECTED>" "✗ [ACTUAL]"
else
# Check for excludes
if excludemsg="$(toexclude "${path}")" ; then
# Current path is excluded
(( tests_skipped++ ))
rl::printPath "${i}" "${path}" && printf " %b skip (%s)\n" "🛇" "${excludemsg}"
# Execute tests
elif ! rl::testcmp "${i}" "${path}" \
"$(${tool_readlink} "$path")" "$(${tool_rdlink} -- "$path")"; then
# Test case failed
(( tests_failed++ ))
# Run all tests if option -a is pressend
(( ! $flag_runall )) && testend=1 && break