libmpm

morphux C package management library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/libmpm

commit c7976ca6cbb21e88593d2f27046584233fee2ed6
parent 98d134a7b07dc1310ad13bf4c07d14d2f0d918e3
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon,  3 Jul 2017 18:46:03 +0200

Add(Tests): New tests for compile

Diffstat:
Msrc/compile.c | 1+
Mtests/test_compile.c | 16++++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/compile.c b/src/compile.c @@ -156,6 +156,7 @@ bool patch_package(compile_t *ctx) { free(cmd); goto end; } + free(cmd); } } diff --git a/tests/test_compile.c b/tests/test_compile.c @@ -54,6 +54,10 @@ TEST(patch_package) { set_chdir_fail(1); TEST_ASSERT(patch_package(ptr) == false, "Error did not raise"); + chdir("/tmp/test-2.0"); + set_fork_fail(0); + TEST_ASSERT(patch_package(ptr) == false, "Error did not raise"); + chdir("/"); TEST_ASSERT(patch_package(ptr) == true, "Error did not raise"); @@ -73,6 +77,18 @@ TEST(configure_package) { ptr = package_install_init(ctx); TEST_ASSERT(ptr != NULL, "An error happened"); + tmp = ptr->package->header->compilation.configure; + ptr->package->header->compilation.configure = NULL; + TEST_ASSERT(configure_package(ptr) == true, "Bad return"); + ptr->package->header->compilation.configure = tmp; + + set_chdir_fail(0); + TEST_ASSERT(configure_package(ptr) == false, "Bad return"); + + set_fork_fail(0); + TEST_ASSERT(configure_package(ptr) == false, "Bad return"); + + chdir("/tmp/test-2.0"); recursive_delete(OUTPUT_DIR); return TEST_SUCCESS; }