]> git.cworth.org Git - notmuch/commitdiff
test: add regression test for n_thread_get_total_{messages,files}
authorDavid Bremner <david@tethera.net>
Fri, 24 Jul 2020 11:14:00 +0000 (08:14 -0300)
committerDavid Bremner <david@tethera.net>
Fri, 31 Jul 2020 10:41:00 +0000 (07:41 -0300)
This is returning cached info, so does not need to access the (closed)
database.

test/T568-lib-thread.sh

index 007558344bfdfc47f4c79ec35d125095b19f3359..5816cfbcbc9b6090bf6de6ad5ad0f4c2d33bce12 100755 (executable)
@@ -60,4 +60,36 @@ cat <<EOF > EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "get total messages with closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        int count;
+        count = notmuch_thread_get_total_messages (thread);
+        printf("%d\n%d\n", thread != NULL, count);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+7
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "get total files with closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        int count;
+        count = notmuch_thread_get_total_files (thread);
+        printf("%d\n%d\n", thread != NULL, count);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+7
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done