libmpm

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

commit 7ad50c1d9c4c648e7221e2bba365578560caf988
parent 7daee1519e519775c740910ac156ee3f70406034
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Wed, 12 Apr 2017 19:44:41 +0200

Add(Tests): Add cleanup after archive test

Diffstat:
Msrc/packer.c | 1+
Mtests/test_packer.c | 10+++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/packer.c b/src/packer.c @@ -435,6 +435,7 @@ MPX_STATIC void write_package_header(FILE *fd, packer_t *ctx) { fprintf(fd, "%s%c", h->compilation->test, 0); fprintf(fd, "%s%c", h->compilation->install, 0); + /* TODO: print binary size of the list before content */ list_for_each(h->dependencies->list, tmp, tmp_str) { fprintf(fd, "%s%c", tmp_str, 0); } diff --git a/tests/test_packer.c b/tests/test_packer.c @@ -261,12 +261,14 @@ TEST(packer_header_deps_init) { return TEST_SUCCESS; } +#define PACKAGE_OUTPUT_FN "package" PACKER_DEF_EXT + TEST(packer_create_archive_1) { packer_t *ptr; ptr = packer_init_dir("packer/right/"); TEST_ASSERT(packer_read_dir(ptr) == true, "An error happened"); - TEST_ASSERT(packer_create_archive(ptr, "package" PACKER_DEF_EXT) == true, + TEST_ASSERT(packer_create_archive(ptr, PACKAGE_OUTPUT_FN) == true, "An error happened"); return TEST_SUCCESS; } @@ -290,6 +292,11 @@ TEST(packer_create_archive_wrong_type) { return TEST_SUCCESS; } +TEST(packer_create_archive_cleanup) { + unlink(PACKAGE_OUTPUT_FN); + return TEST_SUCCESS; +} + void register_test_packer(void) { reg_test("packer", packer_init_dir); reg_test("packer", packer_init_archive); @@ -323,5 +330,6 @@ void register_test_packer(void) { reg_test("packer", packer_create_archive_1); reg_test("packer", packer_create_archive_wrong_fn); reg_test("packer", packer_create_archive_wrong_type); + reg_test("packer", packer_create_archive_cleanup); }