Skip to content

Commit

Permalink
Merge pull request #41 from rafritts/bugfix/FixUnboundVariables
Browse files Browse the repository at this point in the history
Fixed unbound Line value
  • Loading branch information
Ryan Fritts committed Jun 21, 2019
2 parents b5a666e + 3e0590b commit 270d3b4
Showing 1 changed file with 5 additions and 6 deletions.
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

0 comments on commit 270d3b4

Please sign in to comment.