static void test_strv_quote_unquote(const char* const *split, const char *quoted) { _cleanup_free_ char *p; _cleanup_strv_free_ char **s; char **t; p = strv_join_quoted((char **)split); printf("-%s- --- -%s-\n", p, quoted); /* fprintf deals with NULL, puts does not */ assert_se(p); assert_se(streq(p, quoted)); s = strv_split_quoted(quoted); assert_se(s); STRV_FOREACH(t, s) { assert_se(*t); assert_se(streq(*t, *split)); split++; }
static void test_strv_quote_unquote(const char* const *split, const char *quoted) { _cleanup_free_ char *p; _cleanup_strv_free_ char **s = NULL; char **t; int r; p = strv_join_quoted((char **)split); assert_se(p); printf("-%s- --- -%s-\n", p, quoted); /* fprintf deals with NULL, puts does not */ assert_se(p); assert_se(streq(p, quoted)); r = strv_split_extract(&s, quoted, WHITESPACE, EXTRACT_QUOTES); assert_se(r == (int) strv_length(s)); assert_se(s); STRV_FOREACH(t, s) { assert_se(*t); assert_se(streq(*t, *split)); split++; }