On Tue, Apr 22, 2025 at 10:55:06PM +0800, shejialuo wrote: > diff --git a/t/unit-tests/u-string-list.c b/t/unit-tests/u-string-list.c > index 0c148684ea..44ec8de3d0 100644 > --- a/t/unit-tests/u-string-list.c > +++ b/t/unit-tests/u-string-list.c > @@ -84,3 +84,42 @@ void test_string_list__split(void) > > t_string_list_clear(&expected_strings, 0); > } > + > +static void t_string_list_split_in_place(const char *data, const char *delim, int maxsplit, > + struct string_list *expected_strings) > +{ > + struct string_list list = STRING_LIST_INIT_NODUP; > + Nit: this empty newline should be removed. > + char *string = xstrdup(data); > + > + int len = string_list_split_in_place(&list, string, delim, maxsplit); > + cl_assert_equal_i(len, expected_strings->nr); > + t_check_string_list(&list, expected_strings); > + > + free(string); > + t_string_list_clear(&list, 0); > +} > + > +void test_string_list__split_in_place(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_in_place("foo:;:bar:;:baz:;:", ":;", -1, &expected_strings); Same question here, can we handle expected strings via varargs to avoid code duplication? Also for subsequent patches. Patrick