]>
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 # check -convertarg with multiple parts and additional text in draft
24 cat >"$expected" <<'EOF'
25 From: recipient@example.com
26 To: sender@example.com
30 Comments: In-reply-to sender@example.com
31 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
33 Content-Type: text/plain; charset="US-ASCII"
40 cat >`mhpath new` <<'EOF'
41 From: sender@example.com
42 To: recipient@example.com
44 Date: Thu, 11 Dec 2014 08:19:02 -0600
45 Content-Type: multipart/mixed; boundary="_001_"
49 Content-Type: text/plain
54 Content-Type: text/plain
59 Content-Type: text/enriched
61 This should not appear in the reply
62 because the content type isn't matched.
67 repl
-noformat -convertarg text
/plain
'' -nowhatnowproc last
69 check
"$actual" "$expected"
72 #### Make sure that this works with 8-bit encoding.
73 require_locale en_US.utf
-8 en_US.utf8
74 LC_ALL
=en_US.UTF
-8; export LC_ALL
77 # check -convertarg with multiple parts and no additional text in draft
78 cat >"$expected" <<'EOF'
79 From: recipient@example.com
80 To: sender@example.com
84 Comments: In-reply-to sender@example.com
85 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
87 Content-Type: text/plain; charset="UTF-8"
88 Content-Transfer-Encoding: 8bit
90 sender@example.com writes:
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
111 Content-Type: text/plain
118 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
120 check
"$actual" "$expected"
123 # check message with text part in multipart/related
124 cat >"$expected" <<'EOF'
125 From: recipient@example.com
126 To: sender@example.com
129 Subject: Re: test with text part in multipart/related
130 Comments: In-reply-to sender@example.com
133 Content-Type: text/plain; charset="UTF-8"
134 Content-Transfer-Encoding: 8bit
136 sender@example.com writes:
141 cat >`mhpath new` <<'EOF'
142 From: sender@example.com
143 To: recipient@example.com
144 Subject: test with text part in multipart/related
145 Content-Type: multipart/alternative; boundary="_001_"
149 Content-Type: multipart/related; type="text/plain"; boundary="_002_"
152 Content-Type: text/plain
161 repl
-filter mhl.replywithoutbody
-convertarg text
/plain
'' -nowhatnowproc last
163 check
"$actual" "$expected"
166 # check reply to calendar request
167 cat >"$expected" <<'EOF'
168 From: recipient@example.com
169 To: sender@example.com
172 Subject: Re: test iCalendar reply
173 Comments: In-reply-to sender@example.com
176 Content-Type: text/calendar; method="REPLY"; charset="UTF-8"
180 PRODID:nmh mhical v0.1
183 TZID:Eastern Standard Time
185 DTSTART:16010101T020000
188 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
191 DTSTART:16010101T020000
194 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
198 ORGANIZER;CN=Requester:MAILTO:requester@example.com
199 ATTENDEE;PARTSTAT=ACCEPTED;CN=Recip:MAILTO:recipient@example.com
200 SUMMARY;LANGUAGE=en-US:Accepted: test request
201 DTSTART;TZID=Eastern Standard Time:20150105T090000
202 DTEND;TZID=Eastern Standard Time:20150105T093000
209 LOCATION;LANGUAGE=en-US:
214 cat >`mhpath new` <<'EOF'
215 From: sender@example.com
216 To: recipient@example.com
217 Subject: test iCalendar reply
218 Content-Type: text/calendar; charset="UTF-8"
226 TZID:Eastern Standard Time
228 DTSTART:16010101T020000
231 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
234 DTSTART:16010101T020000
237 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
241 ORGANIZER;CN=Requester:MAILTO:requester@example.com
242 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
243 :MAILTO:requestee1@example.com
244 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
245 :MAILTO:requestee2@example.com
246 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
247 :MAILTO:requestee3@example.com
248 SUMMARY;LANGUAGE=en-US:test request
249 DTSTART;TZID=Eastern Standard Time:20150105T090000
250 DTEND;TZID=Eastern Standard Time:20150105T093000
254 DTSTAMP:20150101T171600Z
258 LOCATION;LANGUAGE=en-US:
262 TRIGGER;RELATED=START:-PT15M
268 actual
="$MH_TEST_DIR/test-convert$$.actual"
270 -convertargs text
/calendar
'-reply accept -contenttype' -nowhatnowproc last
271 SIGNATURE
=Recip mhbuild
- <`mhpath +`/draft
| egrep -v '^DTSTAMP:' >"$actual"
272 check
"$actual" "$expected"