[PATCH 4/8] test: add regression test for n_t_get_messages

Subject: [PATCH 4/8] test: add regression test for n_t_get_messages

Date: Fri, 24 Jul 2020 08:14:02 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


This is similar to the case of toplevel messages. Currently everything
is cached, so no database access is necessary. This might change in
the future, but it should not crash in either case.
---
 test/T568-lib-thread.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh
index 4703950b..c7d4f26b 100755
--- a/test/T568-lib-thread.sh
+++ b/test/T568-lib-thread.sh
@@ -172,4 +172,30 @@ cat <<EOF > EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "iterate over all messages with closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+      notmuch_messages_t *messages;
+      for (messages = notmuch_thread_get_messages (thread);
+           notmuch_messages_valid (messages);
+           notmuch_messages_move_to_next (messages)) {
+        notmuch_message_t *message = notmuch_messages_get (messages);
+        const char *mid = notmuch_message_get_message_id (message);
+        printf("%s\n", mid);
+      }
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+20091117190054.GU3165@dottiness.seas.harvard.edu
+87iqd9rn3l.fsf@vertex.dottedmag
+20091117203301.GV3165@dottiness.seas.harvard.edu
+87fx8can9z.fsf@vertex.dottedmag
+yunaayketfm.fsf@aiko.keithp.com
+20091118005040.GA25380@dottiness.seas.harvard.edu
+87ocn0qh6d.fsf@yoom.home.cworth.org
+== 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: