From: Michael Tremer Date: Wed, 29 Nov 2017 15:23:18 +0000 (+0100) Subject: testsuite: Add test for setting pakfire path X-Git-Tag: 0.9.28~1285^2~1252 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8055d987762b7b883c995d452c71d460ccebe38f;p=pakfire.git testsuite: Add test for setting pakfire path Signed-off-by: Michael Tremer --- 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); }