]> git.notmuchmail.org Git - notmuch/commitdiff
test: add regression tests for oldest and newest dates
authorDavid Bremner <david@tethera.net>
Fri, 24 Jul 2020 11:14:04 +0000 (08:14 -0300)
committerDavid Bremner <david@tethera.net>
Fri, 31 Jul 2020 10:41:00 +0000 (07:41 -0300)
These are strictly to watch for crashes, so don't be too fussy about
the actual timestamps.

test/T568-lib-thread.sh

index 0f9fa4439235123f54f1548bf722bfe275c28c65..3eb28f3b5be668763189461ac924d85f164a39e2 100755 (executable)
@@ -230,5 +230,37 @@ cat <<EOF > EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "oldest date from closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        time_t stamp;
+        stamp = notmuch_thread_get_oldest_date (thread);
+        printf("%d\n%d\n", thread != NULL, stamp > 0);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "newest date from closed database"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        time_t stamp;
+        stamp = notmuch_thread_get_newest_date (thread);
+        printf("%d\n%d\n", thread != NULL, stamp > 0);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 
 test_done