]>
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\n' >>"$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 # check that text is quoted-printable encoded due to long text line
78 # This tests the setting of reply_ct->c_reqencoding and
79 # (*text_plain_ct)->c_reqencoding in expand_pseudoheader().
80 start_test
"encode text as quoted-printable due to long text line"
81 cat >"$expected" <<'EOF'
82 From: recipient@example.com
83 To: sender@example.com
87 Comments: In-reply-to sender@example.com
88 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
90 Content-Type: text/plain; charset="US-ASCII"
91 Content-Transfer-Encoding: quoted-printable
93 sender@example.com writes:
95 > This is a very, very, very, very, very, very, very, very, very, very, ve=
99 cat >`mhpath new` <<'EOF'
100 From: sender@example.com
101 To: recipient@example.com
103 Date: Thu, 11 Dec 2014 08:19:02 -0600
104 Content-Type: multipart/mixed; boundary="_001_"
108 Content-Type: text/plain
110 This is a very, very, very, very, very, very, very, very, very, very, very, long line.
115 #### Just prefix the text with "> ".
116 cp "${MH}" "${MH}.new"
117 cat >>"${MH}.new" <<EOF
118 mhbuild-convert-text: sed 's/^\(.\)/> \1/; s/^$/>/;' <%F
120 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' \
122 MH
="${MH}.new" mhbuild
"$actual"
124 check
"$actual" "$expected"
127 #### Make sure that this works with 8-bit encoding.
129 require_locale en_US.UTF
-8 en_US.UTF8 en_US.utf
-8 en_US.utf8
132 # check -convertarg with multiple parts, 7 bit
133 start_test
'-convertarg with multiple parts, 7 bit'
134 cat >"$expected" <<'EOF'
135 From: recipient@example.com
136 To: sender@example.com
140 Comments: In-reply-to sender@example.com
141 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
143 Content-Type: text/plain; charset="UTF-8"
145 sender@example.com writes:
152 cat >`mhpath new` <<'EOF'
153 From: sender@example.com
154 To: recipient@example.com
156 Date: Thu, 11 Dec 2014 08:19:02 -0600
157 Content-Type: multipart/mixed; boundary="_001_"
161 Content-Type: text/plain
166 Content-Type: text/plain; charset="UTF-8"
173 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
175 check
"$actual" "$expected"
178 # check -convertarg with multiple parts, 8 bit
179 start_test
'-convertarg with multiple parts, 8 bit'
180 cat >"$expected" <<'EOF'
181 From: recipient@example.com
182 To: sender@example.com
186 Comments: In-reply-to sender@example.com
187 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
189 Content-Type: text/plain; charset="UTF-8"
190 Content-Transfer-Encoding: 8bit
192 sender@example.com writes:
196 > This is §2, with a non-ASCII character.
199 cat >`mhpath new` <<'EOF'
200 From: sender@example.com
201 To: recipient@example.com
203 Date: Thu, 11 Dec 2014 08:19:02 -0600
204 Content-Type: multipart/mixed; boundary="_001_"
208 Content-Type: text/plain
213 Content-Type: text/plain; charset="UTF-8"
215 This is §2, with a non-ASCII character.
220 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
222 check
"$actual" "$expected"
225 # check message with text part in multipart/related
226 start_test
'check message with text part in multipart/related'
227 cat >"$expected" <<'EOF'
228 From: recipient@example.com
229 To: sender@example.com
232 Subject: Re: test with text part in multipart/related
233 Comments: In-reply-to sender@example.com
236 Content-Type: text/plain; charset="UTF-8"
238 sender@example.com writes:
243 cat >`mhpath new` <<'EOF'
244 From: sender@example.com
245 To: recipient@example.com
246 Subject: test with text part in multipart/related
247 Content-Type: multipart/alternative; boundary="_001_"
251 Content-Type: multipart/related; type="text/plain"; boundary="_002_"
254 Content-Type: text/plain; charset="UTF-8"
263 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
265 check
"$actual" "$expected"
268 # check reply to calendar request
269 start_test
'check reply to calendar request'
270 cat >"$expected" <<'EOF'
271 From: recipient@example.com
272 To: sender@example.com
275 Subject: Re: test iCalendar reply
276 Comments: In-reply-to sender@example.com
279 Content-Type: text/calendar; method="REPLY"; charset="UTF-8"
283 PRODID:nmh mhical v0.1
286 TZID:Eastern Standard Time
288 DTSTART:16010101T020000
291 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
294 DTSTART:16010101T020000
297 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
301 ORGANIZER;CN=Requester:MAILTO:requester@example.com
302 ATTENDEE;PARTSTAT=ACCEPTED;CN=Recip:MAILTO:recipient@example.com
303 SUMMARY;LANGUAGE=en-US:Accepted: test request
304 DTSTART;TZID=Eastern Standard Time:20150105T090000
305 DTEND;TZID=Eastern Standard Time:20150105T093000
312 LOCATION;LANGUAGE=en-US:
317 cat >`mhpath new` <<'EOF'
318 From: sender@example.com
319 To: recipient@example.com
320 Subject: test iCalendar reply
321 Content-Type: text/calendar; charset="UTF-8"
329 TZID:Eastern Standard Time
331 DTSTART:16010101T020000
334 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
337 DTSTART:16010101T020000
340 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
344 ORGANIZER;CN=Requester:MAILTO:requester@example.com
345 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
346 :MAILTO:requestee1@example.com
347 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
348 :MAILTO:requestee2@example.com
349 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
350 :MAILTO:requestee3@example.com
351 SUMMARY;LANGUAGE=en-US:test request
352 DTSTART;TZID=Eastern Standard Time:20150105T090000
353 DTEND;TZID=Eastern Standard Time:20150105T093000
357 DTSTAMP:20150101T171600Z
361 LOCATION;LANGUAGE=en-US:
365 TRIGGER;RELATED=START:-PT15M
371 actual
="$MH_TEST_DIR/test-convert$$.actual"
373 -convertargs text
/calendar
'-reply accept -contenttype' -nowhatnowproc last
374 SIGNATURE
=Recip mhbuild
- <`mhpath +`/draft
| egrep -v '^DTSTAMP:' >"$actual"
375 check
"$actual" "$expected"