Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unbound Line value #41

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions bunit.shl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ showHelp () {

showVersion () {
echo ""
echo "BashScriptTestingLibrary: Version 1.0.1"
echo "bunit: Version 1.0.1"
echo ""
}

Expand Down Expand Up @@ -107,8 +107,7 @@ __assert () {
local test_case_calling_assert=${FUNCNAME[2]}
local assert_caller_func_name=${FUNCNAME[1]}

line=$(echo $"(caller 1)" | awk '{print $1}')
local line
local line=$(echo $(caller 1) | awk '{print $1}')

if [ "$(correctNumberOfArgs "${actual_num_of_args}" "${correct_num_of_args}")" = "true" ]; then
result=$(${callback_function} "${callback_args}")
Expand Down Expand Up @@ -201,11 +200,11 @@ runUnitTests () {
START_TIME=$(date +%s)

# Explanation of the following command:
# grep - E - Use extended regexp
# ^(function )? - Lines may start with the keyword function followed by space
# grep -E - Use extended regexp
# ^(function )? - Lines may start with the keyword 'function' followed by space
# test.*?\( - Match any line with 'test[anything] (', doesn't need 'function'
# sed 's/^function //' - Remove the 'function ' prefix from any string, if it occurs
# tr - d ' (){' - Remove the trailing ' (){' characters
# tr -d ' (){' - Remove the trailing ' (){' characters
test_names=$(grep -E '^(function )?test.*?\(' "$0" | sed 's/^function //' | tr -d ' (){')

test_names_array=($test_names)
Expand Down