summaryrefslogtreecommitdiff
path: root/src/test/test-strv.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-10 13:57:52 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-10 14:43:44 +0200
commitb4f386d53b760201dbdb44a09448ed663284f6b0 (patch)
tree030a53868a4145517ef66a61b64cc07f72089e79 /src/test/test-strv.c
parent309c6b19a784c225b17effa8e7ee583fa1d9001d (diff)
downloadsystemd-b4f386d53b760201dbdb44a09448ed663284f6b0.tar.gz
test-strv: test strv_free_erase() a little bit
Diffstat (limited to 'src/test/test-strv.c')
-rw-r--r--src/test/test-strv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index 488025f23a..903de18083 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -227,60 +227,60 @@ static void test_invalid_unquote(const char *quoted) {
}
static void test_strv_split(void) {
- _cleanup_strv_free_ char **l = NULL;
+ _cleanup_(strv_free_erasep) char **l = NULL;
const char str[] = "one,two,three";
l = strv_split(str, ",");
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_multiple));
- strv_free(l);
+ strv_free_erase(l);
l = strv_split(" one two\t three", WHITESPACE);
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_multiple));
- strv_free(l);
+ strv_free_erase(l);
/* Setting NULL for separator is equivalent to WHITESPACE */
l = strv_split(" one two\t three", NULL);
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_multiple));
- strv_free(l);
+ strv_free_erase(l);
l = strv_split_full(" one two\t three", NULL, 0);
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_multiple));
- strv_free(l);
+ strv_free_erase(l);
l = strv_split_full(" 'one' \" two\t three \" ' four five'", NULL, SPLIT_QUOTES);
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_quoted));
- strv_free(l);
+ strv_free_erase(l);
/* missing last quote ignores the last element. */
l = strv_split_full(" 'one' \" two\t three \" ' four five' ' ignored element ", NULL, SPLIT_QUOTES);
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_quoted));
- strv_free(l);
+ strv_free_erase(l);
/* missing last quote, but the last element is _not_ ignored with SPLIT_RELAX. */
l = strv_split_full(" 'one' \" two\t three \" ' four five", NULL, SPLIT_QUOTES | SPLIT_RELAX);
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_quoted));
- strv_free(l);
+ strv_free_erase(l);
/* missing separator between */
l = strv_split_full(" 'one' \" two\t three \"' four five'", NULL, SPLIT_QUOTES | SPLIT_RELAX);
assert_se(l);
assert_se(strv_equal(l, (char**) input_table_quoted));
- strv_free(l);
+ strv_free_erase(l);
l = strv_split_full(" 'one' \" two\t three \"' four five", NULL, SPLIT_QUOTES | SPLIT_RELAX);
assert_se(l);