[PATCH 5/8] test: add regression tests for n_t_get_{authors, subject}

Subject: [PATCH 5/8] test: add regression tests for n_t_get_{authors, subject}

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

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


This is returning explicitely cached data, so no database access is needed.
---
 test/T568-lib-thread.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh
index c7d4f26b..0f9fa443 100755
--- a/test/T568-lib-thread.sh
+++ b/test/T568-lib-thread.sh
@@ -198,4 +198,37 @@ yunaayketfm.fsf@aiko.keithp.com
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "get authors from closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        const char *authors;
+        authors = notmuch_thread_get_authors (thread);
+        printf("%d\n%s\n", thread != NULL, authors);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "get subject from closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        const char *subject;
+        subject = notmuch_thread_get_subject (thread);
+        printf("%d\n%s\n", thread != NULL, subject);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+[notmuch] Working with Maildir storage?
+== 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: