libmpm

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

commit d5988f56c5f13b16e09d8303c85ced56a569b8aa
parent d51b4a9329be016c00c1478af4501869b9d44a91
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Thu, 15 Jun 2017 18:50:50 +0200

Work(Tests): Working on fixing the tests on the new packer code

Diffstat:
Mtests/test_packer.c | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/tests/test_packer.c b/tests/test_packer.c @@ -494,6 +494,9 @@ TEST(packer_read_archive_header) { TEST(packer_extract_archive_2) { packer_t *ctx = NULL; + recursive_delete("/tmp/test-2.0"); + TEST_ASSERT(packer_extract_archive(NULL, NULL) == false, "Error did not raise"); + ctx = packer_init_dir("Test"); TEST_ASSERT(packer_extract_archive(ctx, NULL) == false, "Error did not raise"); packer_free(ctx); @@ -501,6 +504,31 @@ TEST(packer_extract_archive_2) { ctx = packer_init_archive("Not a valid file"); TEST_ASSERT(packer_extract_archive(ctx, NULL) == false, "Error did not raise"); packer_free(ctx); + recursive_delete("/tmp/test-2.0"); + + 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); + recursive_delete("/tmp/test-2.0"); + + ctx = packer_init_archive(PACKAGE_OUTPUT_FN); + set_chdir_fail(0); + TEST_ASSERT(packer_extract_archive(ctx, "/tmp/") == false, "Error did not raise"); + packer_free(ctx); + recursive_delete("/tmp/test-2.0"); + + ctx = packer_init_archive(PACKAGE_OUTPUT_FN); + set_mkdir_fail(0); + TEST_ASSERT(packer_extract_archive(ctx, "/tmp/") == false, "Error did not raise"); + packer_free(ctx); + recursive_delete("/tmp/test-2.0"); + + ctx = packer_init_archive(PACKAGE_OUTPUT_FN); + set_fchmod_fail(0); + TEST_ASSERT(packer_extract_archive(ctx, "/tmp") == false, "Error did not raise"); + packer_free(ctx); + recursive_delete("/tmp/test-2.0"); return TEST_SUCCESS; }