diff options
| author | shejialuo <shejialuo@gmail.com> | 2025-06-29 12:28:14 +0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-07 08:07:46 -0700 |
| commit | 07d90fda58c79af661016137cbbafab169eeb329 (patch) | |
| tree | b2ebd12674587f9a88b04f939176a95a6572bd0b /t/helper/test-string-list.c | |
| parent | 67cfd2924d099b3316ddf579ba7c11fdc29ad2b6 (diff) | |
u-string-list: move "test_split" into "u-string-list.c"
We rely on "test-tool string-list" command to test the functionality of
the "string-list". However, as we have introduced clar test framework,
we'd better move the shell script into C program to improve speed and
readability.
Create a new file "u-string-list.c" under "t/unit-tests", then update
the Makefile and "meson.build" to build the file. And let's first move
"test_split" into unit test and gradually convert the shell script into
C program.
In order to create `string_list` easily by simply specifying strings in
the function call, create "t_vcreate_string_list_dup" function to do
this.
Then port the shell script tests to C program and remove unused
"test-tool" code and tests.
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.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c index 6f10c5a435..17c18c30f6 100644 --- a/t/helper/test-string-list.c +++ b/t/helper/test-string-list.c @@ -46,20 +46,6 @@ static int prefix_cb(struct string_list_item *item, void *cb_data) int cmd__string_list(int argc, const char **argv) { - if (argc == 5 && !strcmp(argv[1], "split")) { - struct string_list list = STRING_LIST_INIT_DUP; - int i; - const char *s = argv[2]; - int delim = *argv[3]; - int maxsplit = atoi(argv[4]); - - i = string_list_split(&list, s, delim, maxsplit); - printf("%d\n", i); - write_list(&list); - string_list_clear(&list, 0); - return 0; - } - if (argc == 5 && !strcmp(argv[1], "split_in_place")) { struct string_list list = STRING_LIST_INIT_NODUP; int i; |
