3 test_description="emacs notmuch-show view"
4 . ./test-lib.sh || exit 1
6 EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
10 test_begin_subtest "Hiding Original Message region at beginning of a message"
11 message_id='OriginalMessageHiding.1@notmuchmail.org'
14 '[subject]="Hiding Original Message region at beginning of a message"' \
15 '[body]="-----Original Message-----
19 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
20 Subject: Hiding Original Message region at beginning of a message
21 To: Notmuch Test Suite <test_suite@notmuchmail.org>
24 [ 2-line hidden original message. Click/Enter to show. ]
27 test_emacs "(notmuch-show \"id:$message_id\")
28 (test-visible-output \"OUTPUT.raw\")"
29 notmuch_date_sanitize < OUTPUT.raw > OUTPUT
30 test_expect_equal_file OUTPUT EXPECTED
32 test_begin_subtest "Bare subject #1"
33 output=$(test_emacs '(notmuch-show-strip-re "Re: subject")')
34 test_expect_equal "$output" '"subject"'
36 test_begin_subtest "Bare subject #2"
37 output=$(test_emacs '(notmuch-show-strip-re "re:Re: re: Re: re:subject")')
38 test_expect_equal "$output" '"subject"'
40 test_begin_subtest "Bare subject #3"
41 output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
42 test_expect_equal "$output" '"the cure: fix the regexp"'
44 test_begin_subtest "don't process cryptographic MIME parts"
45 test_emacs '(let ((notmuch-crypto-process-mime nil))
46 (notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
47 (test-visible-output))'
48 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-off
50 test_begin_subtest "process cryptographic MIME parts"
51 test_emacs '(let ((notmuch-crypto-process-mime t))
52 (notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
53 (test-visible-output))'
54 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
56 test_begin_subtest "process cryptographic MIME parts (w/ notmuch-show-toggle-process-crypto)"
57 test_emacs '(let ((notmuch-crypto-process-mime nil))
58 (notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
59 (notmuch-show-toggle-process-crypto)
60 (test-visible-output))'
61 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
63 test_begin_subtest "notmuch-show: don't elide non-matching messages"
64 test_emacs '(let ((notmuch-show-only-matching-messages nil))
65 (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
67 (notmuch-search-show-thread)
69 (test-visible-output))'
70 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-off
72 test_begin_subtest "notmuch-show: elide non-matching messages"
73 test_emacs '(let ((notmuch-show-only-matching-messages t))
74 (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
76 (notmuch-search-show-thread)
78 (test-visible-output))'
79 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
81 test_begin_subtest "notmuch-show: elide non-matching messages (w/ notmuch-show-toggle-elide-non-matching)"
82 test_emacs '(let ((notmuch-show-only-matching-messages nil))
83 (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
85 (notmuch-search-show-thread)
87 (notmuch-show-toggle-elide-non-matching)
88 (test-visible-output))'
89 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
91 test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to notmuch-show)"
92 test_emacs '(let ((notmuch-show-only-matching-messages nil))
93 (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
95 (notmuch-search-show-thread t)
97 (test-visible-output))'
98 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
100 test_begin_subtest "notmuch-show: disable indentation of thread content (w/ notmuch-show-toggle-thread-indentation)"
101 test_emacs '(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
103 (notmuch-search-show-thread)
105 (notmuch-show-toggle-thread-indentation)
106 (test-visible-output)'
107 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off
109 test_begin_subtest "id buttonization"
110 add_message '[body]="
112 id:abc.def. id:abc,def, id:abc;def; id:abc:def:
113 id:foo@bar.?baz? id:foo@bar!.baz!
114 (id:foo@bar.baz) [id:foo@bar.baz]
131 mid:abc. mid:abc, mid:abc;"'
132 test_emacs '(notmuch-show "id:'$gen_msg_id'")
133 (notmuch-test-mark-links)
134 (test-visible-output "OUTPUT.raw")'
136 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
137 Subject: id buttonization
138 To: Notmuch Test Suite <test_suite@notmuchmail.org>
142 <<id:abc.def>>. <<id:abc,def>>, <<id:abc;def>>; <<id:abc:def>>:
143 <<id:foo@bar.?baz>>? <<id:foo@bar!.baz>>!
144 (<<id:foo@bar.baz>>) [<<id:foo@bar.baz>>]
145 <<id:foo@bar.baz>>...
159 <<mid:abc>> <<mid:abc/def>>
161 <<mid:abc>>. <<mid:abc>>, <<mid:abc>>;
163 notmuch_date_sanitize < OUTPUT.raw > OUTPUT
164 test_expect_equal_file OUTPUT EXPECTED
167 test_begin_subtest "Show handles subprocess errors"
168 cat > notmuch_fail <<EOF
171 echo This is an error >&2
174 chmod a+x notmuch_fail
175 test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
176 (with-current-buffer \"*Messages*\"
177 (let ((inhibit-read-only t)) (erase-buffer)))
180 (error (message \"%s\" (second err))))
182 (with-current-buffer \"*Messages*\"
183 (test-output \"MESSAGES\"))
184 (with-current-buffer \"*Notmuch errors*\"
185 (test-output \"ERROR\"))
187 test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES ERROR)" "\
190 This is an error (see *Notmuch errors* for more details)
194 command: YYY/notmuch_fail show --format\\=sexp --format-version\\=1 --exclude\\=false \\' \\* \\'