]> git.notmuchmail.org Git - notmuch/blob - test/emacs-show
test: Test buttonization of id: links
[notmuch] / test / emacs-show
1 #!/usr/bin/env bash
2
3 test_description="emacs notmuch-show view"
4 . test-lib.sh
5
6 EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
7
8 add_email_corpus
9
10 test_begin_subtest "Hiding Original Message region at beginning of a message"
11 message_id='OriginalMessageHiding.1@notmuchmail.org'
12 add_message \
13     [id]="$message_id" \
14     '[subject]="Hiding Original Message region at beginning of a message"' \
15     '[body]="-----Original Message-----
16 Text here."'
17
18 cat <<EOF >EXPECTED
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>
22 Date: Fri, 05 Jan 2001 15:43:57 +0000
23
24 [ 2-line hidden original message. Click/Enter to show. ]
25 EOF
26
27 test_emacs "(notmuch-show \"id:$message_id\")
28             (test-visible-output)"
29 test_expect_equal_file OUTPUT EXPECTED
30
31 test_begin_subtest "Bare subject #1"
32 output=$(test_emacs '(notmuch-show-strip-re "Re: subject")')
33 test_expect_equal "$output" '"subject"'
34
35 test_begin_subtest "Bare subject #2"
36 output=$(test_emacs '(notmuch-show-strip-re "re:Re: re:  Re:  re:subject")')
37 test_expect_equal "$output" '"subject"'
38
39 test_begin_subtest "Bare subject #3"
40 output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
41 test_expect_equal "$output" '"the cure: fix the regexp"'
42
43 test_begin_subtest "don't process cryptographic MIME parts"
44 test_emacs '(let ((notmuch-crypto-process-mime nil))
45         (notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
46         (test-visible-output))'
47 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-off
48
49 test_begin_subtest "process cryptographic MIME parts"
50 test_emacs '(let ((notmuch-crypto-process-mime t))
51         (notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
52         (test-visible-output))'
53 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
54
55 test_begin_subtest "process cryptographic MIME parts (w/ notmuch-show-toggle-process-crypto)"
56 test_emacs '(let ((notmuch-crypto-process-mime nil))
57         (notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
58         (notmuch-show-toggle-process-crypto)
59         (test-visible-output))'
60 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
61
62 test_begin_subtest "notmuch-show: don't elide non-matching messages"
63 test_emacs '(let ((notmuch-show-only-matching-messages nil))
64         (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
65         (notmuch-test-wait)
66         (notmuch-search-show-thread)
67         (notmuch-test-wait)
68         (test-visible-output))'
69 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-off
70
71 test_begin_subtest "notmuch-show: elide non-matching messages"
72 test_emacs '(let ((notmuch-show-only-matching-messages t))
73         (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
74         (notmuch-test-wait)
75         (notmuch-search-show-thread)
76         (notmuch-test-wait)
77         (test-visible-output))'
78 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
79
80 test_begin_subtest "notmuch-show: elide non-matching messages (w/ notmuch-show-toggle-elide-non-matching)"
81 test_emacs '(let ((notmuch-show-only-matching-messages nil))
82         (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
83         (notmuch-test-wait)
84         (notmuch-search-show-thread)
85         (notmuch-test-wait)
86         (notmuch-show-toggle-elide-non-matching)
87         (test-visible-output))'
88 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
89
90 test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to notmuch-show)"
91 test_emacs '(let ((notmuch-show-only-matching-messages nil))
92         (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
93         (notmuch-test-wait)
94         (let ((current-prefix-arg t))
95           (notmuch-search-show-thread))
96         (notmuch-test-wait)
97         (test-visible-output))'
98 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
99
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\"")
102         (notmuch-test-wait)
103         (notmuch-search-show-thread)
104         (notmuch-test-wait)
105         (notmuch-show-toggle-thread-indentation)
106         (test-visible-output)'
107 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off
108
109 test_begin_subtest "id buttonization"
110 add_message '[body]="
111 id:abc
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]
115 id:foo@bar.baz...
116 id:2+2=5
117 id:=_-:/.[]@$%+
118 id:abc)def
119 id:ab\"c def
120 id:\"abc\"def
121 id:\"ab\"\"c\"def
122 id:\"ab c\"def
123 id:\"abc\".def
124 id:\"abc
125 \"
126 id:)
127 id:
128 cid:xxx"'
129 test_emacs '(notmuch-show "id:'$gen_msg_id'")
130         (notmuch-test-mark-links)
131         (test-visible-output)'
132 cat <<EOF >EXPECTED
133 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
134 Subject: id buttonization
135 To: Notmuch Test Suite <test_suite@notmuchmail.org>
136 Date: Fri, 05 Jan 2001 15:43:57 +0000
137
138 <<id:abc>>
139 <<id:abc.def.>> <<id:abc,def,>> <<id:abc;def;>> <<id:abc:def:>>
140 <<id:foo@bar.?baz?>> <<id:foo@bar!.baz!>>
141 (<<id:foo@bar.baz)>> [<<id:foo@bar.baz]>>
142 <<id:foo@bar.baz...>>
143 <<id:2+2=5>>
144 <<id:=_-:/.[]@$%+>>
145 <<id:abc)def>>
146 <<id:ab>>"c def
147 <<id:"abc">>def
148 <<id:"ab">>"c"def
149 id:"ab c"def
150 <<id:"abc">>.def
151 id:"abc
152 "
153 <<id:)>>
154 id:
155 c<<id:xxx>>
156 EOF
157 test_expect_equal_file OUTPUT EXPECTED
158
159
160 test_done