unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob ee78e66439a01fc907876b838e562bc66ee17cce 2096 bytes (raw)
name: test/T210-raw.sh 	 # 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
 
#!/usr/bin/env bash

test_description='notmuch show --format=raw'
. $(dirname "$0")/test-lib.sh || exit 1

add_message
add_message

test_begin_subtest "Attempt to show multiple raw messages"
output=$(notmuch show --format=raw "*" 2>&1)
test_expect_equal "$output" "Error: search term did not match precisely one message (matched 2 messages)."

test_begin_subtest "Show a raw message"
output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite | notmuch_date_sanitize)
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
Message-Id: <msg-001@notmuch-test-suite>
Subject: Test message #1
Date: GENERATED_DATE

This is just a test message (#1)"

test_begin_subtest "Show another raw message"
output=$(notmuch show --format=raw id:msg-002@notmuch-test-suite | notmuch_date_sanitize)
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
Message-Id: <msg-002@notmuch-test-suite>
Subject: Test message #2
Date: GENERATED_DATE

This is just a test message (#2)"

test_begin_subtest "generating 4096 byte message"
line=$(seq 1 72 | sed 's/.*/./' | tr -d '\n')
for i in $(seq 1 53); do
    printf "%s\n" "$line" >> BODY
done
# The last newline is added by add_message
printf "01234567890123456789012345" >> BODY
add_message '[subject]="4096"' '[body]="$(cat BODY)"'
output="$((`wc -c < $gen_msg_filename`))"
test_expect_equal 4096 "$output"

test_begin_subtest "Show a raw message exactly 4096 bytes: no error"
test_expect_success "notmuch show --format=raw subject:4096 1>/dev/null"

test_begin_subtest "Show a raw message exactly 4096 bytes: correct output"
notmuch show --format=raw subject:4096 | notmuch_date_sanitize > OUTPUT
cat <<EOF > EXPECTED
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
Message-Id: <msg-003@notmuch-test-suite>
Subject: 4096
Date: GENERATED_DATE

EOF
cat BODY >> EXPECTED
printf "\n" >> EXPECTED
test_expect_equal_file EXPECTED OUTPUT

test_done

debug log:

solving ee78e664 ...
found ee78e664 in https://yhetil.org/notmuch/20190428162906.20062-3-david@tethera.net/
found e1dd6064 in https://yhetil.org/notmuch/20190428162906.20062-2-david@tethera.net/
found 99fdef72 in https://yhetil.org/notmuch.git/
preparing index
index prepared:
100755 99fdef72e634fad35e91801e2f292a749c615c76	test/T210-raw.sh

applying [1/2] https://yhetil.org/notmuch/20190428162906.20062-2-david@tethera.net/
diff --git a/test/T210-raw.sh b/test/T210-raw.sh
index 99fdef72..e1dd6064 100755


applying [2/2] https://yhetil.org/notmuch/20190428162906.20062-3-david@tethera.net/
diff --git a/test/T210-raw.sh b/test/T210-raw.sh
index e1dd6064..ee78e664 100755

Checking patch test/T210-raw.sh...
Applied patch test/T210-raw.sh cleanly.
Checking patch test/T210-raw.sh...
Applied patch test/T210-raw.sh cleanly.

index at:
100755 ee78e66439a01fc907876b838e562bc66ee17cce	test/T210-raw.sh

(*) 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).