aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKate Ward <kate.ward@forestent.com>2018-01-16 23:22:37 +0100
committerKate Ward <kate.ward@forestent.com>2018-01-16 23:22:37 +0100
commiteef376e159c9c1f7c3ebd2b6a28ecef9f688efc9 (patch)
tree04db42db28c2d2469831ad8251ffd52322ad6e98
parent44075ed16217234a913e9894c6cb5a6741c4586a (diff)
downloadshflags-eef376e159c9c1f7c3ebd2b6a28ecef9f688efc9.tar.gz
Validate that globbing works in _flags_itemInList().
-rw-r--r--shflags2
-rwxr-xr-xshflags_private_test.sh19
2 files changed, 12 insertions, 9 deletions
diff --git a/shflags b/shflags
index c8dd5fe..a6ce471 100644
--- a/shflags
+++ b/shflags
@@ -545,7 +545,7 @@ _flags_getFlagInfo() {
# Returns:
# boolean: true if item is in the list
_flags_itemInList() {
- _flags_str_=$1
+ _flags_str_="$1"
shift
case " ${*:-} " in
diff --git a/shflags_private_test.sh b/shflags_private_test.sh
index e6b6376..f7bf7ba 100755
--- a/shflags_private_test.sh
+++ b/shflags_private_test.sh
@@ -98,14 +98,17 @@ testItemInList() {
got=$?
assertEquals "${desc}: itemInList(${item})" "${got}" "${want}"
done <<EOF
-lead_item this ${FLAGS_TRUE}
-middle_item is ${FLAGS_TRUE}
-last_item test ${FLAGS_TRUE}
-missing_item asdf ${FLAGS_FALSE}
-test_partial_te te ${FLAGS_FALSE}
-test_partial_es es ${FLAGS_FALSE}
-test_partial_st st ${FLAGS_FALSE}
-empty_item '' ${FLAGS_FALSE}
+lead_item this ${FLAGS_TRUE}
+middle_item is ${FLAGS_TRUE}
+last_item test ${FLAGS_TRUE}
+missing_item asdf ${FLAGS_FALSE}
+test_partial_te te ${FLAGS_FALSE}
+test_partial_es es ${FLAGS_FALSE}
+test_partial_st st ${FLAGS_FALSE}
+empty_item '' ${FLAGS_FALSE}
+glob_star t*s ${FLAGS_TRUE}
+glob_star_missing foo*bar ${FLAGS_FALSE}
+glob_question t??s ${FLAGS_TRUE}
EOF
_flags_itemInList 'item' ''