libmpm

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

commit 98d134a7b07dc1310ad13bf4c07d14d2f0d918e3
parent 1f040ec753078f64b5da0aba0e646c1add59e7db
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 26 Jun 2017 21:35:04 +0200

Add(Tests): Add test for packer_create_archive

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

diff --git a/tests/test_packer.c b/tests/test_packer.c @@ -358,6 +358,28 @@ TEST(packer_create_archive_3) { return TEST_SUCCESS; } +TEST(packer_create_archive_4) { + packer_t *ptr; + + ptr = packer_init_dir("packer/right/"); + packer_read_dir(ptr); + + set_stat_fail(0); + TEST_ASSERT(packer_create_archive(ptr, "package_2.mpx") == false, + "An error happened"); + + set_stat_fail(2); + TEST_ASSERT(packer_create_archive(ptr, "package_2.mpx") == false, + "An error happened"); + + set_stat_fail(4); + TEST_ASSERT(packer_create_archive(ptr, "package_2.mpx") == false, + "An error happened"); + packer_free(ptr); + return TEST_SUCCESS; +} + + MPX_STATIC bool write_packer_sources(FILE *fd, packer_t *ctx, const char *dir_name); TEST(packer_write_packer_sources) { FILE *fd = fopen("package_2.mpx", "w+"); @@ -704,6 +726,7 @@ void register_test_packer(void) { reg_test("packer", packer_create_archive_1); reg_test("packer", packer_create_archive_2); reg_test("packer", packer_create_archive_3); + reg_test("packer", packer_create_archive_4); reg_test("packer", packer_write_packer_sources); reg_test("packer", packer_create_archive_wrong_fn); reg_test("packer", packer_create_archive_wrong_type);