]> git.ipfire.org Git - pakfire.git/commitdiff
tests: dependencies: Add tests for dependencies with excess space
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 2 Dec 2022 11:39:10 +0000 (11:39 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 2 Dec 2022 11:39:10 +0000 (11:39 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/libpakfire/dependencies.c

index 83a235fabdcd2f89b05923248ff951bf85e96dc2..aab5413f7d5aea1c656c7f27ca72b536b3c0994c 100644 (file)
@@ -101,6 +101,18 @@ static const char* invalid_relations[] = {
        NULL,
 };
 
+static const char* more_relations[] = {
+       // Dependencies with excess space
+       "pkgconfig(blah) ",
+       "pkgconfig(glib-2.0)  ",
+       "kernel ",
+       " kernel",
+       "kernel >= 1 ",
+       " kernel >= 1",
+
+       NULL,
+};
+
 static int test_dependencies(const struct test* t) {
        Id dep = 0;
        const char* result = NULL;
@@ -135,6 +147,19 @@ static int test_dependencies(const struct test* t) {
                ASSERT(dep == ID_NULL);
        }
 
+       // Check some more relations without comparing the result
+       for (const char** relation = more_relations; *relation; relation++) {
+               printf("Parsing '%s'...\n", *relation);
+
+               // Parse relation
+               ASSERT(dep = pakfire_str2dep(t->pakfire, *relation));
+
+               // Convert it back to string
+               ASSERT(result = pakfire_dep2str(t->pakfire, dep));
+
+               printf("  as '%s'\n", result);
+       }
+
        return EXIT_SUCCESS;
 
 FAIL: