Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2012-09-12 18:04:45 +0400
committerJunio C Hamano <gitster@pobox.com>2012-09-12 22:43:25 +0400
commit31d5451eed2677531c80177ff9dc8f5285f5a187 (patch)
treebd709b58ba3096867e2f6166f516773b67aad0e1 /t/t0063-string-list.sh
parenteb5f0c7a616531a024a582b72ca6d8775ff98d46 (diff)
string_list: add a new function, string_list_remove_duplicates()
Add a function that deletes duplicate entries from a sorted string_list. 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.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh
index a5f05cd206..dbfc05ebdc 100755
--- a/t/t0063-string-list.sh
+++ b/t/t0063-string-list.sh
@@ -71,4 +71,21 @@ test_expect_success "test filter_string_list" '
test "x-" = "x$(test-string-list filter x1:x2 y)"
'
+test_expect_success "test remove_duplicates" '
+ test "x-" = "x$(test-string-list remove_duplicates -)" &&
+ test "x" = "x$(test-string-list remove_duplicates "")" &&
+ test a = "$(test-string-list remove_duplicates a)" &&
+ test a = "$(test-string-list remove_duplicates a:a)" &&
+ test a = "$(test-string-list remove_duplicates a:a:a:a:a)" &&
+ test a:b = "$(test-string-list remove_duplicates a:b)" &&
+ test a:b = "$(test-string-list remove_duplicates a:a:b)" &&
+ test a:b = "$(test-string-list remove_duplicates a:b:b)" &&
+ test a:b:c = "$(test-string-list remove_duplicates a:b:c)" &&
+ test a:b:c = "$(test-string-list remove_duplicates a:a:b:c)" &&
+ test a:b:c = "$(test-string-list remove_duplicates a:b:b:c)" &&
+ test a:b:c = "$(test-string-list remove_duplicates a:b:c:c)" &&
+ test a:b:c = "$(test-string-list remove_duplicates a:a:b:b:c:c)" &&
+ test a:b:c = "$(test-string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
+'
+
test_done