summaryrefslogtreecommitdiffstats
path: root/t/t0063-string-list.sh
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2012-09-12 16:04:44 +0200
committerJunio C Hamano <gitster@pobox.com>2012-09-12 11:43:25 -0700
commiteb5f0c7a616531a024a582b72ca6d8775ff98d46 (patch)
tree1c791a163140cb2988c7d2049ce706ad93e0c23d /t/t0063-string-list.sh
parentff919f965d20d003e3882c70de667f41a86349ac (diff)
downloadgit-eb5f0c7a616531a024a582b72ca6d8775ff98d46.tar.gz
git-eb5f0c7a616531a024a582b72ca6d8775ff98d46.tar.xz
string_list: add a new function, filter_string_list()
This function allows entries that don't match a specified criterion to be discarded from a string_list while preserving the order of the remaining entries. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0063-string-list.sh')
-rwxr-xr-xt/t0063-string-list.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh
index fb8543075..a5f05cd20 100755
--- a/t/t0063-string-list.sh
+++ b/t/t0063-string-list.sh
@@ -60,4 +60,15 @@ test_split ":" ":" "-1" <<EOF
[1]: ""
EOF
+test_expect_success "test filter_string_list" '
+ test "x-" = "x$(test-string-list filter - y)" &&
+ test "x-" = "x$(test-string-list filter no y)" &&
+ test yes = "$(test-string-list filter yes y)" &&
+ test yes = "$(test-string-list filter no:yes y)" &&
+ test yes = "$(test-string-list filter yes:no y)" &&
+ test y1:y2 = "$(test-string-list filter y1:y2 y)" &&
+ test y2:y1 = "$(test-string-list filter y2:y1 y)" &&
+ test "x-" = "x$(test-string-list filter x1:x2 y)"
+'
+
test_done