mirror of
https://github.com/tests-always-included/mo.git
synced 2025-11-19 23:34:32 +01:00
More Bash 4.x compatibility issues found and fixed
This commit is contained in:
@@ -3,7 +3,8 @@ cd "${0%/*}" || exit 1
|
||||
. ../run-tests
|
||||
|
||||
declare -A repo
|
||||
repo[resque]="Resque"
|
||||
# The order of the array elements can be shuffled depending on the version of
|
||||
# Bash. Keeping this to a minimal set and alphabetized seems to help.
|
||||
repo[hub]="Hub"
|
||||
repo[rip]="Rip"
|
||||
export repo
|
||||
@@ -18,7 +19,6 @@ expected() {
|
||||
cat <<EOF
|
||||
<b>hub - Hub</b>
|
||||
<b>rip - Rip</b>
|
||||
<b>resque - Resque</b>
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,21 @@ testArgs() {
|
||||
local args
|
||||
# shellcheck disable=SC2031
|
||||
args=$(declare -p MO_FUNCTION_ARGS)
|
||||
echo -n "${args#*=}"
|
||||
|
||||
# The output from declare -p could look like these
|
||||
# declare -a MO_FUNCTION_ARGS=([0]="one")
|
||||
# declare -ax MO_FUNCTION_ARGS='([0]="one")'
|
||||
# Trim leading declare statement and variable name
|
||||
args="${args#*=}"
|
||||
|
||||
# If there are any quotes, remove them. The function arguments will always
|
||||
# be an array.
|
||||
if [[ "${args:0:1}" == "'" ]]; then
|
||||
args=${args#\'}
|
||||
args=${args%\'}
|
||||
fi
|
||||
|
||||
echo -n "$args"
|
||||
}
|
||||
template() {
|
||||
cat <<EOF
|
||||
|
||||
@@ -93,7 +93,7 @@ This is open source! Please feel free to contribute.
|
||||
|
||||
https://github.com/tests-always-included/mo
|
||||
|
||||
MO_VERSION=3.0.1
|
||||
MO_VERSION=3.0.2
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user