]> git.notmuchmail.org Git - notmuch/commitdiff
test: add known broken test for n_d_get_version on closed db
authorDavid Bremner <david@tethera.net>
Tue, 14 Jul 2020 00:30:52 +0000 (21:30 -0300)
committerDavid Bremner <david@tethera.net>
Wed, 22 Jul 2020 22:52:55 +0000 (19:52 -0300)
This should not crash, but it does currently.

test/T562-lib-database.sh

index c869341ab383ab9d2f9ff7a4fccfc938add3e9cf..b8fba7d63fc555442dfc0d431fb8f4eb9810ec12 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-test_description="error reporting for library"
+test_description="notmuch_database_* API"
 
 . $(dirname "$0")/test-lib.sh || exit 1
 
@@ -67,4 +67,21 @@ MAIL_DIR
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "get version with closed db"
+test_subtest_known_broken
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+    {
+        unsigned int version;
+        EXPECT0(notmuch_database_close (db));
+        version = notmuch_database_get_version (db);
+        printf ("%u\n", version);
+    }
+EOF
+cat <<EOF > EXPECTED
+== stdout ==
+0
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done