1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd.
5 Copyright 2010 Lennart Poettering
6 Copyright 2013 Thomas H.P. Andersen
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include "alloc-util.h"
25 #include "specifier.h"
26 #include "string-util.h"
30 static void test_specifier_printf(void) {
31 static const Specifier table
[] = {
32 { 'a', specifier_string
, (char*) "AAAA" },
33 { 'b', specifier_string
, (char*) "BBBB" },
34 { 'm', specifier_machine_id
, NULL
},
35 { 'B', specifier_boot_id
, NULL
},
36 { 'H', specifier_host_name
, NULL
},
37 { 'v', specifier_kernel_release
, NULL
},
41 _cleanup_free_
char *w
= NULL
;
44 r
= specifier_printf("xxx a=%a b=%b yyy", table
, NULL
, &w
);
49 assert_se(streq(w
, "xxx a=AAAA b=BBBB yyy"));
52 r
= specifier_printf("machine=%m, boot=%B, host=%H, version=%v", table
, NULL
, &w
);
58 static void test_str_in_set(void) {
59 assert_se(STR_IN_SET("x", "x", "y", "z"));
60 assert_se(!STR_IN_SET("X", "x", "y", "z"));
61 assert_se(!STR_IN_SET("", "x", "y", "z"));
62 assert_se(STR_IN_SET("x", "w", "x"));
65 static void test_strptr_in_set(void) {
66 assert_se(STRPTR_IN_SET("x", "x", "y", "z"));
67 assert_se(!STRPTR_IN_SET("X", "x", "y", "z"));
68 assert_se(!STRPTR_IN_SET("", "x", "y", "z"));
69 assert_se(STRPTR_IN_SET("x", "w", "x"));
71 assert_se(!STRPTR_IN_SET(NULL
, "x", "y", "z"));
72 assert_se(!STRPTR_IN_SET(NULL
, ""));
73 /* strv cannot contain a null, hence the result below */
74 assert_se(!STRPTR_IN_SET(NULL
, NULL
));
77 static const char* const input_table_multiple
[] = {
84 static const char* const input_table_one
[] = {
89 static const char* const input_table_none
[] = {
93 static const char* const input_table_two_empties
[] = {
99 static const char* const input_table_one_empty
[] = {
105 static const char* const input_table_quotes
[] = {
113 #define QUOTES_STRING \
120 static const char * const input_table_spaces
[] = {
128 #define SPACES_STRING \
135 static void test_strv_find(void) {
136 assert_se(strv_find((char **)input_table_multiple
, "three"));
137 assert_se(!strv_find((char **)input_table_multiple
, "four"));
140 static void test_strv_find_prefix(void) {
141 assert_se(strv_find_prefix((char **)input_table_multiple
, "o"));
142 assert_se(strv_find_prefix((char **)input_table_multiple
, "one"));
143 assert_se(strv_find_prefix((char **)input_table_multiple
, ""));
144 assert_se(!strv_find_prefix((char **)input_table_multiple
, "xxx"));
145 assert_se(!strv_find_prefix((char **)input_table_multiple
, "onee"));
148 static void test_strv_find_startswith(void) {
151 r
= strv_find_startswith((char **)input_table_multiple
, "o");
152 assert_se(r
&& streq(r
, "ne"));
154 r
= strv_find_startswith((char **)input_table_multiple
, "one");
155 assert_se(r
&& streq(r
, ""));
157 r
= strv_find_startswith((char **)input_table_multiple
, "");
158 assert_se(r
&& streq(r
, "one"));
160 assert_se(!strv_find_startswith((char **)input_table_multiple
, "xxx"));
161 assert_se(!strv_find_startswith((char **)input_table_multiple
, "onee"));
164 static void test_strv_join(void) {
165 _cleanup_free_
char *p
= NULL
, *q
= NULL
, *r
= NULL
, *s
= NULL
, *t
= NULL
, *v
= NULL
, *w
= NULL
;
167 p
= strv_join((char **)input_table_multiple
, ", ");
169 assert_se(streq(p
, "one, two, three"));
171 q
= strv_join((char **)input_table_multiple
, ";");
173 assert_se(streq(q
, "one;two;three"));
175 r
= strv_join((char **)input_table_multiple
, NULL
);
177 assert_se(streq(r
, "one two three"));
179 s
= strv_join((char **)input_table_one
, ", ");
181 assert_se(streq(s
, "one"));
183 t
= strv_join((char **)input_table_none
, ", ");
185 assert_se(streq(t
, ""));
187 v
= strv_join((char **)input_table_two_empties
, ", ");
189 assert_se(streq(v
, ", "));
191 w
= strv_join((char **)input_table_one_empty
, ", ");
193 assert_se(streq(w
, ""));
196 static void test_strv_quote_unquote(const char* const *split
, const char *quoted
) {
197 _cleanup_free_
char *p
;
198 _cleanup_strv_free_
char **s
= NULL
;
202 p
= strv_join_quoted((char **)split
);
204 printf("-%s- --- -%s-\n", p
, quoted
); /* fprintf deals with NULL, puts does not */
206 assert_se(streq(p
, quoted
));
208 r
= strv_split_extract(&s
, quoted
, WHITESPACE
, EXTRACT_QUOTES
);
209 assert_se(r
== (int) strv_length(s
));
213 assert_se(streq(*t
, *split
));
218 static void test_strv_unquote(const char *quoted
, char **list
) {
219 _cleanup_strv_free_
char **s
;
220 _cleanup_free_
char *j
;
225 r
= strv_split_extract(&s
, quoted
, WHITESPACE
, EXTRACT_QUOTES
);
226 assert_se(r
== (int) strv_length(list
));
228 j
= strv_join(s
, " | ");
233 assert_se(streq(list
[i
++], *t
));
235 assert_se(list
[i
] == NULL
);
238 static void test_invalid_unquote(const char *quoted
) {
242 r
= strv_split_extract(&s
, quoted
, WHITESPACE
, EXTRACT_QUOTES
);
243 assert_se(s
== NULL
);
244 assert_se(r
== -EINVAL
);
247 static void test_strv_split(void) {
250 _cleanup_strv_free_
char **l
= NULL
;
251 const char str
[] = "one,two,three";
253 l
= strv_split(str
, ",");
258 assert_se(streq(*s
, input_table_multiple
[i
++]));
262 static void test_strv_split_extract(void) {
263 _cleanup_strv_free_
char **l
= NULL
;
264 const char *str
= ":foo\\:bar::waldo:";
267 r
= strv_split_extract(&l
, str
, ":", EXTRACT_DONT_COALESCE_SEPARATORS
);
268 assert_se(r
== (int) strv_length(l
));
269 assert_se(streq_ptr(l
[0], ""));
270 assert_se(streq_ptr(l
[1], "foo:bar"));
271 assert_se(streq_ptr(l
[2], ""));
272 assert_se(streq_ptr(l
[3], "waldo"));
273 assert_se(streq_ptr(l
[4], ""));
274 assert_se(streq_ptr(l
[5], NULL
));
277 static void test_strv_split_newlines(void) {
280 _cleanup_strv_free_
char **l
= NULL
;
281 const char str
[] = "one\ntwo\nthree";
283 l
= strv_split_newlines(str
);
288 assert_se(streq(*s
, input_table_multiple
[i
++]));
292 static void test_strv_split_nulstr(void) {
293 _cleanup_strv_free_
char **l
= NULL
;
294 const char nulstr
[] = "str0\0str1\0str2\0str3\0";
296 l
= strv_split_nulstr (nulstr
);
299 assert_se(streq(l
[0], "str0"));
300 assert_se(streq(l
[1], "str1"));
301 assert_se(streq(l
[2], "str2"));
302 assert_se(streq(l
[3], "str3"));
305 static void test_strv_parse_nulstr(void) {
306 _cleanup_strv_free_
char **l
= NULL
;
307 const char nulstr
[] = "fuck\0fuck2\0fuck3\0\0fuck5\0\0xxx";
309 l
= strv_parse_nulstr(nulstr
, sizeof(nulstr
)-1);
311 puts("Parse nulstr:");
314 assert_se(streq(l
[0], "fuck"));
315 assert_se(streq(l
[1], "fuck2"));
316 assert_se(streq(l
[2], "fuck3"));
317 assert_se(streq(l
[3], ""));
318 assert_se(streq(l
[4], "fuck5"));
319 assert_se(streq(l
[5], ""));
320 assert_se(streq(l
[6], "xxx"));
323 static void test_strv_overlap(void) {
324 const char * const input_table
[] = {
330 const char * const input_table_overlap
[] = {
334 const char * const input_table_unique
[] = {
341 assert_se(strv_overlap((char **)input_table
, (char**)input_table_overlap
));
342 assert_se(!strv_overlap((char **)input_table
, (char**)input_table_unique
));
345 static void test_strv_sort(void) {
346 const char* input_table
[] = {
350 "CAPITAL LETTERS FIRST",
355 strv_sort((char **)input_table
);
357 assert_se(streq(input_table
[0], "CAPITAL LETTERS FIRST"));
358 assert_se(streq(input_table
[1], "apple"));
359 assert_se(streq(input_table
[2], "banana"));
360 assert_se(streq(input_table
[3], "citrus"));
361 assert_se(streq(input_table
[4], "durian"));
364 static void test_strv_extend_strv_concat(void) {
365 _cleanup_strv_free_
char **a
= NULL
, **b
= NULL
;
367 a
= strv_new("without", "suffix", NULL
);
368 b
= strv_new("with", "suffix", NULL
);
372 assert_se(strv_extend_strv_concat(&a
, b
, "_suffix") >= 0);
374 assert_se(streq(a
[0], "without"));
375 assert_se(streq(a
[1], "suffix"));
376 assert_se(streq(a
[2], "with_suffix"));
377 assert_se(streq(a
[3], "suffix_suffix"));
380 static void test_strv_extend_strv(void) {
381 _cleanup_strv_free_
char **a
= NULL
, **b
= NULL
, **n
= NULL
;
383 a
= strv_new("abc", "def", "ghi", NULL
);
384 b
= strv_new("jkl", "mno", "abc", "pqr", NULL
);
388 assert_se(strv_extend_strv(&a
, b
, true) == 3);
390 assert_se(streq(a
[0], "abc"));
391 assert_se(streq(a
[1], "def"));
392 assert_se(streq(a
[2], "ghi"));
393 assert_se(streq(a
[3], "jkl"));
394 assert_se(streq(a
[4], "mno"));
395 assert_se(streq(a
[5], "pqr"));
396 assert_se(strv_length(a
) == 6);
398 assert_se(strv_extend_strv(&n
, b
, false) >= 0);
399 assert_se(streq(n
[0], "jkl"));
400 assert_se(streq(n
[1], "mno"));
401 assert_se(streq(n
[2], "abc"));
402 assert_se(streq(n
[3], "pqr"));
403 assert_se(strv_length(n
) == 4);
406 static void test_strv_extend(void) {
407 _cleanup_strv_free_
char **a
= NULL
, **b
= NULL
;
409 a
= strv_new("test", "test1", NULL
);
411 assert_se(strv_extend(&a
, "test2") >= 0);
412 assert_se(strv_extend(&b
, "test3") >= 0);
414 assert_se(streq(a
[0], "test"));
415 assert_se(streq(a
[1], "test1"));
416 assert_se(streq(a
[2], "test2"));
417 assert_se(streq(b
[0], "test3"));
420 static void test_strv_extendf(void) {
421 _cleanup_strv_free_
char **a
= NULL
, **b
= NULL
;
423 a
= strv_new("test", "test1", NULL
);
425 assert_se(strv_extendf(&a
, "test2 %s %d %s", "foo", 128, "bar") >= 0);
426 assert_se(strv_extendf(&b
, "test3 %s %s %d", "bar", "foo", 128) >= 0);
428 assert_se(streq(a
[0], "test"));
429 assert_se(streq(a
[1], "test1"));
430 assert_se(streq(a
[2], "test2 foo 128 bar"));
431 assert_se(streq(b
[0], "test3 bar foo 128"));
434 static void test_strv_foreach(void) {
435 _cleanup_strv_free_
char **a
;
439 a
= strv_new("one", "two", "three", NULL
);
443 STRV_FOREACH(check
, a
) {
444 assert_se(streq(*check
, input_table_multiple
[i
++]));
448 static void test_strv_foreach_backwards(void) {
449 _cleanup_strv_free_
char **a
;
453 a
= strv_new("one", "two", "three", NULL
);
457 STRV_FOREACH_BACKWARDS(check
, a
)
458 assert_se(streq_ptr(*check
, input_table_multiple
[i
--]));
460 STRV_FOREACH_BACKWARDS(check
, (char**) NULL
)
461 assert_not_reached("Let's see that we check empty strv right, too.");
463 STRV_FOREACH_BACKWARDS(check
, (char**) { NULL
})
464 assert_not_reached("Let's see that we check empty strv right, too.");
467 static void test_strv_foreach_pair(void) {
468 _cleanup_strv_free_
char **a
= NULL
;
471 a
= strv_new("pair_one", "pair_one",
472 "pair_two", "pair_two",
473 "pair_three", "pair_three",
476 STRV_FOREACH_PAIR(x
, y
, a
) {
477 assert_se(streq(*x
, *y
));
481 static void test_strv_from_stdarg_alloca_one(char **l
, const char *first
, ...) {
485 j
= strv_from_stdarg_alloca(first
);
488 assert_se(streq_ptr(l
[i
], j
[i
]));
495 static void test_strv_from_stdarg_alloca(void) {
496 test_strv_from_stdarg_alloca_one(STRV_MAKE("foo", "bar"), "foo", "bar", NULL
);
497 test_strv_from_stdarg_alloca_one(STRV_MAKE("foo"), "foo", NULL
);
498 test_strv_from_stdarg_alloca_one(STRV_MAKE_EMPTY
, NULL
);
501 static void test_strv_push_prepend(void) {
502 _cleanup_strv_free_
char **a
= NULL
;
504 a
= strv_new("foo", "bar", "three", NULL
);
506 assert_se(strv_push_prepend(&a
, strdup("first")) >= 0);
507 assert_se(streq(a
[0], "first"));
508 assert_se(streq(a
[1], "foo"));
509 assert_se(streq(a
[2], "bar"));
510 assert_se(streq(a
[3], "three"));
513 assert_se(strv_consume_prepend(&a
, strdup("first2")) >= 0);
514 assert_se(streq(a
[0], "first2"));
515 assert_se(streq(a
[1], "first"));
516 assert_se(streq(a
[2], "foo"));
517 assert_se(streq(a
[3], "bar"));
518 assert_se(streq(a
[4], "three"));
522 static void test_strv_push(void) {
523 _cleanup_strv_free_
char **a
= NULL
;
526 assert_se(i
= strdup("foo"));
527 assert_se(strv_push(&a
, i
) >= 0);
529 assert_se(i
= strdup("a"));
530 assert_se(j
= strdup("b"));
531 assert_se(strv_push_pair(&a
, i
, j
) >= 0);
533 assert_se(streq_ptr(a
[0], "foo"));
534 assert_se(streq_ptr(a
[1], "a"));
535 assert_se(streq_ptr(a
[2], "b"));
536 assert_se(streq_ptr(a
[3], NULL
));
539 static void test_strv_equal(void) {
540 _cleanup_strv_free_
char **a
= NULL
;
541 _cleanup_strv_free_
char **b
= NULL
;
542 _cleanup_strv_free_
char **c
= NULL
;
544 a
= strv_new("one", "two", "three", NULL
);
546 b
= strv_new("one", "two", "three", NULL
);
548 c
= strv_new("one", "two", "three", "four", NULL
);
551 assert_se(strv_equal(a
, a
));
552 assert_se(strv_equal(a
, b
));
553 assert_se(strv_equal(NULL
, NULL
));
555 assert_se(!strv_equal(a
, c
));
556 assert_se(!strv_equal(b
, c
));
557 assert_se(!strv_equal(b
, NULL
));
560 static void test_strv_is_uniq(void) {
561 _cleanup_strv_free_
char **a
= NULL
, **b
= NULL
, **c
= NULL
, **d
= NULL
;
563 a
= strv_new(NULL
, NULL
);
565 assert_se(strv_is_uniq(a
));
567 b
= strv_new("foo", NULL
);
569 assert_se(strv_is_uniq(b
));
571 c
= strv_new("foo", "bar", NULL
);
573 assert_se(strv_is_uniq(c
));
575 d
= strv_new("foo", "bar", "waldo", "bar", "piep", NULL
);
577 assert_se(!strv_is_uniq(d
));
580 static void test_strv_reverse(void) {
581 _cleanup_strv_free_
char **a
= NULL
, **b
= NULL
, **c
= NULL
, **d
= NULL
;
583 a
= strv_new(NULL
, NULL
);
587 assert_se(strv_isempty(a
));
589 b
= strv_new("foo", NULL
);
592 assert_se(streq_ptr(b
[0], "foo"));
593 assert_se(streq_ptr(b
[1], NULL
));
595 c
= strv_new("foo", "bar", NULL
);
598 assert_se(streq_ptr(c
[0], "bar"));
599 assert_se(streq_ptr(c
[1], "foo"));
600 assert_se(streq_ptr(c
[2], NULL
));
602 d
= strv_new("foo", "bar", "waldo", NULL
);
605 assert_se(streq_ptr(d
[0], "waldo"));
606 assert_se(streq_ptr(d
[1], "bar"));
607 assert_se(streq_ptr(d
[2], "foo"));
608 assert_se(streq_ptr(d
[3], NULL
));
611 static void test_strv_shell_escape(void) {
612 _cleanup_strv_free_
char **v
= NULL
;
614 v
= strv_new("foo:bar", "bar,baz", "wal\\do", NULL
);
616 assert_se(strv_shell_escape(v
, ",:"));
617 assert_se(streq_ptr(v
[0], "foo\\:bar"));
618 assert_se(streq_ptr(v
[1], "bar\\,baz"));
619 assert_se(streq_ptr(v
[2], "wal\\\\do"));
620 assert_se(streq_ptr(v
[3], NULL
));
623 static void test_strv_skip_one(char **a
, size_t n
, char **b
) {
625 assert_se(strv_equal(a
, b
));
628 static void test_strv_skip(void) {
629 test_strv_skip_one(STRV_MAKE("foo", "bar", "baz"), 0, STRV_MAKE("foo", "bar", "baz"));
630 test_strv_skip_one(STRV_MAKE("foo", "bar", "baz"), 1, STRV_MAKE("bar", "baz"));
631 test_strv_skip_one(STRV_MAKE("foo", "bar", "baz"), 2, STRV_MAKE("baz"));
632 test_strv_skip_one(STRV_MAKE("foo", "bar", "baz"), 3, STRV_MAKE(NULL
));
633 test_strv_skip_one(STRV_MAKE("foo", "bar", "baz"), 4, STRV_MAKE(NULL
));
634 test_strv_skip_one(STRV_MAKE("foo", "bar", "baz"), 55, STRV_MAKE(NULL
));
636 test_strv_skip_one(STRV_MAKE("quux"), 0, STRV_MAKE("quux"));
637 test_strv_skip_one(STRV_MAKE("quux"), 1, STRV_MAKE(NULL
));
638 test_strv_skip_one(STRV_MAKE("quux"), 55, STRV_MAKE(NULL
));
640 test_strv_skip_one(STRV_MAKE(NULL
), 0, STRV_MAKE(NULL
));
641 test_strv_skip_one(STRV_MAKE(NULL
), 1, STRV_MAKE(NULL
));
642 test_strv_skip_one(STRV_MAKE(NULL
), 55, STRV_MAKE(NULL
));
645 static void test_strv_extend_n(void) {
646 _cleanup_strv_free_
char **v
= NULL
;
648 v
= strv_new("foo", "bar", NULL
);
651 assert_se(strv_extend_n(&v
, "waldo", 3) >= 0);
652 assert_se(strv_extend_n(&v
, "piep", 2) >= 0);
654 assert_se(streq(v
[0], "foo"));
655 assert_se(streq(v
[1], "bar"));
656 assert_se(streq(v
[2], "waldo"));
657 assert_se(streq(v
[3], "waldo"));
658 assert_se(streq(v
[4], "waldo"));
659 assert_se(streq(v
[5], "piep"));
660 assert_se(streq(v
[6], "piep"));
661 assert_se(v
[7] == NULL
);
665 assert_se(strv_extend_n(&v
, "foo", 1) >= 0);
666 assert_se(strv_extend_n(&v
, "bar", 0) >= 0);
668 assert_se(streq(v
[0], "foo"));
669 assert_se(v
[1] == NULL
);
672 static void test_strv_make_nulstr_one(char **l
) {
673 _cleanup_free_
char *b
= NULL
, *c
= NULL
;
674 _cleanup_strv_free_
char **q
= NULL
;
675 const char *s
= NULL
;
679 assert_se(strv_make_nulstr(l
, &b
, &n
) >= 0);
680 assert_se(q
= strv_parse_nulstr(b
, n
));
681 assert_se(strv_equal(l
, q
));
683 assert_se(strv_make_nulstr(q
, &c
, &m
) >= 0);
685 assert_se(memcmp(b
, c
, m
) == 0);
688 assert_se(streq(s
, l
[i
++]));
689 assert_se(i
== strv_length(l
));
692 static void test_strv_make_nulstr(void) {
693 test_strv_make_nulstr_one(NULL
);
694 test_strv_make_nulstr_one(STRV_MAKE(NULL
));
695 test_strv_make_nulstr_one(STRV_MAKE("foo"));
696 test_strv_make_nulstr_one(STRV_MAKE("foo", "bar"));
697 test_strv_make_nulstr_one(STRV_MAKE("foo", "bar", "quuux"));
700 static void test_foreach_string(void) {
701 const char * const t
[] = {
710 FOREACH_STRING(x
, "foo", "bar", "waldo")
711 assert_se(streq_ptr(t
[i
++], x
));
715 FOREACH_STRING(x
, "zzz")
716 assert_se(streq(x
, "zzz"));
719 static void test_strv_fnmatch(void) {
720 _cleanup_strv_free_
char **v
= NULL
;
722 assert_se(!strv_fnmatch(STRV_MAKE_EMPTY
, "a", 0));
724 v
= strv_new("*\\*", NULL
);
725 assert_se(!strv_fnmatch(v
, "\\", 0));
726 assert_se(strv_fnmatch(v
, "\\", FNM_NOESCAPE
));
729 int main(int argc
, char *argv
[]) {
730 test_specifier_printf();
732 test_strptr_in_set();
734 test_strv_foreach_backwards();
735 test_strv_foreach_pair();
737 test_strv_find_prefix();
738 test_strv_find_startswith();
741 test_strv_quote_unquote(input_table_multiple
, "\"one\" \"two\" \"three\"");
742 test_strv_quote_unquote(input_table_one
, "\"one\"");
743 test_strv_quote_unquote(input_table_none
, "");
744 test_strv_quote_unquote(input_table_one_empty
, "\"\"");
745 test_strv_quote_unquote(input_table_two_empties
, "\"\" \"\"");
746 test_strv_quote_unquote(input_table_quotes
, QUOTES_STRING
);
747 test_strv_quote_unquote(input_table_spaces
, SPACES_STRING
);
749 test_strv_unquote(" foo=bar \"waldo\" zzz ", STRV_MAKE("foo=bar", "waldo", "zzz"));
750 test_strv_unquote("", STRV_MAKE_EMPTY
);
751 test_strv_unquote(" ", STRV_MAKE_EMPTY
);
752 test_strv_unquote(" ", STRV_MAKE_EMPTY
);
753 test_strv_unquote(" x", STRV_MAKE("x"));
754 test_strv_unquote("x ", STRV_MAKE("x"));
755 test_strv_unquote(" x ", STRV_MAKE("x"));
756 test_strv_unquote(" \"x\" ", STRV_MAKE("x"));
757 test_strv_unquote(" 'x' ", STRV_MAKE("x"));
758 test_strv_unquote(" 'x\"' ", STRV_MAKE("x\""));
759 test_strv_unquote(" \"x'\" ", STRV_MAKE("x'"));
760 test_strv_unquote("a '--b=c \"d e\"'", STRV_MAKE("a", "--b=c \"d e\""));
762 /* trailing backslashes */
763 test_strv_unquote(" x\\\\", STRV_MAKE("x\\"));
764 test_invalid_unquote(" x\\");
766 test_invalid_unquote("a --b='c \"d e\"''");
767 test_invalid_unquote("a --b='c \"d e\" '\"");
768 test_invalid_unquote("a --b='c \"d e\"garbage");
769 test_invalid_unquote("'");
770 test_invalid_unquote("\"");
771 test_invalid_unquote("'x'y'g");
774 test_strv_split_extract();
775 test_strv_split_newlines();
776 test_strv_split_nulstr();
777 test_strv_parse_nulstr();
780 test_strv_extend_strv();
781 test_strv_extend_strv_concat();
784 test_strv_from_stdarg_alloca();
785 test_strv_push_prepend();
790 test_strv_shell_escape();
792 test_strv_extend_n();
793 test_strv_make_nulstr();
795 test_foreach_string();