From f03bd13b35eebac78986652519c2d224a8bc5221 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 2 Dec 2022 11:39:10 +0000 Subject: [PATCH] tests: dependencies: Add tests for dependencies with excess space Signed-off-by: Michael Tremer --- tests/libpakfire/dependencies.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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: -- 2.39.5