2 test_description='Configuration of mail-root and database path'
3 . $(dirname "$0")/test-lib.sh || exit 1
6 local test_name=$(basename $0 .sh)
7 cp ${NOTMUCH_CONFIG} notmuch-config-backup.${test_name}
11 local test_name=$(basename $0 .sh)
12 export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
16 cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG}
22 dir="$TMP_DIRECTORY/database.$test_count"
25 notmuch config set database.path $dir
26 notmuch config set database.mail_root $MAIL_DIR
33 dir="$TMP_DIRECTORY/link.$test_count"
35 notmuch config set database.path $dir
36 notmuch config set database.mail_root $MAIL_DIR
42 local profile=${1:-default}
44 if [[ $profile != default ]]; then
45 export NOTMUCH_PROFILE=$profile
49 DATABASE_PATH="${HOME}/.local/share/notmuch/${profile}"
51 mkdir -p $DATABASE_PATH
53 config_dir="${HOME}/.config/notmuch/${profile}"
54 mkdir -p ${config_dir}
55 CONFIG_PATH=$config_dir/config
56 mv ${NOTMUCH_CONFIG} $CONFIG_PATH
59 notmuch --config=${CONFIG_PATH} config set database.mail_root ${TMP_DIRECTORY}/mail
60 notmuch --config=${CONFIG_PATH} config set database.path
63 for config in traditional split XDG XDG+profile symlink; do
64 #start each set of tests with an known set of messages
73 mv mail/.notmuch/xapian $DATABASE_PATH
77 mv mail/.notmuch/xapian $DATABASE_PATH
81 mv mail/.notmuch/xapian $DATABASE_PATH
88 test_begin_subtest "count ($config)"
89 output=$(notmuch count '*')
90 test_expect_equal "$output" '52'
92 test_begin_subtest "count+tag ($config)"
95 output=$(notmuch count tag:$tag)
97 test_expect_equal "$output" '52'
99 test_begin_subtest "address ($config)"
100 notmuch address --deduplicate=no --sort=newest-first --output=sender --output=recipients path:foo >OUTPUT
102 Carl Worth <cworth@cworth.org>
103 notmuch@notmuchmail.org
105 test_expect_equal_file EXPECTED OUTPUT
107 test_begin_subtest "dump ($config)"
108 notmuch dump is:attachment and is:signed | sort > OUTPUT
110 #notmuch-dump batch-tag:3 config,properties,tags
111 +attachment +inbox +signed +unread -- id:20091118005829.GB25380@dottiness.seas.harvard.edu
112 +attachment +inbox +signed +unread -- id:20091118010116.GC25380@dottiness.seas.harvard.edu
114 test_expect_equal_file EXPECTED OUTPUT
116 test_begin_subtest "dump + tag + restore ($config)"
117 notmuch dump '*' > EXPECTED
118 notmuch tag -inbox '*'
119 notmuch restore < EXPECTED
120 notmuch dump > OUTPUT
121 test_expect_equal_file EXPECTED OUTPUT
123 test_begin_subtest "reindex ($config)"
124 notmuch search --output=messages '*' > EXPECTED
126 notmuch search --output=messages '*' > OUTPUT
127 test_expect_equal_file EXPECTED OUTPUT
129 test_begin_subtest "use existing database ($config)"
130 output=$(notmuch new)
131 test_expect_equal "$output" 'No new mail.'
133 test_begin_subtest "create database ($config)"
134 rm -rf $DATABASE_PATH/{.notmuch,}/xapian
136 output=$(notmuch count '*')
137 test_expect_equal "$output" '52'
139 test_begin_subtest "detect new files ($config)"
143 output=$(notmuch count '*')
144 test_expect_equal "$output" '54'
146 test_begin_subtest "Show a raw message ($config)"
148 notmuch show --format=raw id:$gen_msg_id > OUTPUT
149 test_expect_equal_file $gen_msg_filename OUTPUT
150 rm -f $gen_msg_filename
152 test_begin_subtest "reply ($config)"
153 add_message '[from]="Sender <sender@example.com>"' \
154 [to]=test_suite@notmuchmail.org \
155 [subject]=notmuch-reply-test \
156 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
157 '[body]="basic reply test"'
158 notmuch reply id:${gen_msg_id} 2>&1 > OUTPUT
160 From: Notmuch Test Suite <test_suite@notmuchmail.org>
161 Subject: Re: notmuch-reply-test
162 To: Sender <sender@example.com>
163 In-Reply-To: <${gen_msg_id}>
164 References: <${gen_msg_id}>
166 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
169 test_expect_equal_file EXPECTED OUTPUT