]> git.ipfire.org Git - pakfire.git/commitdiff
tests: packages: Fix group check
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 31 Aug 2023 06:08:01 +0000 (06:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 31 Aug 2023 06:08:01 +0000 (06:08 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/libpakfire/package.c

index 8a56b6d1ace0a72fbc5c0d058d01f8bbf9feded6..ca345c49b767ded8d00f8aa327382667afc1fa8c 100644 (file)
@@ -23,6 +23,7 @@
 #include <uuid/uuid.h>
 
 #include <pakfire/package.h>
+#include <pakfire/string.h>
 #include <pakfire/util.h>
 
 #include "../testsuite.h"
@@ -32,6 +33,7 @@
 */
 static int test_create(const struct test* t) {
        struct pakfire_package* pkg = NULL;
+       char** groups = NULL;
        int r = EXIT_FAILURE;
 
        ASSERT_SUCCESS(pakfire_package_create(&pkg, t->pakfire, NULL, "test", "1.0-1", "x86_64"));
@@ -69,7 +71,10 @@ static int test_create(const struct test* t) {
 
        // Groups
        ASSERT_SUCCESS(pakfire_package_set_string(pkg, PAKFIRE_PKG_GROUPS, "GROUPS"));
-       ASSERT_STRING_EQUALS(pakfire_package_get_string(pkg, PAKFIRE_PKG_GROUPS), "GROUPS");
+
+       groups = pakfire_package_get_strings(pkg, PAKFIRE_PKG_GROUPS);
+       ASSERT(groups && *groups);
+       ASSERT_STRING_EQUALS(groups[0], "GROUPS"); ASSERT(groups[1] == NULL);
 
        // Vendor
        ASSERT_SUCCESS(pakfire_package_set_string(pkg, PAKFIRE_PKG_VENDOR, "VENDOR"));
@@ -139,6 +144,8 @@ static int test_create(const struct test* t) {
 FAIL:
        if (pkg)
                pakfire_package_unref(pkg);
+       if (groups)
+               pakfire_strings_free(groups);
 
        return r;
 }