1 Return-Path: <sojkam1@fel.cvut.cz>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 18148431FAE
\r
6 for <notmuch@notmuchmail.org>; Mon, 8 Feb 2010 07:16:33 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.357 tagged_above=-999 required=5 tests=[AWL=0.242,
\r
12 BAYES_00=-2.599] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id I-yoQ9WPeMXe for <notmuch@notmuchmail.org>;
\r
16 Mon, 8 Feb 2010 07:16:28 -0800 (PST)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 5657A431FBD
\r
19 for <notmuch@notmuchmail.org>; Mon, 8 Feb 2010 07:16:28 -0800 (PST)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id 63E0519F3380;
\r
22 Mon, 8 Feb 2010 16:16:27 +0100 (CET)
\r
23 X-Virus-Scanned: IMAP AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,
\r
27 with ESMTP id 2rJI2Lp6eSFj; Mon, 8 Feb 2010 16:16:22 +0100 (CET)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id 5605D19F3398;
\r
30 Mon, 8 Feb 2010 16:16:21 +0100 (CET)
\r
31 Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30])
\r
32 (Authenticated sender: sojkam1)
\r
33 by imap.feld.cvut.cz (Postfix) with ESMTPSA id 38FA315C066;
\r
34 Mon, 8 Feb 2010 16:16:21 +0100 (CET)
\r
35 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
36 To: notmuch@notmuchmail.org
\r
37 Date: Mon, 8 Feb 2010 16:16:09 +0100
\r
38 Message-Id: <1265642169-15801-3-git-send-email-sojkam1@fel.cvut.cz>
\r
39 X-Mailer: git-send-email 1.6.6
\r
40 In-Reply-To: <201002081614.24284.sojkam1@fel.cvut.cz>
\r
41 References: <201002081614.24284.sojkam1@fel.cvut.cz>
\r
42 Subject: [notmuch] [PATCH 3/3] Convert the actual tests to the new framework
\r
43 X-BeenThere: notmuch@notmuchmail.org
\r
44 X-Mailman-Version: 2.1.13
\r
46 List-Id: "Use and development of the notmuch mail system."
\r
47 <notmuch.notmuchmail.org>
\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
51 List-Post: <mailto:notmuch@notmuchmail.org>
\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
55 X-List-Received-Date: Mon, 08 Feb 2010 15:16:33 -0000
\r
58 - The notmuch-test was split into several files (t000?-*.sh).
\r
59 - Removed helper functions which were moved to test-lib.sh
\r
60 - Replaced every printf with test_expect_success.
\r
61 - Replaced $NOTMUCH with notmuch (test-lib.sh sets $PATH appropriately)
\r
62 - Test commands chained with && (test-lib.sh doesn't use "set -e" in
\r
63 order to complete the test suite even if something fails)
\r
64 - Many variables such as ${MAIL_DIR} were properly quoted as they
\r
66 - Changed quoting patterns in add_message and generate_message (single
\r
67 quotes are already used by the test framework).
\r
68 - ${TEST_DIR} replaced by ./
\r
72 To run the whole test suite
\r
75 To run only a single test
\r
78 To stop on the first error
\r
80 then mail store and database can be inspected in
\r
81 "trash directory.t0001-new"
\r
83 To see the output of tests
\r
86 To not remove trash directory at the end:
\r
89 To run all tests verbosely:
\r
90 make make GIT_TEST_OPTS="-v"
\r
92 TODO: Convert GIT_* variables in test-lib.sh to NOTMUCH_*
\r
94 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
\r
96 test/notmuch-test | 542 ------------------------------------------
\r
97 test/t0000-basic.sh | 2 +-
\r
98 test/t0001-new.sh | 135 +++++++++++
\r
99 test/t0002-search.sh | 62 +++++
\r
100 test/t0003-reply.sh | 114 +++++++++
\r
101 test/t0004-uuencoded-data.sh | 35 +++
\r
102 test/t0005-dump-restore.sh | 44 ++++
\r
103 7 files changed, 391 insertions(+), 543 deletions(-)
\r
104 delete mode 100755 test/notmuch-test
\r
105 create mode 100755 test/t0001-new.sh
\r
106 create mode 100755 test/t0002-search.sh
\r
107 create mode 100755 test/t0003-reply.sh
\r
108 create mode 100755 test/t0004-uuencoded-data.sh
\r
109 create mode 100755 test/t0005-dump-restore.sh
\r
111 diff --git a/test/notmuch-test b/test/notmuch-test
\r
112 deleted file mode 100755
\r
113 index 2e5eb24..0000000
\r
114 --- a/test/notmuch-test
\r
120 -find_notmuch_binary ()
\r
124 - while [ -n "$dir" ]; do
\r
126 - if [ -x $bin ]; then
\r
130 - dir=$(dirname $dir)
\r
131 - if [ "$dir" = "/" ]; then
\r
139 -increment_mtime_amount=0
\r
140 -increment_mtime ()
\r
144 - increment_mtime_amount=$((increment_mtime_amount + 1))
\r
145 - touch -d "+${increment_mtime_amount} seconds" $dir
\r
148 -# Generate a new message in the mail directory, with a unique message
\r
149 -# ID and subject. The message is not added to the index.
\r
151 -# After this function returns, the filename of the generated message
\r
152 -# is available as $gen_msg_filename and the message ID is available as
\r
155 -# This function supports named parameters with the bash syntax for
\r
156 -# assigning a value to an associative array ([name]=value). The
\r
157 -# supported parameters are:
\r
159 -# [dir]=directory/of/choice
\r
161 -# Generate the message in directory 'directory/of/choice' within
\r
162 -# the mail store. The directory will be created if necessary.
\r
166 -# Text to use as the body of the email message
\r
168 -# '[from]="Some User <user@example.com>"'
\r
169 -# '[to]="Some User <user@example.com>"'
\r
170 -# '[subject]="Subject of email message"'
\r
171 -# '[date]="RFC 822 Date"'
\r
173 -# Values for email headers. If not provided, default values will
\r
174 -# be generated instead.
\r
176 -# '[cc]="Some User <user@example.com>"'
\r
177 -# [reply-to]=some-address
\r
178 -# [in-reply-to]=<message-id>
\r
180 -# Additional values for email headers. If these are not provided
\r
181 -# then the relevant headers will simply not appear in the
\r
184 -gen_msg_filename=""
\r
186 -generate_message ()
\r
188 - # This is our (bash-specific) magic for doing named parameters
\r
189 - local -A template="($@)"
\r
190 - local additional_headers
\r
192 - gen_msg_cnt=$((gen_msg_cnt + 1))
\r
193 - gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)
\r
194 - gen_msg_id="${gen_msg_name}@notmuch-test-suite"
\r
196 - if [ -z "${template[dir]}" ]; then
\r
197 - gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
\r
199 - gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name"
\r
200 - mkdir -p $(dirname $gen_msg_filename)
\r
203 - if [ -z "${template[body]}" ]; then
\r
204 - template[body]="This is just a test message at ${gen_msg_filename}"
\r
207 - if [ -z "${template[from]}" ]; then
\r
208 - template[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"
\r
211 - if [ -z "${template[to]}" ]; then
\r
212 - template[to]="Notmuch Test Suite <test_suite@notmuchmail.org>"
\r
215 - if [ -z "${template[subject]}" ]; then
\r
216 - template[subject]="Test message ${gen_msg_filename}"
\r
219 - if [ -z "${template[date]}" ]; then
\r
220 - template[date]="Tue, 05 Jan 2010 15:43:57 -0800"
\r
223 - additional_headers=""
\r
224 - if [ ! -z "${template[reply-to]}" ]; then
\r
225 - additional_headers="Reply-To: ${template[reply-to]}
\r
226 -${additional_headers}"
\r
229 - if [ ! -z "${template[in-reply-to]}" ]; then
\r
230 - additional_headers="In-Reply-To: ${template[in-reply-to]}
\r
231 -${additional_headers}"
\r
234 - if [ ! -z "${template[cc]}" ]; then
\r
235 - additional_headers="Cc: ${template[cc]}
\r
236 -${additional_headers}"
\r
239 -cat <<EOF >$gen_msg_filename
\r
240 -From: ${template[from]}
\r
241 -To: ${template[to]}
\r
242 -Message-Id: <${gen_msg_id}>
\r
243 -Subject: ${template[subject]}
\r
244 -Date: ${template[date]}
\r
245 -${additional_headers}
\r
249 - # Ensure that the mtime of the containing directory is updated
\r
250 - increment_mtime $(dirname ${gen_msg_filename})
\r
253 -# Generate a new message and add it to the index.
\r
255 -# All of the arguments and return values supported by generate_message
\r
256 -# are alos supported here, so see that function for details.
\r
259 - generate_message "$@"
\r
261 - $NOTMUCH new > /dev/null
\r
264 -NOTMUCH_IGNORED_OUTPUT_REGEXP='^Processed [0-9]*( total)? file|Found [0-9]* total file'
\r
265 -NOTMUCH_THREAD_ID_SQUELCH='s/thread:................................/thread:XXX/'
\r
266 -execute_expecting ()
\r
271 - output=$($NOTMUCH $args | grep -v -E -e "$NOTMUCH_IGNORED_OUTPUT_REGEXP" | sed -e "$NOTMUCH_THREAD_ID_SQUELCH" || true)
\r
272 - if [ "$output" = "$expected" ]; then
\r
276 - echo " Expected output: $expected"
\r
277 - echo " Actual output: $output"
\r
281 -TEST_DIR=$(pwd)/test.$$
\r
282 -MAIL_DIR=${TEST_DIR}/mail
\r
283 -export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config
\r
284 -NOTMUCH=$(find_notmuch_binary $(pwd))
\r
286 -rm -rf ${TEST_DIR}
\r
292 -cat <<EOF > ${NOTMUCH_CONFIG}
\r
297 -name=Notmuch Test Suite
\r
298 -primary_email=test_suite@notmuchmail.org
\r
299 -other_email=test_suite_other@notmuchmail.org
\r
302 -printf "Testing \"notmuch new\" in several variations:\n"
\r
303 -printf " No new messages...\t\t"
\r
304 -execute_expecting new "No new mail."
\r
306 -printf " Single new message...\t\t"
\r
308 -execute_expecting new "Added 1 new message to the database."
\r
310 -printf " Multiple new messages...\t"
\r
313 -execute_expecting new "Added 2 new messages to the database."
\r
315 -printf " No new messages (non-empty DB)... "
\r
316 -execute_expecting new "No new mail."
\r
318 -printf " New directories...\t\t"
\r
319 -rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
\r
320 -mkdir ${MAIL_DIR}/def
\r
321 -mkdir ${MAIL_DIR}/ghi
\r
322 -generate_message [dir]=def
\r
324 -execute_expecting new "Added 1 new message to the database."
\r
326 -printf " Alternate inode order...\t"
\r
328 -rm -rf ${MAIL_DIR}/.notmuch
\r
329 -mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc
\r
330 -rm ${MAIL_DIR}/def/*
\r
331 -generate_message [dir]=abc
\r
333 -execute_expecting new "Added 1 new message to the database."
\r
335 -printf " Message moved in...\t\t"
\r
336 -rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
\r
338 -tmp_msg_filename=tmp/$gen_msg_filename
\r
339 -mkdir -p $(dirname $tmp_msg_filename)
\r
340 -mv $gen_msg_filename $tmp_msg_filename
\r
341 -increment_mtime ${MAIL_DIR}
\r
342 -$NOTMUCH new > /dev/null
\r
343 -mv $tmp_msg_filename $gen_msg_filename
\r
344 -increment_mtime ${MAIL_DIR}
\r
345 -execute_expecting new "Added 1 new message to the database."
\r
347 -printf " Renamed message...\t\t"
\r
350 -$NOTMUCH new > /dev/null
\r
351 -mv $gen_msg_filename ${gen_msg_filename}-renamed
\r
352 -increment_mtime ${MAIL_DIR}
\r
353 -execute_expecting new "No new mail. Detected 1 file rename."
\r
355 -printf " Deleted message...\t\t"
\r
357 -rm ${gen_msg_filename}-renamed
\r
358 -increment_mtime ${MAIL_DIR}
\r
359 -execute_expecting new "No new mail. Removed 1 message."
\r
361 -printf " Renamed directory...\t\t"
\r
363 -generate_message [dir]=dir
\r
364 -generate_message [dir]=dir
\r
365 -generate_message [dir]=dir
\r
367 -$NOTMUCH new > /dev/null
\r
369 -mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed
\r
370 -increment_mtime ${MAIL_DIR}
\r
372 -execute_expecting new "No new mail. Detected 3 file renames."
\r
374 -printf " Deleted directory...\t\t"
\r
376 -rm -rf ${MAIL_DIR}/dir-renamed
\r
377 -increment_mtime ${MAIL_DIR}
\r
379 -execute_expecting new "No new mail. Removed 3 messages."
\r
381 -printf " New directory (at end of list)... "
\r
383 -generate_message [dir]=zzz
\r
384 -generate_message [dir]=zzz
\r
385 -generate_message [dir]=zzz
\r
387 -execute_expecting new "Added 3 new messages to the database."
\r
389 -printf " Deleted directory (end of list)... "
\r
391 -rm -rf ${MAIL_DIR}/zzz
\r
392 -increment_mtime ${MAIL_DIR}
\r
394 -execute_expecting new "No new mail. Removed 3 messages."
\r
396 -printf " New symlink to directory...\t"
\r
398 -rm -rf ${MAIL_DIR}/.notmuch
\r
399 -mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir
\r
402 -ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink
\r
404 -execute_expecting new "Added 1 new message to the database."
\r
406 -printf " New symlink to a file...\t"
\r
408 -external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)
\r
409 -mkdir -p $(dirname $external_msg_filename)
\r
410 -mv $gen_msg_filename $external_msg_filename
\r
411 -ln -s $external_msg_filename $gen_msg_filename
\r
412 -increment_mtime ${MAIL_DIR}
\r
413 -execute_expecting new "Added 1 new message to the database."
\r
415 -printf " New two-level directory...\t"
\r
417 -generate_message [dir]=two/levels
\r
418 -generate_message [dir]=two/levels
\r
419 -generate_message [dir]=two/levels
\r
421 -execute_expecting new "Added 3 new messages to the database."
\r
423 -printf " Deleted two-level directory... "
\r
425 -rm -rf ${MAIL_DIR}/two
\r
426 -increment_mtime ${MAIL_DIR}
\r
428 -execute_expecting new "No new mail. Removed 3 messages."
\r
430 -printf "\nTesting \"notmuch search\" in several variations:\n"
\r
432 -printf " Search body...\t\t\t"
\r
433 -add_message '[subject]="body search"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [body]=bodysearchtest
\r
434 -execute_expecting "search bodysearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)"
\r
436 -printf " Search by from:...\t\t"
\r
437 -add_message '[subject]="search by from"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [from]=searchbyfrom
\r
438 -execute_expecting "search from:searchbyfrom" "thread:XXX 2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)"
\r
440 -printf " Search by to:...\t\t"
\r
441 -add_message '[subject]="search by to"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [to]=searchbyto
\r
442 -execute_expecting "search to:searchbyto" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)"
\r
444 -printf " Search by subject:...\t\t"
\r
445 -add_message [subject]=subjectsearchtest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
\r
446 -execute_expecting "search subject:subjectsearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)"
\r
448 -printf " Search by id:...\t\t"
\r
449 -add_message '[subject]="search by id"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
\r
450 -execute_expecting "search id:${gen_msg_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
\r
452 -printf " Search by tag:...\t\t"
\r
453 -add_message '[subject]="search by tag"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
\r
454 -$NOTMUCH tag +searchbytag id:${gen_msg_id}
\r
455 -execute_expecting "search tag:searchbytag" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)"
\r
457 -printf " Search by thread:...\t\t"
\r
458 -add_message '[subject]="search by thread"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
\r
459 -thread_id=$($NOTMUCH search id:${gen_msg_id} | sed -e 's/thread:\([a-f0-9]*\).*/\1/')
\r
460 -execute_expecting "search thread:${thread_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)"
\r
462 -printf " Search body (phrase)...\t"
\r
463 -add_message '[subject]="body search (phrase)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="body search (phrase)"'
\r
464 -execute_expecting "search 'body search (phrase)'" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)"
\r
466 -printf " Search by from: (address)...\t"
\r
467 -add_message '[subject]="search by from (address)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [from]=searchbyfrom@example.com
\r
468 -execute_expecting "search from:searchbyfrom@example.com" "thread:XXX 2000-01-01 [1/1] searchbyfrom@example.com; search by from (address) (inbox unread)"
\r
470 -printf " Search by from: (name)...\t"
\r
471 -add_message '[subject]="search by from (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[from]="Search By From Name <test@example.com>"'
\r
472 -execute_expecting "search from:'Search By From Name'" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
\r
474 -printf " Search by to: (address)...\t"
\r
475 -add_message '[subject]="search by to (address)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [to]=searchbyto@example.com
\r
476 -execute_expecting "search to:searchbyto@example.com" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (address) (inbox unread)"
\r
478 -printf " Search by to: (name)...\t"
\r
479 -add_message '[subject]="search by to (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[to]="Search By To Name <test@example.com>"'
\r
480 -execute_expecting "search to:'Search By To Name'" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
\r
482 -printf " Search by subject: (phrase)...\t"
\r
483 -add_message '[subject]="subject search test (phrase)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
\r
484 -execute_expecting "search subject:'subject search test (phrase)'" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread)"
\r
486 -printf "\nTesting \"notmuch reply\" in several variations:\n"
\r
488 -printf " Basic reply...\t\t\t"
\r
489 -add_message '[from]="Sender <sender@example.com>"' \
\r
490 - [to]=test_suite@notmuchmail.org \
\r
491 - [subject]=notmuch-reply-test \
\r
492 - '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
\r
493 - '[body]="basic reply test"'
\r
495 -execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
496 -Subject: Re: notmuch-reply-test
\r
497 -To: Sender <sender@example.com>
\r
498 -Bcc: test_suite@notmuchmail.org
\r
499 -In-Reply-To: <${gen_msg_id}>
\r
500 -References: <${gen_msg_id}>
\r
502 -On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
503 -> basic reply test"
\r
505 -printf " Multiple recipients...\t\t"
\r
506 -add_message '[from]="Sender <sender@example.com>"' \
\r
507 - '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
\r
508 - [subject]=notmuch-reply-test \
\r
509 - '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
\r
510 - '[body]="Multiple recipients"'
\r
512 -execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
513 -Subject: Re: notmuch-reply-test
\r
514 -To: Sender <sender@example.com>, Someone Else <someone@example.com>
\r
515 -Bcc: test_suite@notmuchmail.org
\r
516 -In-Reply-To: <${gen_msg_id}>
\r
517 -References: <${gen_msg_id}>
\r
519 -On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
520 -> Multiple recipients"
\r
522 -printf " Reply with CC...\t\t"
\r
523 -add_message '[from]="Sender <sender@example.com>"' \
\r
524 - [to]=test_suite@notmuchmail.org \
\r
525 - '[cc]="Other Parties <cc@example.com>"' \
\r
526 - [subject]=notmuch-reply-test \
\r
527 - '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
\r
528 - '[body]="reply with CC"'
\r
530 -execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
531 -Subject: Re: notmuch-reply-test
\r
532 -To: Sender <sender@example.com>
\r
533 -Cc: Other Parties <cc@example.com>
\r
534 -Bcc: test_suite@notmuchmail.org
\r
535 -In-Reply-To: <${gen_msg_id}>
\r
536 -References: <${gen_msg_id}>
\r
538 -On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
541 -printf " Reply from alternate address..."
\r
542 -add_message '[from]="Sender <sender@example.com>"' \
\r
543 - [to]=test_suite_other@notmuchmail.org \
\r
544 - [subject]=notmuch-reply-test \
\r
545 - '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
\r
546 - '[body]="reply from alternate address"'
\r
548 -execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
\r
549 -Subject: Re: notmuch-reply-test
\r
550 -To: Sender <sender@example.com>
\r
551 -Bcc: test_suite@notmuchmail.org
\r
552 -In-Reply-To: <${gen_msg_id}>
\r
553 -References: <${gen_msg_id}>
\r
555 -On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
556 -> reply from alternate address"
\r
558 -printf " Support for Reply-To...\t"
\r
559 -add_message '[from]="Sender <sender@example.com>"' \
\r
560 - [to]=test_suite@notmuchmail.org \
\r
561 - [subject]=notmuch-reply-test \
\r
562 - '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
\r
563 - '[body]="support for reply-to"' \
\r
564 - '[reply-to]="Sender <elsewhere@example.com>"'
\r
566 -execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
567 -Subject: Re: notmuch-reply-test
\r
568 -To: Sender <elsewhere@example.com>
\r
569 -Bcc: test_suite@notmuchmail.org
\r
570 -In-Reply-To: <${gen_msg_id}>
\r
571 -References: <${gen_msg_id}>
\r
573 -On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
574 -> support for reply-to"
\r
576 -printf " Un-munging Reply-To...\t\t"
\r
577 -add_message '[from]="Sender <sender@example.com>"' \
\r
578 - '[to]="Some List <list@example.com>"' \
\r
579 - [subject]=notmuch-reply-test \
\r
580 - '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
\r
581 - '[body]="Un-munging Reply-To"' \
\r
582 - '[reply-to]="Evil Munging List <list@example.com>"'
\r
584 -execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
585 -Subject: Re: notmuch-reply-test
\r
586 -To: Sender <sender@example.com>, Some List <list@example.com>
\r
587 -Bcc: test_suite@notmuchmail.org
\r
588 -In-Reply-To: <${gen_msg_id}>
\r
589 -References: <${gen_msg_id}>
\r
591 -On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
592 -> Un-munging Reply-To"
\r
594 -printf "\nTesting handling of uuencoded data:\n"
\r
596 -add_message [subject]=uuencodetest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
\r
597 -'[body]="This message is used to ensure that notmuch correctly handles a
\r
598 -message containing a block of uuencoded data. First, we have a marker
\r
599 -this content beforeuudata . Then we beging the uunencoded data itself:
\r
601 -begin 644 bogus-uuencoded-data
\r
602 -M0123456789012345678901234567890123456789012345678901234567890
\r
603 -MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUNECODED DATA.
\r
604 -MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA
\r
605 -MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE
\r
606 -MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY
\r
611 -Finally, we have our afteruudata marker as well."'
\r
613 -printf " Ensure content before uu data is indexed..."
\r
614 -execute_expecting "search beforeuudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
\r
615 -printf " Ensure uu data is not indexed...\t"
\r
616 -execute_expecting "search DURINGUUDATA" ""
\r
617 -printf " Ensure content after uu data is indexed..."
\r
618 -execute_expecting "search afteruudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
\r
620 -printf "\nTesting \"notmuch dump\" and \"notmuch restore\":\n"
\r
622 -printf " Dumping all tags...\t\t"
\r
623 -$NOTMUCH dump dump.expected
\r
626 -printf " Clearing all tags...\t\t"
\r
627 -sed -e 's/(\([^(]*\))$/()/' < dump.expected > clear.expected
\r
628 -$NOTMUCH restore clear.expected
\r
629 -$NOTMUCH dump clear.actual
\r
630 -if diff clear.expected clear.actual > /dev/null; then
\r
634 - echo " Expected output: See file clear.expected"
\r
635 - echo " Actual output: See file clear.actual"
\r
638 -printf " Restoring original tags...\t"
\r
639 -$NOTMUCH restore dump.expected
\r
640 -$NOTMUCH dump dump.actual
\r
641 -if diff dump.expected dump.actual > /dev/null; then
\r
645 - echo " Expected output: See file dump.expected"
\r
646 - echo " Actual output: See file dump.actual"
\r
649 -printf " Restore with nothing to do...\t"
\r
650 -$NOTMUCH restore dump.expected
\r
654 -Notmuch test suite complete.
\r
656 -Intermediate state can be examined in:
\r
659 diff --git a/test/t0000-basic.sh b/test/t0000-basic.sh
\r
660 index cc2ca21..be4932a 100755
\r
661 --- a/test/t0000-basic.sh
\r
662 +++ b/test/t0000-basic.sh
\r
667 # Copyright (c) 2005 Junio C Hamano
\r
669 diff --git a/test/t0001-new.sh b/test/t0001-new.sh
\r
670 new file mode 100755
\r
671 index 0000000..1fc030d
\r
673 +++ b/test/t0001-new.sh
\r
677 +test_description="Test \"notmuch new\" in several variations"
\r
681 +test_expect_success "No new messages" '
\r
682 +execute_expecting new "No new mail."
\r
684 +test_expect_success "Single new message" '
\r
685 +generate_message &&
\r
686 +execute_expecting new "Added 1 new message to the database."
\r
688 +test_expect_success "Multiple new messages" '
\r
689 +generate_message &&
\r
690 +generate_message &&
\r
691 +execute_expecting new "Added 2 new messages to the database."
\r
693 +test_expect_success "No new messages (non-empty DB)" '
\r
694 +execute_expecting new "No new mail."
\r
696 +test_expect_success "New directories" '
\r
697 +rm -rf "${MAIL_DIR}/"* "${MAIL_DIR}/.notmuch" &&
\r
698 +mkdir "${MAIL_DIR}/def" &&
\r
699 +mkdir "${MAIL_DIR}/ghi" &&
\r
700 +generate_message [dir]=def
\r
702 +execute_expecting new "Added 1 new message to the database."
\r
704 +test_expect_success "Alternate inode order" '
\r
706 +rm -rf "${MAIL_DIR}/.notmuch" &&
\r
707 +mv "${MAIL_DIR}/ghi" "${MAIL_DIR}/abc" &&
\r
708 +rm "${MAIL_DIR}/def/"* &&
\r
709 +generate_message [dir]=abc &&
\r
711 +execute_expecting new "Added 1 new message to the database."
\r
713 +test_expect_success "Message moved in" '
\r
714 +rm -rf "${MAIL_DIR}/"* "${MAIL_DIR}/.notmuch" &&
\r
715 +generate_message &&
\r
716 +tmp_msg_filename="tmp/$gen_msg_name" &&
\r
717 +mkdir -p "$(dirname "$tmp_msg_filename")" &&
\r
718 +mv "$gen_msg_filename" "$tmp_msg_filename" &&
\r
719 +increment_mtime "${MAIL_DIR}" &&
\r
720 +notmuch new > /dev/null &&
\r
721 +mv "$tmp_msg_filename" "$gen_msg_filename" &&
\r
722 +increment_mtime "${MAIL_DIR}" &&
\r
723 +execute_expecting new "Added 1 new message to the database."
\r
725 +test_expect_success "Renamed message" '
\r
727 +generate_message &&
\r
728 +notmuch new > /dev/null &&
\r
729 +mv "$gen_msg_filename" "${gen_msg_filename}-renamed" &&
\r
730 +increment_mtime "${MAIL_DIR}" &&
\r
731 +execute_expecting new "No new mail. Detected 1 file rename."
\r
733 +test_expect_success "Deleted message" '
\r
735 +rm "${gen_msg_filename}-renamed" &&
\r
736 +increment_mtime "${MAIL_DIR}" &&
\r
737 +execute_expecting new "No new mail. Removed 1 message."
\r
739 +test_expect_success "Renamed directory" '
\r
741 +generate_message [dir]=dir &&
\r
742 +generate_message [dir]=dir &&
\r
743 +generate_message [dir]=dir &&
\r
745 +notmuch new > /dev/null &&
\r
747 +mv "${MAIL_DIR}/dir" "${MAIL_DIR}/dir-renamed" &&
\r
748 +increment_mtime "${MAIL_DIR}" &&
\r
750 +execute_expecting new "No new mail. Detected 3 file renames."
\r
752 +test_expect_success "Deleted directory" '
\r
754 +rm -rf "${MAIL_DIR}/dir-renamed" &&
\r
755 +increment_mtime "${MAIL_DIR}" &&
\r
757 +execute_expecting new "No new mail. Removed 3 messages."
\r
759 +test_expect_success "New directory (at end of list)" '
\r
761 +generate_message [dir]=zzz &&
\r
762 +generate_message [dir]=zzz &&
\r
763 +generate_message [dir]=zzz &&
\r
765 +execute_expecting new "Added 3 new messages to the database."
\r
767 +test_expect_success "Deleted directory (end of list)" '
\r
769 +rm -rf "${MAIL_DIR}/zzz" &&
\r
770 +increment_mtime "${MAIL_DIR}" &&
\r
772 +execute_expecting new "No new mail. Removed 3 messages."
\r
774 +test_expect_success "New symlink to directory" '
\r
776 +rm -rf "${MAIL_DIR}/.notmuch" &&
\r
777 +mv "${MAIL_DIR}" "actual_maildir" &&
\r
779 +mkdir "${MAIL_DIR}" &&
\r
780 +ln -s "$PWD/actual_maildir" "${MAIL_DIR}/symlink" &&
\r
782 +execute_expecting new "Added 1 new message to the database."
\r
784 +test_expect_success "New symlink to a file" '
\r
785 +generate_message &&
\r
786 +external_msg_filename="$PWD/external/$(basename "$gen_msg_filename")" &&
\r
787 +mkdir -p "$(dirname "$external_msg_filename")" &&
\r
788 +mv "$gen_msg_filename" "$external_msg_filename" &&
\r
789 +ln -s "$external_msg_filename" "$gen_msg_filename" &&
\r
790 +increment_mtime "${MAIL_DIR}" &&
\r
791 +execute_expecting new "Added 1 new message to the database."
\r
793 +test_expect_success "New two-level directory" '
\r
795 +generate_message [dir]=two/levels &&
\r
796 +generate_message [dir]=two/levels &&
\r
797 +generate_message [dir]=two/levels &&
\r
799 +execute_expecting new "Added 3 new messages to the database."
\r
801 +test_expect_success "Deleted two-level directory" '
\r
803 +rm -rf "${MAIL_DIR}/two" &&
\r
804 +increment_mtime "${MAIL_DIR}" &&
\r
806 +execute_expecting new "No new mail. Removed 3 messages."
\r
810 diff --git a/test/t0002-search.sh b/test/t0002-search.sh
\r
811 new file mode 100755
\r
812 index 0000000..c8c24a0
\r
814 +++ b/test/t0002-search.sh
\r
818 +test_description="Testing \"notmuch search\" in several variations"
\r
822 +test_expect_success "Search body" '
\r
823 +add_message [subject]="\"body search\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [body]=bodysearchtest &&
\r
824 +execute_expecting "search bodysearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)"
\r
826 +test_expect_success "Search by from:" '
\r
827 +add_message [subject]="\"search by from\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [from]=searchbyfrom &&
\r
828 +execute_expecting "search from:searchbyfrom" "thread:XXX 2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)"
\r
830 +test_expect_success "Search by to:" '
\r
831 +add_message [subject]="\"search by to\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [to]=searchbyto &&
\r
832 +execute_expecting "search to:searchbyto" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)"
\r
834 +test_expect_success "Search by subject:" '
\r
835 +add_message [subject]=subjectsearchtest [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
\r
836 +execute_expecting "search subject:subjectsearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)"
\r
838 +test_expect_success "Search by id:" '
\r
839 +add_message [subject]="\"search by id\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
\r
840 +execute_expecting "search id:${gen_msg_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
\r
842 +test_expect_success "Search by tag:" '
\r
843 +add_message [subject]="\"search by tag\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
\r
844 +notmuch tag +searchbytag id:${gen_msg_id} &&
\r
845 +execute_expecting "search tag:searchbytag" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)"
\r
847 +test_expect_success "Search by thread:" '
\r
848 +add_message [subject]="\"search by thread\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
\r
849 +thread_id=$(notmuch search id:${gen_msg_id} | sed -e "s/thread:\([a-f0-9]*\).*/\1/") &&
\r
850 +execute_expecting "search thread:${thread_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)"
\r
852 +test_expect_success "Search body (phrase)" '
\r
853 +add_message [subject]="\"body search (phrase)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [body]="\"body search (phrase)\"" &&
\r
854 +execute_expecting "search \"body search (phrase)\"" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)"
\r
856 +test_expect_success "Search by from: (address)" '
\r
857 +add_message [subject]="\"search by from (address)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [from]=searchbyfrom@example.com &&
\r
858 +execute_expecting "search from:searchbyfrom@example.com" "thread:XXX 2000-01-01 [1/1] searchbyfrom@example.com; search by from (address) (inbox unread)"
\r
860 +test_expect_success "Search by from: (name)" '
\r
861 +add_message [subject]="\"search by from (name)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [from]="\"Search By From Name <test@example.com>\"" &&
\r
862 +execute_expecting "search from:\"Search By From Name\"" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
\r
864 +test_expect_success "Search by to: (address)" '
\r
865 +add_message [subject]="\"search by to (address)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [to]=searchbyto@example.com &&
\r
866 +execute_expecting "search to:searchbyto@example.com" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (address) (inbox unread)"
\r
868 +test_expect_success "Search by to: (name)" '
\r
869 +add_message [subject]="\"search by to (name)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [to]="\"Search By To Name <test@example.com>\"" &&
\r
870 +execute_expecting "search to:\"Search By To Name\"" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
\r
872 +test_expect_success "Search by subject: (phrase)" '
\r
873 +add_message [subject]="\"subject search test (phrase)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
\r
874 +execute_expecting "search subject:\"subject search test (phrase)\"" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread)"
\r
878 diff --git a/test/t0003-reply.sh b/test/t0003-reply.sh
\r
879 new file mode 100755
\r
880 index 0000000..a94c300
\r
882 +++ b/test/t0003-reply.sh
\r
886 +test_description="Testing \"notmuch reply\" in several variations"
\r
890 +test_expect_success "Basic reply" '
\r
891 +add_message [from]="\"Sender <sender@example.com>\"" \
\r
892 + [to]=test_suite@notmuchmail.org \
\r
893 + [subject]=notmuch-reply-test \
\r
894 + [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
\r
895 + [body]="\"basic reply test\"" &&
\r
897 +execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
898 +Subject: Re: notmuch-reply-test
\r
899 +To: Sender <sender@example.com>
\r
900 +Bcc: test_suite@notmuchmail.org
\r
901 +In-Reply-To: <${gen_msg_id}>
\r
902 +References: <${gen_msg_id}>
\r
904 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
905 +> basic reply test"
\r
907 +test_expect_success "Multiple recipients" '
\r
908 +add_message [from]="\"Sender <sender@example.com>\"" \
\r
909 + [to]="\"test_suite@notmuchmail.org, Someone Else <someone@example.com>\"" \
\r
910 + [subject]=notmuch-reply-test \
\r
911 + [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
\r
912 + [body]="\"Multiple recipients\"" &&
\r
914 +execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
915 +Subject: Re: notmuch-reply-test
\r
916 +To: Sender <sender@example.com>, Someone Else <someone@example.com>
\r
917 +Bcc: test_suite@notmuchmail.org
\r
918 +In-Reply-To: <${gen_msg_id}>
\r
919 +References: <${gen_msg_id}>
\r
921 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
922 +> Multiple recipients"
\r
924 +test_expect_success "Reply with CC" '
\r
925 +add_message [from]="\"Sender <sender@example.com>\"" \
\r
926 + [to]=test_suite@notmuchmail.org \
\r
927 + [cc]="\"Other Parties <cc@example.com>\"" \
\r
928 + [subject]=notmuch-reply-test \
\r
929 + [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
\r
930 + [body]="\"reply with CC\"" &&
\r
932 +execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
933 +Subject: Re: notmuch-reply-test
\r
934 +To: Sender <sender@example.com>
\r
935 +Cc: Other Parties <cc@example.com>
\r
936 +Bcc: test_suite@notmuchmail.org
\r
937 +In-Reply-To: <${gen_msg_id}>
\r
938 +References: <${gen_msg_id}>
\r
940 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
943 +test_expect_success "Reply from alternate address" '
\r
944 +add_message [from]="\"Sender <sender@example.com>\"" \
\r
945 + [to]=test_suite_other@notmuchmail.org \
\r
946 + [subject]=notmuch-reply-test \
\r
947 + [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
\r
948 + [body]="\"reply from alternate address\"" &&
\r
950 +execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
\r
951 +Subject: Re: notmuch-reply-test
\r
952 +To: Sender <sender@example.com>
\r
953 +Bcc: test_suite@notmuchmail.org
\r
954 +In-Reply-To: <${gen_msg_id}>
\r
955 +References: <${gen_msg_id}>
\r
957 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
958 +> reply from alternate address"
\r
960 +test_expect_success "Support for Reply-To" '
\r
961 +add_message [from]="\"Sender <sender@example.com>\"" \
\r
962 + [to]=test_suite@notmuchmail.org \
\r
963 + [subject]=notmuch-reply-test \
\r
964 + [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
\r
965 + [body]="\"support for reply-to\"" \
\r
966 + [reply-to]="\"Sender <elsewhere@example.com>\"" &&
\r
968 +execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
969 +Subject: Re: notmuch-reply-test
\r
970 +To: Sender <elsewhere@example.com>
\r
971 +Bcc: test_suite@notmuchmail.org
\r
972 +In-Reply-To: <${gen_msg_id}>
\r
973 +References: <${gen_msg_id}>
\r
975 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
976 +> support for reply-to"
\r
978 +test_expect_success "Un-munging Reply-To" '
\r
979 +add_message [from]="\"Sender <sender@example.com>\"" \
\r
980 + [to]="\"Some List <list@example.com>\"" \
\r
981 + [subject]=notmuch-reply-test \
\r
982 + [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
\r
983 + [body]="\"Un-munging Reply-To\"" \
\r
984 + [reply-to]="\"Evil Munging List <list@example.com>\"" &&
\r
986 +execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
987 +Subject: Re: notmuch-reply-test
\r
988 +To: Sender <sender@example.com>, Some List <list@example.com>
\r
989 +Bcc: test_suite@notmuchmail.org
\r
990 +In-Reply-To: <${gen_msg_id}>
\r
991 +References: <${gen_msg_id}>
\r
993 +On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
\r
994 +> Un-munging Reply-To"
\r
998 diff --git a/test/t0004-uuencoded-data.sh b/test/t0004-uuencoded-data.sh
\r
999 new file mode 100755
\r
1000 index 0000000..a461f4a
\r
1002 +++ b/test/t0004-uuencoded-data.sh
\r
1006 +test_description="Testing handling of uuencoded data"
\r
1010 +test_expect_success 'Generate message' '
\r
1011 +add_message [subject]=uuencodetest [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
\r
1012 +[body]="\"This message is used to ensure that notmuch correctly handles a
\r
1013 +message containing a block of uuencoded data. First, we have a marker
\r
1014 +this content beforeuudata . Then we beging the uunencoded data itself:
\r
1016 +begin 644 bogus-uuencoded-data
\r
1017 +M0123456789012345678901234567890123456789012345678901234567890
\r
1018 +MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUNECODED DATA.
\r
1019 +MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA
\r
1020 +MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE
\r
1021 +MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY
\r
1026 +Finally, we have our afteruudata marker as well.\""
\r
1028 +test_expect_success "Ensure content before uu data is indexed" '
\r
1029 +execute_expecting "search beforeuudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
\r
1031 +test_expect_success "Ensure uu data is not indexed" '
\r
1032 +execute_expecting "search DURINGUUDATA" ""
\r
1034 +test_expect_success "Ensure content after uu data is indexed" '
\r
1035 +execute_expecting "search afteruudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
\r
1039 diff --git a/test/t0005-dump-restore.sh b/test/t0005-dump-restore.sh
\r
1040 new file mode 100755
\r
1041 index 0000000..49df8ec
\r
1043 +++ b/test/t0005-dump-restore.sh
\r
1047 +test_description="Testing \"notmuch dump\" and \"notmuch restore\""
\r
1051 +test_expect_success "Generate some message" '
\r
1052 +generate_message &&
\r
1056 +test_expect_success "Dumping all tags" '
\r
1057 +notmuch dump dump.expected
\r
1059 +test_expect_success "Clearing all tags" '
\r
1060 +sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&
\r
1061 +notmuch restore clear.expected &&
\r
1062 +notmuch dump clear.actual &&
\r
1063 +if diff clear.expected clear.actual > /dev/null; then
\r
1067 + echo " Expected output: See file clear.expected"
\r
1068 + echo " Actual output: See file clear.actual"
\r
1072 +test_expect_success "Restoring original tags" '
\r
1073 +notmuch restore dump.expected &&
\r
1074 +notmuch dump dump.actual &&
\r
1075 +if diff dump.expected dump.actual > /dev/null; then
\r
1079 + echo " Expected output: See file dump.expected"
\r
1080 + echo " Actual output: See file dump.actual"
\r
1084 +test_expect_success "Restore with nothing to do" '
\r
1085 +notmuch restore dump.expected
\r