]> git.cworth.org Git - notmuch/commitdiff
test: regression for retrieving closed db from message
authorDavid Bremner <david@tethera.net>
Thu, 9 Jul 2020 00:17:07 +0000 (21:17 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 20 Jul 2020 11:54:42 +0000 (08:54 -0300)
This is actually one of the few potentially useful things you can do
with a message belonging to a closed database, since in principle you
could re-open the database.

test/T560-lib-error.sh

index 492c1fb5094ac2467ca63674408ffa1cb66278d3..4805368a5c9869407cdd5a75784055f48c3e9a1e 100755 (executable)
@@ -645,4 +645,20 @@ cat <<EOF > EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Handle retrieving closed db from message"
+cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        notmuch_database_t *db2;
+        db2 = notmuch_message_get_database (message);
+        printf("%d\n%d\n", message != NULL,  db == db2);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+1
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
 test_done