From 31d5451eed2677531c80177ff9dc8f5285f5a187 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Wed, 12 Sep 2012 16:04:45 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- t/t0063-string-list.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 't') 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 -- cgit v1.2.3