From 0a4c6cdeb118e68f2fa73a4b90b2fa74a06e88ab Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 22 Jul 2020 07:51:25 -0300 Subject: [PATCH] test: regression test for n_q_search_messages Exception handling matches notmuch_query_search_threads, at least for this case. --- test/T564-lib-query.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/T564-lib-query.sh b/test/T564-lib-query.sh index 97729f9a..dda32be7 100755 --- a/test/T564-lib-query.sh +++ b/test/T564-lib-query.sh @@ -162,4 +162,27 @@ Query string was: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "search messages on closed db" +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} + { + notmuch_query_t *query; + const char *str = "id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net"; + notmuch_messages_t *messages; + + query = notmuch_query_create (db, str); + EXPECT0(notmuch_database_close (db)); + stat = notmuch_query_search_messages (query, &messages); + + printf("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION); + } +EOF +cat < EXPECTED +== stdout == +1 +== stderr == +A Xapian exception occurred performing query: Database has been closed +Query string was: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done -- 2.45.2