]>
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 not quoted-printable encoded
78 # This tests the setting of reply_ct->c_reqencoding and
79 # (*text_plain_ct)->c_reqencoding in expand_pseudoheader().
80 start_test
"don't encode text as quoted-printable"
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"
92 sender@example.com writes:
94 > This is a very, very, very, very, very, very, very, very, very, very, very, long line.
97 cat >`mhpath new` <<'EOF'
98 From: sender@example.com
99 To: recipient@example.com
101 Date: Thu, 11 Dec 2014 08:19:02 -0600
102 Content-Type: multipart/mixed; boundary="_001_"
106 Content-Type: text/plain
108 This is a very, very, very, very, very, very, very, very, very, very, very, long line.
113 #### Just prefix the text with "> ".
114 cp "${MH}" "${MH}.new"
115 cat >>"${MH}.new" <<EOF
116 mhbuild-convert-text: sed 's/^\(.\)/> \1/; s/^$/>/;' <%F
118 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' \
120 MH
="${MH}.new" mhbuild
"$actual"
122 check
"$actual" "$expected"
125 #### Make sure that this works with 8-bit encoding.
127 require_locale en_US.UTF
-8 en_US.UTF8 en_US.utf
-8 en_US.utf8
130 # check -convertarg with multiple parts, 7 bit
131 start_test
'-convertarg with multiple parts, 7 bit'
132 cat >"$expected" <<'EOF'
133 From: recipient@example.com
134 To: sender@example.com
138 Comments: In-reply-to sender@example.com
139 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
141 Content-Type: text/plain; charset="UTF-8"
143 sender@example.com writes:
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"
171 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
173 check
"$actual" "$expected"
176 # check -convertarg with multiple parts, 8 bit
177 start_test
'-convertarg with multiple parts, 8 bit'
178 cat >"$expected" <<'EOF'
179 From: recipient@example.com
180 To: sender@example.com
184 Comments: In-reply-to sender@example.com
185 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
187 Content-Type: text/plain; charset="UTF-8"
188 Content-Transfer-Encoding: 8bit
190 sender@example.com writes:
194 > This is §2, with a non-ASCII character.
197 cat >`mhpath new` <<'EOF'
198 From: sender@example.com
199 To: recipient@example.com
201 Date: Thu, 11 Dec 2014 08:19:02 -0600
202 Content-Type: multipart/mixed; boundary="_001_"
206 Content-Type: text/plain
211 Content-Type: text/plain; charset="UTF-8"
213 This is §2, with a non-ASCII character.
218 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
220 check
"$actual" "$expected"
223 # check message with text part in multipart/related
224 start_test
'check message with text part in multipart/related'
225 cat >"$expected" <<'EOF'
226 From: recipient@example.com
227 To: sender@example.com
230 Subject: Re: test with text part in multipart/related
231 Comments: In-reply-to sender@example.com
234 Content-Type: text/plain; charset="UTF-8"
236 sender@example.com writes:
241 cat >`mhpath new` <<'EOF'
242 From: sender@example.com
243 To: recipient@example.com
244 Subject: test with text part in multipart/related
245 Content-Type: multipart/alternative; boundary="_001_"
249 Content-Type: multipart/related; type="text/plain"; boundary="_002_"
252 Content-Type: text/plain; charset="UTF-8"
261 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
263 check
"$actual" "$expected"
266 # check reply to calendar request
267 start_test
'check reply to calendar request'
268 cat >"$expected" <<'EOF'
269 From: recipient@example.com
270 To: sender@example.com
273 Subject: Re: test iCalendar reply
274 Comments: In-reply-to sender@example.com
277 Content-Type: text/calendar; method="REPLY"; charset="UTF-8"
281 PRODID:nmh mhical v0.1
284 TZID:Eastern Standard Time
286 DTSTART:16010101T020000
289 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
292 DTSTART:16010101T020000
295 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
299 ORGANIZER;CN=Requester:MAILTO:requester@example.com
300 ATTENDEE;PARTSTAT=ACCEPTED;CN=Recip:MAILTO:recipient@example.com
301 SUMMARY;LANGUAGE=en-US:Accepted: test request
302 DTSTART;TZID=Eastern Standard Time:20150105T090000
303 DTEND;TZID=Eastern Standard Time:20150105T093000
310 LOCATION;LANGUAGE=en-US:
315 cat >`mhpath new` <<'EOF'
316 From: sender@example.com
317 To: recipient@example.com
318 Subject: test iCalendar reply
319 Content-Type: text/calendar; charset="UTF-8"
327 TZID:Eastern Standard Time
329 DTSTART:16010101T020000
332 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
335 DTSTART:16010101T020000
338 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
342 ORGANIZER;CN=Requester:MAILTO:requester@example.com
343 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
344 :MAILTO:requestee1@example.com
345 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
346 :MAILTO:requestee2@example.com
347 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
348 :MAILTO:requestee3@example.com
349 SUMMARY;LANGUAGE=en-US:test request
350 DTSTART;TZID=Eastern Standard Time:20150105T090000
351 DTEND;TZID=Eastern Standard Time:20150105T093000
355 DTSTAMP:20150101T171600Z
359 LOCATION;LANGUAGE=en-US:
363 TRIGGER;RELATED=START:-PT15M
369 actual
="$MH_TEST_DIR/test-convert$$.actual"
371 -convertargs text
/calendar
'-reply accept -contenttype' -nowhatnowproc last
372 SIGNATURE
=Recip mhbuild
- <`mhpath +`/draft
| egrep -v '^DTSTAMP:' >"$actual"
373 check
"$actual" "$expected"