unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>
Subject: [PATCH 08/10] test: regression test for n_q_search_messages
Date: Wed, 22 Jul 2020 07:51:25 -0300	[thread overview]
Message-ID: <20200722105127.373054-9-david@tethera.net> (raw)
In-Reply-To: <20200722105127.373054-1-david@tethera.net>

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 <<EOF > 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.27.0

  parent reply	other threads:[~2020-07-22 10:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 10:51 batch 8, API cleanup for exception handling David Bremner
2020-07-22 10:51 ` [PATCH 01/10] test: move notmuch_message_* tests to their own file David Bremner
2020-07-22 10:51 ` [PATCH 02/10] test: add regression test for n_q_{create,_get_query_string} David Bremner
2020-07-22 10:51 ` [PATCH 03/10] test: regression test for notmuch_query_get_database David Bremner
2020-07-22 10:51 ` [PATCH 04/10] test: regression test for set_omit_excluded David Bremner
2020-07-22 10:51 ` [PATCH 05/10] test: regression test for n_q_{set, get}_sort David Bremner
2020-07-22 10:51 ` [PATCH 06/10] test: add regression test for n_q_add_tag_exclude David Bremner
2020-07-22 10:51 ` [PATCH 07/10] test: regression test for n_q_search_threads David Bremner
2020-07-22 10:51 ` David Bremner [this message]
2020-07-22 10:51 ` [PATCH 09/10] test: regression tests for n_q_count_{messages, threads} David Bremner
2020-07-22 10:51 ` [PATCH 10/10] test: regression test for notmuch_query_destroy David Bremner
2020-07-29 15:47 ` batch 8, API cleanup for exception handling David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200722105127.373054-9-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).