From bc073df46084b2725c4e4a2b5a7e6a6dceaa6280 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 29 Apr 2019 14:46:55 +0100 Subject: [PATCH] test: add attach tests for degenerate cases --- test/attach/mutt_actx_add_attach.c | 12 ++++++++++++ test/attach/mutt_actx_add_body.c | 12 ++++++++++++ test/attach/mutt_actx_add_fp.c | 12 ++++++++++++ test/attach/mutt_actx_free.c | 11 +++++++++++ test/attach/mutt_actx_free_entries.c | 5 +++++ 5 files changed, 52 insertions(+) diff --git a/test/attach/mutt_actx_add_attach.c b/test/attach/mutt_actx_add_attach.c index 5b088c806..cab419ba7 100644 --- a/test/attach/mutt_actx_add_attach.c +++ b/test/attach/mutt_actx_add_attach.c @@ -30,4 +30,16 @@ void test_mutt_actx_add_attach(void) { // void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach); + + { + struct AttachPtr attach = { 0 }; + mutt_actx_add_attach(NULL, &attach); + TEST_CHECK_(1, "mutt_actx_add_attach(NULL, &attach)"); + } + + { + struct AttachCtx attachctx = { 0 }; + mutt_actx_add_attach(&attachctx, NULL); + TEST_CHECK_(1, "mutt_actx_add_attach(&attachctx, NULL)"); + } } diff --git a/test/attach/mutt_actx_add_body.c b/test/attach/mutt_actx_add_body.c index 87767f8bc..d4b873bef 100644 --- a/test/attach/mutt_actx_add_body.c +++ b/test/attach/mutt_actx_add_body.c @@ -30,4 +30,16 @@ void test_mutt_actx_add_body(void) { // void mutt_actx_add_body(struct AttachCtx *actx, struct Body *new_body); + + { + struct Body body = { 0 }; + mutt_actx_add_body(NULL, &body); + TEST_CHECK_(1, "mutt_actx_add_body(NULL, &body)"); + } + + { + struct AttachCtx attachctx = { 0 }; + mutt_actx_add_body(&attachctx, NULL); + TEST_CHECK_(1, "mutt_actx_add_body(&attachctx, NULL)"); + } } diff --git a/test/attach/mutt_actx_add_fp.c b/test/attach/mutt_actx_add_fp.c index 6175a7db9..7d3035902 100644 --- a/test/attach/mutt_actx_add_fp.c +++ b/test/attach/mutt_actx_add_fp.c @@ -30,4 +30,16 @@ void test_mutt_actx_add_fp(void) { // void mutt_actx_add_fp(struct AttachCtx *actx, FILE *fp_new); + + { + FILE fp = { 0 }; + mutt_actx_add_fp(NULL, &fp); + TEST_CHECK_(1, "mutt_actx_add_fp(NULL, &fp)"); + } + + { + struct AttachCtx attachctx = { 0 }; + mutt_actx_add_fp(&attachctx, NULL); + TEST_CHECK_(1, "mutt_actx_add_fp(&attachctx, NULL)"); + } } diff --git a/test/attach/mutt_actx_free.c b/test/attach/mutt_actx_free.c index 9b67c6b35..09328da8a 100644 --- a/test/attach/mutt_actx_free.c +++ b/test/attach/mutt_actx_free.c @@ -30,4 +30,15 @@ void test_mutt_actx_free(void) { // void mutt_actx_free(struct AttachCtx **pactx); + + { + mutt_actx_free(NULL); + TEST_CHECK_(1, "mutt_actx_free(NULL)"); + } + + { + struct AttachCtx *attachctx = NULL; + mutt_actx_free(&attachctx); + TEST_CHECK_(1, "mutt_actx_free(&attachctx)"); + } } diff --git a/test/attach/mutt_actx_free_entries.c b/test/attach/mutt_actx_free_entries.c index cf7aa698f..1562254f2 100644 --- a/test/attach/mutt_actx_free_entries.c +++ b/test/attach/mutt_actx_free_entries.c @@ -30,4 +30,9 @@ void test_mutt_actx_free_entries(void) { // void mutt_actx_free_entries(struct AttachCtx *actx); + + { + mutt_actx_free_entries(NULL); + TEST_CHECK_(1, "mutt_actx_free_entries(NULL)"); + } } -- 2.40.0