unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob a6dab99d20a1ea2cca73b69010b616734cb47926 2628 bytes (raw)
name: test/mbox 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
#!/usr/bin/env bash
#
# Copyright (c) 2005 Junio C Hamano
#

test_description='basic mbox support'
. ./test-lib.sh

mkdir -p $MAIL_DIR/some-mboxes/subdir $MAIL_DIR/database $MAIL_DIR/corpus

# The Content-Length headers here include the final newline (added later).
generate_message '[body]="Mbox message 1."' '[header]="Content-Length: 16"' "[dir]=corpus"
generate_message '[body]="Mbox message 2. Longer."' '[header]="Content-Length: 24"' "[dir]=corpus"
generate_message '[body]="Mbox message 3."' "[dir]=corpus"
generate_message '[body]="Mbox message 4."' "[dir]=corpus"
generate_message '[body]="Mbox message 5. Last message."' '[header]="Content-Length: 30"' "[dir]=corpus"

MBOX1=$MAIL_DIR/some-mboxes/first.mbox
declare -a starts lengths

for x in $MAIL_DIR/corpus/*; do
    echo "From MAILER-DAEMON Sat Jan  3 01:05:34 1996" >> $MBOX1
    starts+=(`wc -c $MBOX1 | cut -f 1 -d ' '`)
    cat $x >> $MBOX1
    lengths+=(`wc -c $x | cut -f 1 -d ' '`)
    # Final newline
    echo >> $MBOX1
done

notmuch config set database.path $MAIL_DIR/database
notmuch config set new.scan mbox://$MAIL_DIR/some-mboxes

test_begin_subtest "read a small mbox (5 messages)"
output=$(NOTMUCH_NEW)
test_expect_equal "$output" "Added 5 new messages to the database."

test_begin_subtest "search"
output=$(notmuch search '*' | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #2 (inbox unread)
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #3 (inbox unread)
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #4 (inbox unread)
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #5 (inbox unread)"

test_begin_subtest "show (mboxcl)"
output=$(notmuch show "Test message #1" | grep -o "filename:[^ ]*")
test_expect_equal "$output" "filename:mbox://$MAIL_DIR/some-mboxes/first.mbox#${starts[0]}+${lengths[0]}"

test_begin_subtest "show doesn't append an extra space at the end (mboxcl)"
output=$(notmuch show --format=raw "Test message #1" )
original=$(cat $MAIL_DIR/corpus/msg-001)
test_expect_equal "$output" "$original"

test_begin_subtest "show (non-cl)"
output=$(notmuch show "Test message #3" | grep -o "filename:[^ ]*")
test_expect_equal "$output" "filename:mbox://$MAIL_DIR/some-mboxes/first.mbox#${starts[2]}+${lengths[2]}"

test_begin_subtest "show doesn't append an extra space at the end (non-cl)"
output=$(notmuch show --format=raw "Test message #3" )
original=$(cat $MAIL_DIR/corpus/msg-003)
test_expect_equal "$output" "$original"

test_done

debug log:

solving a6dab99 ...
found a6dab99 in https://yhetil.org/notmuch/1341160790-14525-8-git-send-email-ethan@betacantrips.com/

applying [1/1] https://yhetil.org/notmuch/1341160790-14525-8-git-send-email-ethan@betacantrips.com/
diff --git a/test/mbox b/test/mbox
new file mode 100755
index 0000000..a6dab99

Checking patch test/mbox...
Applied patch test/mbox cleanly.

index at:
100755 a6dab99d20a1ea2cca73b69010b616734cb47926	test/mbox

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).