summaryrefslogtreecommitdiff
path: root/t/helper/test-string-list.c
diff options
context:
space:
mode:
authorshejialuo <shejialuo@gmail.com>2025-06-29 12:28:32 +0800
committerJunio C Hamano <gitster@pobox.com>2025-07-07 08:07:46 -0700
commit7e7ce7826534142c069758c13b2d308e901138c0 (patch)
tree5ce555b132b845338cc3388884073f49a340651b /t/helper/test-string-list.c
parent62c514a9efd2206e081509ca3abc9cd5645eff0b (diff)
u-string-list: move "filter string" test to "u-string-list.c"
We use "test-tool string-list filter" to test the "filter_string_list" function. As we have introduced the unit test, we'd better remove the logic from shell script to C program to improve test speed and readability. Signed-off-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-string-list.c')
-rw-r--r--t/helper/test-string-list.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index 8a344347ad..262b28c599 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -31,29 +31,8 @@ static void write_list_compact(const struct string_list *list)
}
}
-static int prefix_cb(struct string_list_item *item, void *cb_data)
-{
- const char *prefix = (const char *)cb_data;
- return starts_with(item->string, prefix);
-}
-
int cmd__string_list(int argc, const char **argv)
{
- if (argc == 4 && !strcmp(argv[1], "filter")) {
- /*
- * Retain only the items that have the specified prefix.
- * Arguments: list|- prefix
- */
- struct string_list list = STRING_LIST_INIT_DUP;
- const char *prefix = argv[3];
-
- parse_string_list(&list, argv[2]);
- filter_string_list(&list, 0, prefix_cb, (void *)prefix);
- write_list_compact(&list);
- string_list_clear(&list, 0);
- return 0;
- }
-
if (argc == 3 && !strcmp(argv[1], "remove_duplicates")) {
struct string_list list = STRING_LIST_INIT_DUP;