From 8055d987762b7b883c995d452c71d460ccebe38f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 29 Nov 2017 16:23:18 +0100 Subject: [PATCH] testsuite: Add test for setting pakfire path Signed-off-by: Michael Tremer --- tests/libpakfire/main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/libpakfire/main.c b/tests/libpakfire/main.c index caebf741f..0ac36d2b6 100644 --- a/tests/libpakfire/main.c +++ b/tests/libpakfire/main.c @@ -18,6 +18,8 @@ # # #############################################################################*/ +#include + #include #include "../testsuite.h" @@ -36,12 +38,26 @@ static int test_init(const test_t* t) { return EXIT_SUCCESS; } +static int test_path(const test_t* t) { + Pakfire pakfire = init_pakfire(); + if (!pakfire) + return EXIT_FAILURE; + + const char* path = pakfire_get_path(pakfire); + assert_return(strcmp(path, TEST_PATH) == 0, EXIT_FAILURE); + + pakfire_unref(pakfire); + + return EXIT_SUCCESS; +} + int main(int argc, char** argv) { testsuite_init(); - testsuite_t* ts = testsuite_create(1); + testsuite_t* ts = testsuite_create(2); testsuite_add_test(ts, "test_init", test_init); + testsuite_add_test(ts, "test_path", test_path); return testsuite_run(ts); } -- 2.39.5