From: David Bremner Date: Sat, 1 Aug 2020 12:26:00 +0000 (-0300) Subject: test: regression test for n_directory_{get,set}_mtime X-Git-Tag: 0.31_rc0~52 X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=e8ffbf84ffa5ae6c02afd339a75ebb24c0a958b2;hp=f4f5db0f1a6e89f56bfd73f8517c1cac7af20290;p=notmuch test: regression test for n_directory_{get,set}_mtime The mtime is cached, so closing the db is not a problem. Writing the mtime throws an exception, which is caught. --- diff --git a/test/T563-lib-directory.sh b/test/T563-lib-directory.sh index 7e44e805..28325ff2 100755 --- a/test/T563-lib-directory.sh +++ b/test/T563-lib-directory.sh @@ -109,4 +109,22 @@ EOF test_expect_equal_file EXPECTED OUTPUT restore_database +backup_database +test_begin_subtest "get/set mtime of directory for a closed db" +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} + { + time_t stamp = notmuch_directory_get_mtime (dir); + stat = notmuch_directory_set_mtime (dir, stamp); + printf ("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION); + } +EOF +cat < EXPECTED +== stdout == +1 +== stderr == +A Xapian exception occurred setting directory mtime: Database has been closed. +EOF +test_expect_equal_file EXPECTED OUTPUT +restore_database + test_done