aboutsummaryrefslogtreecommitdiff
path: root/shflags_private_test.sh
diff options
context:
space:
mode:
authorKate Ward <kate.ward@forestent.com>2018-01-15 11:31:02 +0100
committerKate Ward <kate.ward@forestent.com>2018-01-15 11:31:02 +0100
commita8e81fdb77b054dc28987af82e53ab9a0c107d20 (patch)
tree24cc7ecbe70d62358af67399248ebd7da5b26ad3 /shflags_private_test.sh
parente563d4c1731683908c05782f07bfac48856f3139 (diff)
downloadshflags-a8e81fdb77b054dc28987af82e53ab9a0c107d20.tar.gz
Added unit test for underscoreName(), and fixed potential POSIX compliance issue.
Diffstat (limited to 'shflags_private_test.sh')
-rwxr-xr-xshflags_private_test.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/shflags_private_test.sh b/shflags_private_test.sh
index 5a2b442..e6b6376 100755
--- a/shflags_private_test.sh
+++ b/shflags_private_test.sh
@@ -3,8 +3,7 @@
#
# shFlags unit tests for the internal functions.
#
-#
-# Copyright 2008-2017 Kate Ward. All Rights Reserved.
+# Copyright 2008-2018 Kate Ward. All Rights Reserved.
# Released under the Apache 2.0 license.
#
# Author: kate.ward@forestent.com (Kate Ward)
@@ -113,6 +112,18 @@ EOF
assertFalse 'empty lists should not match' $?
}
+testUnderscoreName() {
+ while read desc name want; do
+ got=`_flags_underscoreName "${name}"`
+ assertEquals "${desc}: underscoreName(${name})" "${got}" "${want}"
+ done <<EOF
+with_dashes name-with-dashes name_with_dashes
+with_underscores name_with_underscores name_with_underscores
+just_alpha_numeric abc123 abc123
+empty "" ""
+EOF
+}
+
testValidBool() {
# Valid values.
for value in ${TH_BOOL_VALID}; do