From: Michael Tremer Date: Fri, 2 Dec 2022 11:39:10 +0000 (+0000) Subject: tests: dependencies: Add tests for dependencies with excess space X-Git-Tag: 0.9.28~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f03bd13b35eebac78986652519c2d224a8bc5221;p=pakfire.git tests: dependencies: Add tests for dependencies with excess space Signed-off-by: Michael Tremer --- diff --git a/tests/libpakfire/dependencies.c b/tests/libpakfire/dependencies.c index 83a235fab..aab5413f7 100644 --- a/tests/libpakfire/dependencies.c +++ b/tests/libpakfire/dependencies.c @@ -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: