test: add regression test for n_m_get_header

This function already catches Xapian exceptions, and we want to make
sure it stays that way.
This commit is contained in:
David Bremner 2020-07-04 08:35:08 -03:00
parent 9201c50204
commit 056794a60d

View file

@ -371,4 +371,20 @@ cat <<EOF > EXPECTED
EOF EOF
test_expect_equal_file EXPECTED OUTPUT 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 test_done