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
40 for config in traditional split symlink; do
41 # start each set of tests with a known set of messages
50 mv mail/.notmuch/xapian $DATABASE_PATH
57 test_begin_subtest "count ($config)"
58 output=$(notmuch count '*')
59 test_expect_equal "$output" '52'
61 test_begin_subtest "count+tag ($config)"
64 output=$(notmuch count tag:$tag)
66 test_expect_equal "$output" '52'
68 test_begin_subtest "address ($config)"
69 notmuch address --deduplicate=no --sort=newest-first --output=sender --output=recipients path:foo >OUTPUT
71 Carl Worth <cworth@cworth.org>
72 notmuch@notmuchmail.org
74 test_expect_equal_file EXPECTED OUTPUT
76 test_begin_subtest "dump ($config)"
77 notmuch dump is:attachment and is:signed | sort > OUTPUT
79 #notmuch-dump batch-tag:3 config,properties,tags
80 +attachment +inbox +signed +unread -- id:20091118005829.GB25380@dottiness.seas.harvard.edu
81 +attachment +inbox +signed +unread -- id:20091118010116.GC25380@dottiness.seas.harvard.edu
83 test_expect_equal_file EXPECTED OUTPUT
85 test_begin_subtest "dump + tag + restore ($config)"
86 notmuch dump '*' > EXPECTED
87 notmuch tag -inbox '*'
88 notmuch restore < EXPECTED
90 test_expect_equal_file EXPECTED OUTPUT
92 test_begin_subtest "reindex ($config)"
93 notmuch search --output=messages '*' > EXPECTED
95 notmuch search --output=messages '*' > OUTPUT
96 test_expect_equal_file EXPECTED OUTPUT
98 test_begin_subtest "use existing database ($config)"
100 test_expect_equal "$output" 'No new mail.'
102 test_begin_subtest "create database ($config)"
103 rm -rf $DATABASE_PATH/{.notmuch,}/xapian
105 output=$(notmuch count '*')
106 test_expect_equal "$output" '52'
108 test_begin_subtest "detect new files ($config)"
112 output=$(notmuch count '*')
113 test_expect_equal "$output" '54'
115 test_begin_subtest "Show a raw message ($config)"
117 notmuch show --format=raw id:$gen_msg_id > OUTPUT
118 test_expect_equal_file $gen_msg_filename OUTPUT
119 rm -f $gen_msg_filename
121 test_begin_subtest "reply ($config)"
122 add_message '[from]="Sender <sender@example.com>"' \
123 [to]=test_suite@notmuchmail.org \
124 [subject]=notmuch-reply-test \
125 '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
126 '[body]="basic reply test"'
127 notmuch reply id:${gen_msg_id} 2>&1 > OUTPUT
129 From: Notmuch Test Suite <test_suite@notmuchmail.org>
130 Subject: Re: notmuch-reply-test
131 To: Sender <sender@example.com>
132 In-Reply-To: <${gen_msg_id}>
133 References: <${gen_msg_id}>
135 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
138 test_expect_equal_file EXPECTED OUTPUT