2 test_description="database upgrade"
6 dbtarball=database-v1.tar.xz
8 # XXX: Accomplish the same with test lib helpers
9 if [ ! -e ${TEST_DIRECTORY}/test-databases/${dbtarball} ]; then
10 test_subtest_missing_external_prereq_["${dbtarball} - fetch with 'make download-test-databases'"]=t
15 '( cd $TEST_DIRECTORY/test-databases &&
16 sha256sum --quiet --check --status ${dbtarball}.sha256 )'
18 tar xf $TEST_DIRECTORY/test-databases/${dbtarball} -C ${MAIL_DIR} --strip-components=1
20 test_begin_subtest "folder: search does not work with old database version"
21 output=$(notmuch search folder:foo)
22 test_expect_equal "$output" ""
24 test_begin_subtest "path: search does not work with old database version"
25 output=$(notmuch search path:foo)
26 test_expect_equal "$output" ""
28 test_begin_subtest "database upgrade from format version 1"
30 test_expect_equal "$output" "\
31 Welcome to a new version of notmuch! Your database will now be upgraded.
32 Your notmuch database has now been upgraded to database format version 2.
35 test_begin_subtest "folder: no longer matches in the middle of path"
36 output=$(notmuch search folder:baz)
37 test_expect_equal "$output" ""
39 test_begin_subtest "folder: search"
40 output=$(notmuch search --output=files folder:foo | notmuch_search_files_sanitize | sort)
41 test_expect_equal "$output" "MAIL_DIR/foo/06:2,
42 MAIL_DIR/foo/cur/07:2,
43 MAIL_DIR/foo/cur/08:2,
44 MAIL_DIR/foo/new/03:2,
45 MAIL_DIR/foo/new/09:2,
46 MAIL_DIR/foo/new/10:2,"
48 test_begin_subtest "top level folder: search"
49 output=$(notmuch search --output=files folder:'""' | notmuch_search_files_sanitize | sort)
50 # bar/18:2, is a duplicate of cur/51:2,
51 test_expect_equal "$output" "MAIL_DIR/01:2,
81 test_begin_subtest "path: search"
82 output=$(notmuch search --output=files path:"bar" | notmuch_search_files_sanitize | sort)
83 # cur/51:2, is a duplicate of bar/18:2,
84 test_expect_equal "$output" "MAIL_DIR/bar/17:2,
88 test_begin_subtest "top level path: search"
89 output=$(notmuch search --output=files path:'""' | notmuch_search_files_sanitize | sort)
90 test_expect_equal "$output" "MAIL_DIR/01:2,
93 test_begin_subtest "recursive path: search"
94 output=$(notmuch search --output=files path:"bar/**" | notmuch_search_files_sanitize | sort)
95 # cur/51:2, is a duplicate of bar/18:2,
96 test_expect_equal "$output" "MAIL_DIR/bar/17:2,
98 MAIL_DIR/bar/baz/05:2,
99 MAIL_DIR/bar/baz/23:2,
100 MAIL_DIR/bar/baz/24:2,
101 MAIL_DIR/bar/baz/cur/25:2,
102 MAIL_DIR/bar/baz/cur/26:2,
103 MAIL_DIR/bar/baz/new/27:2,
104 MAIL_DIR/bar/baz/new/28:2,
105 MAIL_DIR/bar/cur/19:2,
106 MAIL_DIR/bar/cur/20:2,
107 MAIL_DIR/bar/new/21:2,
108 MAIL_DIR/bar/new/22:2,