]> granicus.if.org Git - neomutt/commitdiff
test: add attach tests for degenerate cases
authorRichard Russon <rich@flatcap.org>
Mon, 29 Apr 2019 13:46:55 +0000 (14:46 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:22:04 +0000 (11:22 +0100)
test/attach/mutt_actx_add_attach.c
test/attach/mutt_actx_add_body.c
test/attach/mutt_actx_add_fp.c
test/attach/mutt_actx_free.c
test/attach/mutt_actx_free_entries.c

index 5b088c806c79dc2d70ea2c44d72a95eeff20079b..cab419ba7eb9a28f523150502ffac1c1faefa077 100644 (file)
 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)");
+  }
 }
index 87767f8bc20695b03823e467dc390a5d155b31a4..d4b873bef90570b74f059a7f87e50fdb7b1f24d5 100644 (file)
 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)");
+  }
 }
index 6175a7db91d542b3070b22ca932c14efcf4a5bae..7d3035902d6d60a6e7b87d4c081e5b1b5a1c1e30 100644 (file)
 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)");
+  }
 }
index 9b67c6b3511bab997b1addf076eed3fe771238b2..09328da8a0708d5ae46da00d685f197be22f7931 100644 (file)
 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)");
+  }
 }
index cf7aa698f7801b4489957d41e7dba9b678c2dde7..1562254f236a2011ff48d631ff9fa7b6639dcec1 100644 (file)
@@ -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)");
+  }
 }