3 test_description='notmuch show --format=raw'
4 . $(dirname "$0")/test-lib.sh || exit 1
9 test_begin_subtest "Attempt to show multiple raw messages"
10 output=$(notmuch show --format=raw "*" 2>&1)
11 test_expect_equal "$output" "Error: search term did not match precisely one message (matched 2 messages)."
13 test_begin_subtest "Show a raw message"
14 output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite | notmuch_date_sanitize)
15 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
16 To: Notmuch Test Suite <test_suite@notmuchmail.org>
17 Message-Id: <msg-001@notmuch-test-suite>
18 Subject: Test message #1
21 This is just a test message (#1)"
23 test_begin_subtest "Show another raw message"
24 output=$(notmuch show --format=raw id:msg-002@notmuch-test-suite | notmuch_date_sanitize)
25 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
26 To: Notmuch Test Suite <test_suite@notmuchmail.org>
27 Message-Id: <msg-002@notmuch-test-suite>
28 Subject: Test message #2
31 This is just a test message (#2)"
34 from email.message import EmailMessage
35 for pow in range(10,21):
38 msg['Subject'] = 'message with {:07d} bytes'.format(size)
39 msg['From'] = 'Notmuch Test Suite <test_suite@notmuchmail.org>'
40 msg['To'] = msg['From']
41 msg['Message-Id'] = 'size-{:07d}@notmuch-test-suite'.format(size)
44 padding = size - len(bytes(msg))
47 line = '.' * min(padding, 72)
49 padding = padding - len(line) - 1
50 content ='\n'.join(lines)
51 msg.set_content(content)
52 with open('mail/size-{:07d}'.format(size), 'wb') as f:
58 for pow in {10..20}; do
59 printf -v size "%07d" $((2**$pow))
60 test_begin_subtest "content, message of size $size"
61 notmuch show --format=raw subject:$size > OUTPUT
62 test_expect_equal_file mail/size-$size OUTPUT
63 test_begin_subtest "return value, message of size $size"
64 test_expect_success "notmuch show --format=raw subject:$size > /dev/null"