]>
diplodocus.org Git - nmh/blob - test/repl/test-convert
2 ######################################################
4 # Test repl -convertarg
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"${srcdir}/test/post/test-post-common.sh"
17 expected
="$MH_TEST_DIR/test-convert$$.expected"
18 actual
=`mhpath +`/draft
20 printf 'Local-Mailbox: recipient@example.com' >>"$MH"
23 #### Make sure that this works with 7-bit encoding.
24 LC_ALL
=C
; export LC_ALL
27 # check -convertarg with multiple parts and additional text in draft
28 start_test
'-convertarg with multiple parts and additional text in draft'
29 cat >"$expected" <<'EOF'
30 From: recipient@example.com
31 To: sender@example.com
35 Comments: In-reply-to sender@example.com
36 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
38 Content-Type: text/plain; charset="US-ASCII"
45 cat >`mhpath new` <<'EOF'
46 From: sender@example.com
47 To: recipient@example.com
49 Date: Thu, 11 Dec 2014 08:19:02 -0600
50 Content-Type: multipart/mixed; boundary="_001_"
54 Content-Type: text/plain
59 Content-Type: text/plain
64 Content-Type: text/enriched
66 This should not appear in the reply
67 because the content type isn't matched.
72 repl
-noformat -convertarg text
/plain
'' -nowhatnowproc last
74 check
"$actual" "$expected"
77 #### Make sure that this works with 8-bit encoding.
79 require_locale en_US.utf
-8 en_US.utf8
80 LC_ALL
=en_US.UTF
-8; export LC_ALL
83 # check -convertarg with multiple parts, 7 bit
84 start_test
'-convertarg with multiple parts, 7 bit'
85 cat >"$expected" <<'EOF'
86 From: recipient@example.com
87 To: sender@example.com
91 Comments: In-reply-to sender@example.com
92 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
94 Content-Type: text/plain; charset="UTF-8"
96 sender@example.com writes:
103 cat >`mhpath new` <<'EOF'
104 From: sender@example.com
105 To: recipient@example.com
107 Date: Thu, 11 Dec 2014 08:19:02 -0600
108 Content-Type: multipart/mixed; boundary="_001_"
112 Content-Type: text/plain
117 Content-Type: text/plain; charset="UTF-8"
124 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
126 check
"$actual" "$expected"
129 # check -convertarg with multiple parts, 8 bit
130 start_test
'-convertarg with multiple parts, 8 bit'
131 cat >"$expected" <<'EOF'
132 From: recipient@example.com
133 To: sender@example.com
137 Comments: In-reply-to sender@example.com
138 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
140 Content-Type: text/plain; charset="UTF-8"
141 Content-Transfer-Encoding: 8bit
143 sender@example.com writes:
147 > This is §2, with a non-ASCII character.
150 cat >`mhpath new` <<'EOF'
151 From: sender@example.com
152 To: recipient@example.com
154 Date: Thu, 11 Dec 2014 08:19:02 -0600
155 Content-Type: multipart/mixed; boundary="_001_"
159 Content-Type: text/plain
164 Content-Type: text/plain; charset="UTF-8"
166 This is §2, with a non-ASCII character.
171 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
173 check
"$actual" "$expected"
176 # check message with text part in multipart/related
177 start_test
'check message with text part in multipart/related'
178 cat >"$expected" <<'EOF'
179 From: recipient@example.com
180 To: sender@example.com
183 Subject: Re: test with text part in multipart/related
184 Comments: In-reply-to sender@example.com
187 Content-Type: text/plain; charset="UTF-8"
189 sender@example.com writes:
194 cat >`mhpath new` <<'EOF'
195 From: sender@example.com
196 To: recipient@example.com
197 Subject: test with text part in multipart/related
198 Content-Type: multipart/alternative; boundary="_001_"
202 Content-Type: multipart/related; type="text/plain"; boundary="_002_"
205 Content-Type: text/plain; charset="UTF-8"
214 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
216 check
"$actual" "$expected"
219 # check reply to calendar request
220 start_test
'check reply to calendar request'
221 cat >"$expected" <<'EOF'
222 From: recipient@example.com
223 To: sender@example.com
226 Subject: Re: test iCalendar reply
227 Comments: In-reply-to sender@example.com
230 Content-Type: text/calendar; method="REPLY"; charset="UTF-8"
234 PRODID:nmh mhical v0.1
237 TZID:Eastern Standard Time
239 DTSTART:16010101T020000
242 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
245 DTSTART:16010101T020000
248 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
252 ORGANIZER;CN=Requester:MAILTO:requester@example.com
253 ATTENDEE;PARTSTAT=ACCEPTED;CN=Recip:MAILTO:recipient@example.com
254 SUMMARY;LANGUAGE=en-US:Accepted: test request
255 DTSTART;TZID=Eastern Standard Time:20150105T090000
256 DTEND;TZID=Eastern Standard Time:20150105T093000
263 LOCATION;LANGUAGE=en-US:
268 cat >`mhpath new` <<'EOF'
269 From: sender@example.com
270 To: recipient@example.com
271 Subject: test iCalendar reply
272 Content-Type: text/calendar; charset="UTF-8"
280 TZID:Eastern Standard Time
282 DTSTART:16010101T020000
285 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
288 DTSTART:16010101T020000
291 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
295 ORGANIZER;CN=Requester:MAILTO:requester@example.com
296 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
297 :MAILTO:requestee1@example.com
298 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
299 :MAILTO:requestee2@example.com
300 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
301 :MAILTO:requestee3@example.com
302 SUMMARY;LANGUAGE=en-US:test request
303 DTSTART;TZID=Eastern Standard Time:20150105T090000
304 DTEND;TZID=Eastern Standard Time:20150105T093000
308 DTSTAMP:20150101T171600Z
312 LOCATION;LANGUAGE=en-US:
316 TRIGGER;RELATED=START:-PT15M
322 actual
="$MH_TEST_DIR/test-convert$$.actual"
324 -convertargs text
/calendar
'-reply accept -contenttype' -nowhatnowproc last
325 SIGNATURE
=Recip mhbuild
- <`mhpath +`/draft
| egrep -v '^DTSTAMP:' >"$actual"
326 check
"$actual" "$expected"