[PATCH 08/10] test: add regression test for n_d_get_directory

Subject: [PATCH 08/10] test: add regression test for n_d_get_directory

Date: Sat, 18 Jul 2020 12:07:49 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


At least this exception is already handled correctly.
---
 test/T562-lib-database.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/test/T562-lib-database.sh b/test/T562-lib-database.sh
index e9f00726..06569291 100755
--- a/test/T562-lib-database.sh
+++ b/test/T562-lib-database.sh
@@ -214,4 +214,21 @@ cat <<EOF > EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "get directory for a closed db"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        notmuch_directory_t *dir;
+        EXPECT0(notmuch_database_close (db));
+        stat = notmuch_database_get_directory (db, "/nonexistent", &dir);
+        printf ("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+1
+== stderr ==
+A Xapian exception occurred creating a directory: Database has been closed.
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.27.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: