On Wed, Apr 23, 2025 at 01:52:58PM +0200, Patrick Steinhardt wrote: > On Tue, Apr 22, 2025 at 10:54:55PM +0800, shejialuo wrote: > > diff --git a/t/unit-tests/u-string-list.c b/t/unit-tests/u-string-list.c > > new file mode 100644 > > index 0000000000..0c148684ea > > --- /dev/null > > +++ b/t/unit-tests/u-string-list.c > > @@ -0,0 +1,86 @@ > > +static void t_string_list_split(const char *data, int delim, int maxsplit, > > + struct string_list *expected_strings) > > +{ > > + struct string_list list = STRING_LIST_INIT_DUP; > > + int len; > > + > > + len = string_list_split(&list, data, delim, maxsplit); > > + cl_assert_equal_i(len, expected_strings->nr); > > + t_check_string_list(&list, expected_strings); > > + > > + t_string_list_clear(&list, 0); > > +} > > + > > +void test_string_list__split(void) > > +{ > > + struct string_list expected_strings = STRING_LIST_INIT_DUP; > > + > > + t_create_string_list_dup(&expected_strings, 0, "foo", "bar", "baz", NULL); > > + t_string_list_split("foo:bar:baz", ':', -1, &expected_strings); > > Could we adapt `t_string_list_split()` so that it accepts the expected > strings as varargs? If so we could simplify the logic in this function > here. > That's a good suggestion. I will update in the next version. > Patrick