Closed eedwards-sk closed 5 years ago
isolated first instance to __assert
method:
local line
should be
local line=
__assert () {
local correct_num_of_args=${1}
local callback_function=${2}
local callback_args=${3}
local actual_num_of_args=${4}
local failure_msg=${5}
local test_case_calling_assert=${FUNCNAME[2]}
local assert_caller_func_name=${FUNCNAME[1]}
line=$(echo $"(caller 1)" | awk '{print $1}')
local line
if [ "$(correctNumberOfArgs "${actual_num_of_args}" "${correct_num_of_args}")" = "true" ]; then
result=$(${callback_function} "${callback_args}")
if [ "${result}" = "true" ]; then
[[ "$VERBOSE_MODE" = "true" ]] && echo "Line ${line}: Passed - ${test_case_calling_assert}"
incrementPassedTests
else
echo "Line ${line}: ${test_case_calling_assert}: ${assert_caller_func_name}() failed. $failure_msg"
incrementFailedTests
fi
else
echo "Line $line: $test_case_calling_assert: ${assert_caller_func_name}() failed. Expected ${correct_num_of_args} argument(s)."
incrementFailedTests
fi
}
This issue has been corrected via commit 270d3b4974b06325417a9dbccdd6dd22e51ed84e. Closing. Sorry it too so long.
please test this with
set -u
you'll notice that you're using variables that are uninitialized