]> git.notmuchmail.org Git - notmuch/commitdiff
lib/n_m_get_replies: doc return, initial regression test
authorDavid Bremner <david@tethera.net>
Sat, 4 Jul 2020 12:09:09 +0000 (09:09 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 13 Jul 2020 10:19:22 +0000 (07:19 -0300)
We need to to set a query and retrieve the threads to meaningfully
test this function.

lib/notmuch.h
test/T560-lib-error.sh

index 0dc89547017a6e5362333e167b0105c9e16c7421..037913f40303e0153db912e1e5d883530b6ffe78 100644 (file)
@@ -1402,7 +1402,10 @@ notmuch_message_get_thread_id (notmuch_message_t *message);
  * NULL. (Note that notmuch_messages_valid will accept that NULL
  * value as legitimate, and simply return FALSE for it.)
  *
- * The returned list will be destroyed when the thread is destroyed.
+ * This function also returns NULL if it triggers a Xapian exception.
+ *
+ * The returned list will be destroyed when the thread is
+ * destroyed.
  */
 notmuch_messages_t *
 notmuch_message_get_replies (notmuch_message_t *message);
index 777eb375ed4c486a30eec533c1c78ef81a6b37aa..d7caed5a49d833e4852497edb10f7f6e816138a7 100755 (executable)
@@ -387,4 +387,22 @@ cat <<EOF > EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+# XXX TODO: test on a message from notmuch_thread_get_toplevel_messages
+# XXX this test only tests the trivial code path
+test_begin_subtest "Handle getting replies from closed database"
+cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        notmuch_messages_t *replies;
+        replies = notmuch_message_get_replies (message);
+        printf("%d\n%d\n", message != NULL, replies==NULL);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done