mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-14 11:53:16 +00:00
tests: add another pw_split_strv test
To check if an empty string after a delimiter is counted.
This commit is contained in:
parent
72bee99f87
commit
da3273891c
|
@ -193,6 +193,8 @@ static void test__pw_split_strv(void)
|
||||||
{
|
{
|
||||||
const char *test1 = "a \n test string \n \r ";
|
const char *test1 = "a \n test string \n \r ";
|
||||||
const char *del = "\n\r ";
|
const char *del = "\n\r ";
|
||||||
|
const char *test2 = "a:";
|
||||||
|
const char *del2 = ":";
|
||||||
int n_tokens;
|
int n_tokens;
|
||||||
char **res;
|
char **res;
|
||||||
|
|
||||||
|
@ -212,6 +214,13 @@ static void test__pw_split_strv(void)
|
||||||
pwtest_str_eq(res[1], "test string \n \r ");
|
pwtest_str_eq(res[1], "test string \n \r ");
|
||||||
pwtest_ptr_null(res[2]);
|
pwtest_ptr_null(res[2]);
|
||||||
pw_free_strv(res);
|
pw_free_strv(res);
|
||||||
|
|
||||||
|
res = pw_split_strv(test2, del2, 2, &n_tokens);
|
||||||
|
pwtest_ptr_notnull(res);
|
||||||
|
pwtest_int_eq(n_tokens, 1);
|
||||||
|
pwtest_str_eq(res[0], "a");
|
||||||
|
pwtest_ptr_null(res[1]);
|
||||||
|
pw_free_strv(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
PWTEST(utils_split)
|
PWTEST(utils_split)
|
||||||
|
|
Loading…
Reference in a new issue