test: regression test for closing a closed database
authorDavid Bremner <david@tethera.net>
Thu, 16 Jul 2020 01:59:58 +0000 (22:59 -0300)
committerDavid Bremner <david@tethera.net>
Wed, 22 Jul 2020 22:52:55 +0000 (19:52 -0300)
This does not currently throw an error, and it should stay that way.

test/T562-lib-database.sh

index 20bed8b4646a1607802bfe72c8148cf0d38f15cb..fe5555ec9a8ec541a370d30a4e117afedfa7c001 100755 (executable)
@@ -85,4 +85,19 @@ A Xapian exception occurred at lib/database.cc:XXX: Database has been closed
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "re-close a closed db"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        EXPECT0(notmuch_database_close (db));
+        stat = notmuch_database_close (db);
+        printf ("%d\n", stat);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+0
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done