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