From 01c58a1cf43635cd6b5be05ebe78b287da88f138 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sat, 27 Apr 2019 22:26:07 +0100 Subject: [PATCH] test: add idna tests for degenerate cases --- test/idna/mutt_idna_intl_to_local.c | 8 ++++++++ test/idna/mutt_idna_local_to_intl.c | 8 ++++++++ test/idna/mutt_idna_to_ascii_lz.c | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/test/idna/mutt_idna_intl_to_local.c b/test/idna/mutt_idna_intl_to_local.c index e076b6928..a6e0e6d0e 100644 --- a/test/idna/mutt_idna_intl_to_local.c +++ b/test/idna/mutt_idna_intl_to_local.c @@ -29,4 +29,12 @@ void test_mutt_idna_intl_to_local(void) { // char * mutt_idna_intl_to_local(const char *user, const char *domain, int flags); + + { + TEST_CHECK(!mutt_idna_intl_to_local(NULL, "banana", 0)); + } + + { + TEST_CHECK(!mutt_idna_intl_to_local("apple", NULL, 0)); + } } diff --git a/test/idna/mutt_idna_local_to_intl.c b/test/idna/mutt_idna_local_to_intl.c index 11c905855..63657cd7a 100644 --- a/test/idna/mutt_idna_local_to_intl.c +++ b/test/idna/mutt_idna_local_to_intl.c @@ -29,4 +29,12 @@ void test_mutt_idna_local_to_intl(void) { // char * mutt_idna_local_to_intl(const char *user, const char *domain); + + { + TEST_CHECK(!mutt_idna_local_to_intl(NULL, "banana")); + } + + { + TEST_CHECK(!mutt_idna_local_to_intl("apple", NULL)); + } } diff --git a/test/idna/mutt_idna_to_ascii_lz.c b/test/idna/mutt_idna_to_ascii_lz.c index 68826c1e4..bf45b32d8 100644 --- a/test/idna/mutt_idna_to_ascii_lz.c +++ b/test/idna/mutt_idna_to_ascii_lz.c @@ -29,4 +29,13 @@ void test_mutt_idna_to_ascii_lz(void) { // int mutt_idna_to_ascii_lz(const char *input, char **output, int flags); + + { + char *out = NULL; + TEST_CHECK(mutt_idna_to_ascii_lz(NULL, &out, 0) == -1); + } + + { + TEST_CHECK(mutt_idna_to_ascii_lz("apple", NULL, 0) == -1); + } } -- 2.40.0