]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-strv: add a simple test for strv_free_free()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Feb 2018 07:57:31 +0000 (08:57 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Feb 2018 07:57:31 +0000 (08:57 +0100)
src/test/test-strv.c

index 76cd551eeb2f9765d11522eb8735053660ba66d9..c6698f43965dbec0797f06fe0518f07c1dcc1379 100644 (file)
@@ -676,6 +676,17 @@ static void test_strv_make_nulstr(void) {
         test_strv_make_nulstr_one(STRV_MAKE("foo", "bar", "quuux"));
 }
 
+static void test_strv_free_free(void) {
+        char ***t;
+
+        assert_se(t = new(char**, 3));
+        assert_se(t[0] = strv_new("a", "b", NULL));
+        assert_se(t[1] = strv_new("c", "d", "e", NULL));
+        t[2] = NULL;
+
+        t = strv_free_free(t);
+}
+
 static void test_foreach_string(void) {
         const char * const t[] = {
                 "foo",
@@ -763,6 +774,7 @@ int main(int argc, char *argv[]) {
         test_strv_skip();
         test_strv_extend_n();
         test_strv_make_nulstr();
+        test_strv_free_free();
 
         test_foreach_string();
         test_strv_fnmatch();