]> git.notmuchmail.org Git - notmuch/blob - test/T550-db-features.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / test / T550-db-features.sh
1 #!/usr/bin/env bash
2 test_description="database version and feature compatibility"
3
4 . $(dirname "$0")/test-lib.sh || exit 1
5
6 if [ -n "${NOTMUCH_TEST_INSTALLED-}" ]; then
7     test_done
8 fi
9
10 test_begin_subtest "future database versions abort open"
11 ${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 9999 ""
12 output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')
13 rm -rf ${MAIL_DIR}/.notmuch
14 test_expect_equal "$output" "\
15 Error: Notmuch database at FILENAME
16        has a newer database format version (9999) than supported by this
17        version of notmuch (3)."
18
19 test_begin_subtest "unknown 'rw' feature aborts read/write open"
20 ${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw'
21 output=$(notmuch new 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')
22 rm -rf ${MAIL_DIR}/.notmuch
23 test_expect_equal "$output" "\
24 Error: Notmuch database at FILENAME
25        requires features (test feature)
26        not supported by this version of notmuch."
27
28 test_begin_subtest "unknown 'rw' feature aborts read-only open"
29 ${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw'
30 output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')
31 rm -rf ${MAIL_DIR}/.notmuch
32 test_expect_equal "$output" "\
33 Error: Notmuch database at FILENAME
34        requires features (test feature)
35        not supported by this version of notmuch."
36
37 test_begin_subtest "unknown 'w' feature aborts read/write open"
38 ${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw'
39 output=$(notmuch new 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')
40 rm -rf ${MAIL_DIR}/.notmuch
41 test_expect_equal "$output" "\
42 Error: Notmuch database at FILENAME
43        requires features (test feature)
44        not supported by this version of notmuch."
45
46 test_begin_subtest "unknown 'w' feature does not abort read-only open"
47 ${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw'
48 output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')
49 rm -rf ${MAIL_DIR}/.notmuch
50 test_expect_equal "$output" ""
51
52 test_done