aboutsummaryrefslogtreecommitdiff
path: root/source/1.0/src
diff options
context:
space:
mode:
authorkate.ward <kate.ward@forestent.com>2008-11-13 01:12:35 +0000
committerkate.ward <kate.ward@forestent.com>2008-11-13 01:12:35 +0000
commit271aece4334d3f1df56b2978d8918e193be0d53d (patch)
tree5c31f2d415084fd0d4da4d44f9329b6376ff22c4 /source/1.0/src
parent9664c01086460b4264cc160da3194f53747693b7 (diff)
downloadshflags-271aece4334d3f1df56b2978d8918e193be0d53d.tar.gz
added missing check for enhanced getopt (which os x doesn't have)
Diffstat (limited to 'source/1.0/src')
-rw-r--r--source/1.0/src/shflags_test_helpers13
-rwxr-xr-xsource/1.0/src/shflags_test_parsing.sh4
2 files changed, 12 insertions, 5 deletions
diff --git a/source/1.0/src/shflags_test_helpers b/source/1.0/src/shflags_test_helpers
index df9db98..01199b5 100644
--- a/source/1.0/src/shflags_test_helpers
+++ b/source/1.0/src/shflags_test_helpers
@@ -65,14 +65,17 @@ th_showOutput()
isSkipping
if [ $? -eq ${SHUNIT_FALSE} -a ${_th_rtrn} != ${FLAGS_TRUE} ]; then
- if [ -n "${_th_stdout}" ]; then
- echo '--- stdout ---' >&2
+ if [ -n "${_th_stdout}" -a -s "${_th_stdout}" ]; then
+ echo '>>> STDOUT' >&2
cat "${_th_stdout}" >&2
fi
- if [ -n "${_th_stderr}" ]; then
- echo '--- stderr ---' >&2
+ if [ -n "${_th_stderr}" -a -s "${_th_stderr}" ]; then
+ echo '>>> STDERR' >&2
cat "${_th_stderr}" >&2
fi
+ if [ -n "${_th_stdout}" -o -n "${_th_stderr}" ]; then
+ echo '>>> end output' >&2
+ fi
fi
unset _th_rtrn _th_stdout _th_stderr
@@ -87,6 +90,7 @@ _th_assertMsg()
case ${_th_alert_type_} in
WARN) _th_alert_str_='a warning' ;;
ERROR) _th_alert_str_='an error' ;;
+ FATAL) _th_alert_str_='a fatal' ;;
esac
[ -z "${_th_alert_msg_}" ] && _th_alert_msg_='.*'
[ -n "${_th_msg_}" ] && _th_msg_="(${_th_msg_}) "
@@ -101,3 +105,4 @@ _th_assertMsg()
assertWarnMsg() { _th_assertMsg 'WARN' "${1:-}" "${2:-}"; }
assertErrorMsg() { _th_assertMsg 'ERROR' "${1:-}" "${2:-}"; }
+assertFatalMsg() { _th_assertMsg 'FATAL' "${1:-}" "${2:-}"; }
diff --git a/source/1.0/src/shflags_test_parsing.sh b/source/1.0/src/shflags_test_parsing.sh
index 9b2ac5c..1ce98c0 100755
--- a/source/1.0/src/shflags_test_parsing.sh
+++ b/source/1.0/src/shflags_test_parsing.sh
@@ -29,6 +29,8 @@ testStandardGetopt()
testEnhancedGetopt()
{
+ flags_getoptIsEnh || startSkipping
+
_flags_enhancedGetopt '-b' >"${stdoutF}" 2>"${stderrF}"
assertTrue "didn't parse valid flag 'b'" $?
_flags_enhancedGetopt '--bool' >"${stdoutF}" 2>"${stderrF}"
@@ -189,7 +191,7 @@ _testValidStrings()
assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
else
# validate that an error is thrown for unsupported getopt uses
- assertErrorMsg 'spaces in options'
+ assertFatalMsg '.* spaces in options'
fi
th_showOutput ${rtrn} "${stdoutF}" "${stderrF}"
done