aboutsummaryrefslogtreecommitdiff
path: root/source/1.0/src/shflags_test_public.sh
diff options
context:
space:
mode:
authorkate.ward <kate.ward@forestent.com>2008-07-10 19:37:16 +0000
committerkate.ward <kate.ward@forestent.com>2008-07-10 19:37:16 +0000
commitdc10fe9a211073214c09b8d004834f73de9d2450 (patch)
tree0bc3b42b2ebfb1acfc28069962aa04fabac887d8 /source/1.0/src/shflags_test_public.sh
parent2fb41e38787ced21dbeeebc3290268ffab3a1e42 (diff)
downloadshflags-dc10fe9a211073214c09b8d004834f73de9d2450.tar.gz
fixed bug where [no] was added to all flag names
Diffstat (limited to 'source/1.0/src/shflags_test_public.sh')
-rwxr-xr-xsource/1.0/src/shflags_test_public.sh48
1 files changed, 37 insertions, 11 deletions
diff --git a/source/1.0/src/shflags_test_public.sh b/source/1.0/src/shflags_test_public.sh
index 67e5a83..2ab5902 100755
--- a/source/1.0/src/shflags_test_public.sh
+++ b/source/1.0/src/shflags_test_public.sh
@@ -15,7 +15,7 @@
# suite tests
#
-testGeneralHelpOutput()
+testHelp()
{
#
# test short -h option
@@ -69,17 +69,44 @@ testGeneralHelpOutput()
$?
}
-testSpecificHelpOutput()
+testStandardHelpOutput()
{
- DEFINE_string test '' 'test string' t
+ flags_getoptIsEnh && startSkipping
- # short option testing
+ DEFINE_boolean test_bool false 'test boolean' b
+ DEFINE_string test_str '' 'test string' s
+ FLAGS_HELP='USAGE: standard [flags] args'
cat >"${expectedF}" <<EOF
-USAGE: ./${shunitParent} [flags] args
+USAGE: standard [flags] args
flags:
-h show this help
- -t test string
+ -b test boolean
+ -s test string
+EOF
+ ( FLAGS -h >"${stdoutF}" 2>"${stderrF}" )
+ diff "${expectedF}" "${stderrF}" >/dev/null
+ rtrn=$?
+ assertTrue 'unexpected help output' ${rtrn}
+ [ ${__shunit_skip} -eq ${SHUNIT_FALSE} \
+ -a ${rtrn} -ne ${FLAGS_TRUE} ] \
+ && cat "${stderrF}"
+}
+
+testEnhancedHelpOutput()
+{
+ flags_getoptIsEnh || startSkipping
+
+ DEFINE_boolean test_bool false 'test boolean' b
+ DEFINE_string test_str '' 'test string' s
+ FLAGS_HELP='USAGE: enhanced [flags] args'
+
+ cat >"${expectedF}" <<EOF
+USAGE: enhanced [flags] args
+flags:
+ -h,--[no]help: show this help
+ -b,--[no]test_bool: test boolean
+ -s,--test_str: test string
EOF
( FLAGS -h >"${stdoutF}" 2>"${stderrF}" )
diff "${expectedF}" "${stderrF}" >/dev/null
@@ -93,10 +120,11 @@ EOF
flags_getoptIsStd && startSkipping
cat >"${expectedF}" <<EOF
-USAGE: ./${shunitParent} [flags] args
+USAGE: enhanced [flags] args
flags:
- -h show this help
- -t test string
+ -h,--[no]help: show this help
+ -b,--[no]test_bool: test boolean
+ -s,--test_str: test string
EOF
( FLAGS --help >"${stdoutF}" 2>"${stderrF}" )
diff "${expectedF}" "${stderrF}" >/dev/null
@@ -122,8 +150,6 @@ oneTimeSetUp()
stdoutF="${tmpDir}/stdout"
stderrF="${tmpDir}/stderr"
expectedF="${tmpDir}/expected"
-
- shunitParent=`basename "${__SHUNIT_PARENT}"`
}
setUp()