libmpm

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

commit 697d3b646d0262e30db93b248b89a82f63ad4d1f
parent ffe8f35d4b3d8d06d09050dd6bf1d520f3cc47b4
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 19 Jun 2017 18:10:12 +0200

Fix(Tests): New test case for extract_archive

Diffstat:
Mtests/test_packer.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/test_packer.c b/tests/test_packer.c @@ -512,6 +512,8 @@ TEST(packer_extract_archive_1) { TEST(packer_read_archive_header) { packer_t *ctx = NULL; + TEST_ASSERT(packer_read_archive_header(NULL) == false, "Error did not raise"); + ctx = packer_init_dir("test/"); TEST_ASSERT(packer_read_archive_header(ctx) == false, "Error did not raise"); packer_free(ctx); @@ -544,6 +546,11 @@ TEST(packer_extract_archive_2) { recursive_delete("/tmp/test-2.0"); ctx = packer_init_archive(PACKAGE_OUTPUT_FN); + TEST_ASSERT(packer_extract_archive(ctx, "/tmp/somedir/") == true, "Error did not raise"); + packer_free(ctx); + recursive_delete("/tmp/somedir"); + + ctx = packer_init_archive(PACKAGE_OUTPUT_FN); set_malloc_fail(0); TEST_ASSERT(packer_extract_archive(ctx, NULL) == false, "Error did not raise"); packer_free(ctx); @@ -563,7 +570,7 @@ TEST(packer_extract_archive_2) { ctx = packer_init_archive(PACKAGE_OUTPUT_FN); set_fchmod_fail(0); - TEST_ASSERT(packer_extract_archive(ctx, "/tmp") == false, "Error did not raise"); + TEST_ASSERT(packer_extract_archive(ctx, "/tmp/") == false, "Error did not raise"); packer_free(ctx); recursive_delete("/tmp/test-2.0");