2 Commits

Author SHA1 Message Date
Tyler Akins
31ff19e954 Fixing the test for the 3.1.0 release 2026-01-19 17:44:13 -06:00
Tyler Akins
40a715137c Now with better Bash 3.2 support! 2026-01-19 17:40:08 -06:00
2 changed files with 6 additions and 2 deletions

6
mo
View File

@@ -1032,6 +1032,9 @@ mo::isArrayIndexValid() {
# #
# Returns true (0) if the variable is set, 1 if the variable is unset. # Returns true (0) if the variable is set, 1 if the variable is unset.
MO_VAR_TEST="ok" MO_VAR_TEST="ok"
# This must not use `[[` because otherwise Bash 3.2 will stop execution and
# always write to stderr without the ability to capture it.
if test -v "MO_VAR_TEST" &> /dev/null; then if test -v "MO_VAR_TEST" &> /dev/null; then
mo::debug "Using declare -p and [[ -v ]] for variable checks" mo::debug "Using declare -p and [[ -v ]] for variable checks"
# More recent Bash # More recent Bash
@@ -1048,6 +1051,7 @@ else
mo::debug "Using declare -p for variable checks" mo::debug "Using declare -p for variable checks"
# Bash 3.2 # Bash 3.2
mo::isVarSet() { mo::isVarSet() {
# If the variable is exported and not assigned, declare -p will error.
if declare -p "$1" &> /dev/null; then if declare -p "$1" &> /dev/null; then
return 0 return 0
fi fi
@@ -2024,7 +2028,7 @@ mo::tokenizeTagContentsSingleQuote() {
# Save the original command's path for usage later # Save the original command's path for usage later
MO_ORIGINAL_COMMAND="$(cd "${BASH_SOURCE[0]%/*}" || exit 1; pwd)/${BASH_SOURCE[0]##*/}" MO_ORIGINAL_COMMAND="$(cd "${BASH_SOURCE[0]%/*}" || exit 1; pwd)/${BASH_SOURCE[0]##*/}"
MO_VERSION="3.0.7" MO_VERSION="3.1.0"
# If sourced, load all functions. # If sourced, load all functions.
# If executed, perform the actions as expected. # If executed, perform the actions as expected.

View File

@@ -94,7 +94,7 @@ This is open source! Please feel free to contribute.
https://github.com/tests-always-included/mo https://github.com/tests-always-included/mo
MO_VERSION=3.0.7 MO_VERSION=3.1.0
EOF EOF
} }