]> git.notmuchmail.org Git - notmuch/commitdiff
test: add regression test for n_messages_collect_tags
authorDavid Bremner <david@tethera.net>
Sat, 1 Aug 2020 12:25:51 +0000 (09:25 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 3 Aug 2020 23:47:18 +0000 (20:47 -0300)
Also test n_messages_destroy.

test/T568-lib-thread.sh

index 66066854eb832cfb3f7183a413c134fb0ea13516..ac13d98671289c0c2a55e13ec51bfbf02fb57126 100755 (executable)
@@ -285,6 +285,37 @@ unread
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "collect tags with closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+      notmuch_messages_t *messages = notmuch_thread_get_messages (thread);
+
+      notmuch_tags_t *tags = notmuch_messages_collect_tags (messages);
+
+      const char *tag;
+      for (tags = notmuch_thread_get_tags (thread);
+           notmuch_tags_valid (tags);
+           notmuch_tags_move_to_next (tags))
+        {
+          tag = notmuch_tags_get (tags);
+          printf ("%s\n", tag);
+        }
+      notmuch_tags_destroy (tags);
+      notmuch_messages_destroy (messages);
+
+      printf("SUCCESS\n");
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+inbox
+signed
+unread
+SUCCESS
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "destroy thread with closed database"
 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
     {