aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKate Ward <kate.ward@forestent.com>2020-04-11 14:06:10 +0200
committerKate Ward <kate.ward@forestent.com>2020-04-11 14:06:10 +0200
commit73cecf4a76466cad6a16a574562ed465a4e2978e (patch)
treede25aabce7d881b1b7acbbe9115fd5499ee1bde3
parent804340a8f37722cbf69f6c0ea50fdeecd3806523 (diff)
downloadshflags-73cecf4a76466cad6a16a574562ed465a4e2978e.tar.gz
Modernized the testGetoptStandard function.
-rwxr-xr-xshflags_parsing_test.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/shflags_parsing_test.sh b/shflags_parsing_test.sh
index 87846f9..e8bc89d 100755
--- a/shflags_parsing_test.sh
+++ b/shflags_parsing_test.sh
@@ -27,11 +27,12 @@ stderrF="${TMPDIR:-/tmp}/STDERR"
testGetoptStandard() {
if ! _flags_getoptStandard '-b' >"${stdoutF}" 2>"${stderrF}"; then
fail "didn't parse valid flag 'b'"
- th_showOutput ${rslt} "${stdoutF}" "${stderrF}"
+ _showTestOutput
fi
if _flags_getoptStandard '-x' >"${stdoutF}" 2>"${stderrF}"; then
fail "parsed invalid flag 'x'"
+ _showTestOutput
fi
}
@@ -354,6 +355,9 @@ tearDown() {
flags_reset
}
+# showTestOutput for the most recently run test.
+_showTestOutput() { th_showOutput "${SHUNIT_FALSE}" "${stdoutF}" "${stderrF}"; }
+
# Load and run shUnit2.
# shellcheck disable=SC2034
[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0