[PATCH 04/11] test: add regression test for n_m_get_header

Subject: [PATCH 04/11] test: add regression test for n_m_get_header

Date: Sat, 4 Jul 2020 12:17:58 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


This function already catches Xapian exceptions, and we want to make
sure it stays that way.
---
 test/T560-lib-error.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 6432faaa..777eb375 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -371,4 +371,20 @@ cat <<EOF > EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Handle getting header from closed database"
+cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        const char *from;
+        from=notmuch_message_get_header (message, "from");
+        printf("%s\n%d\n", id, from == NULL);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1258471718-6781-1-git-send-email-dottedmag@dottedmag.net
+1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.27.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: