X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/d7a9b5aa35f81e680a54a2f7c2b7dab749812cef..70e2b8b50f8ac96baa99203145a322f469b33284:/test/repl/test-convert diff --git a/test/repl/test-convert b/test/repl/test-convert index 000f46fd..dd7c101e 100755 --- a/test/repl/test-convert +++ b/test/repl/test-convert @@ -20,7 +20,12 @@ actual=`mhpath +`/draft printf 'Local-Mailbox: recipient@example.com' >>"$MH" -# check -convertarg with multiple parts and no additional text in draft +#### Make sure that this works with 7-bit encoding. +LC_ALL=C; export LC_ALL + + +# check -convertarg with multiple parts and additional text in draft +start_test '-convertarg with multiple parts and additional text in draft' cat >"$expected" <<'EOF' From: recipient@example.com To: sender@example.com @@ -70,11 +75,12 @@ check "$actual" "$expected" #### Make sure that this works with 8-bit encoding. -require_locale en_US.utf-8 en_US.utf8 -LC_ALL=en_US.UTF-8; export LC_ALL +finish_test +require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8 -# check -convertarg with multiple parts and additional text in draft +# check -convertarg with multiple parts, 7 bit +start_test '-convertarg with multiple parts, 7 bit' cat >"$expected" <<'EOF' From: recipient@example.com To: sender@example.com @@ -85,7 +91,6 @@ Comments: In-reply-to sender@example.com message dated "Thu, 11 Dec 2014 08:19:02 -0600." MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" -Content-Transfer-Encoding: 8bit sender@example.com writes: @@ -108,7 +113,7 @@ Content-Type: text/plain This is part 1. --_001_ -Content-Type: text/plain +Content-Type: text/plain; charset="UTF-8" This is part 2. @@ -120,7 +125,55 @@ mhbuild "$actual" check "$actual" "$expected" +# check -convertarg with multiple parts, 8 bit +start_test '-convertarg with multiple parts, 8 bit' +cat >"$expected" <<'EOF' +From: recipient@example.com +To: sender@example.com +cc: +Fcc: +outbox +Subject: Re: test +Comments: In-reply-to sender@example.com + message dated "Thu, 11 Dec 2014 08:19:02 -0600." +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: 8bit + +sender@example.com writes: + +> This is part 1. + +> This is §2, with a non-ASCII character. +EOF + +cat >`mhpath new` <<'EOF' +From: sender@example.com +To: recipient@example.com +Subject: test +Date: Thu, 11 Dec 2014 08:19:02 -0600 +Content-Type: multipart/mixed; boundary="_001_" +MIME-Version: 1.0 + +--_001_ +Content-Type: text/plain + +This is part 1. + +--_001_ +Content-Type: text/plain; charset="UTF-8" + +This is §2, with a non-ASCII character. + +--_001_-- +EOF + +repl -filter mhl.replywithoutbody -convertarg text/plain '' -nowhatnowproc last +mhbuild "$actual" +check "$actual" "$expected" + + # check message with text part in multipart/related +start_test 'check message with text part in multipart/related' cat >"$expected" <<'EOF' From: recipient@example.com To: sender@example.com @@ -131,10 +184,10 @@ Comments: In-reply-to sender@example.com message dated "." MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" -Content-Transfer-Encoding: 8bit sender@example.com writes: +> This is a test. EOF cat >`mhpath new` <<'EOF' @@ -148,9 +201,9 @@ MIME-Version: 1.0 Content-Type: multipart/related; type="text/plain"; boundary="_002_" --_002_ -Content-Type: text/plain - +Content-Type: text/plain; charset="UTF-8" +This is a test. --_002_-- @@ -162,4 +215,115 @@ mhbuild "$actual" check "$actual" "$expected" +# check reply to calendar request +start_test 'check reply to calendar request' +cat >"$expected" <<'EOF' +From: recipient@example.com +To: sender@example.com +cc: +Fcc: +outbox +Subject: Re: test iCalendar reply +Comments: In-reply-to sender@example.com + message dated "." +MIME-Version: 1.0 +Content-Type: text/calendar; method="REPLY"; charset="UTF-8" + +BEGIN:VCALENDAR +METHOD:REPLY +PRODID:nmh mhical v0.1 +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:Eastern Standard Time +BEGIN:STANDARD +DTSTART:16010101T020000 +TZOFFSETFROM:-0400 +TZOFFSETTO:-0500 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:16010101T020000 +TZOFFSETFROM:-0500 +TZOFFSETTO:-0400 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VEVENT +ORGANIZER;CN=Requester:MAILTO:requester@example.com +ATTENDEE;PARTSTAT=ACCEPTED;CN=Recip:MAILTO:recipient@example.com +SUMMARY;LANGUAGE=en-US:Accepted: test request +DTSTART;TZID=Eastern Standard Time:20150105T090000 +DTEND;TZID=Eastern Standard Time:20150105T093000 +UID:0123456789 +CLASS:PUBLIC +PRIORITY:5 +TRANSP:OPAQUE +STATUS:CONFIRMED +SEQUENCE:0 +LOCATION;LANGUAGE=en-US: +END:VEVENT +END:VCALENDAR +EOF + +cat >`mhpath new` <<'EOF' +From: sender@example.com +To: recipient@example.com +Subject: test iCalendar reply +Content-Type: text/calendar; charset="UTF-8" +MIME-Version: 1.0 + +BEGIN:VCALENDAR +METHOD:REQUEST +PRODID:test-convert +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:Eastern Standard Time +BEGIN:STANDARD +DTSTART:16010101T020000 +TZOFFSETFROM:-0400 +TZOFFSETTO:-0500 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:16010101T020000 +TZOFFSETFROM:-0500 +TZOFFSETTO:-0400 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VEVENT +ORGANIZER;CN=Requester:MAILTO:requester@example.com +ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1 + :MAILTO:requestee1@example.com +ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2 + :MAILTO:requestee2@example.com +ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3 + :MAILTO:requestee3@example.com +SUMMARY;LANGUAGE=en-US:test request +DTSTART;TZID=Eastern Standard Time:20150105T090000 +DTEND;TZID=Eastern Standard Time:20150105T093000 +UID:0123456789 +CLASS:PUBLIC +PRIORITY:5 +DTSTAMP:20150101T171600Z +TRANSP:OPAQUE +STATUS:CONFIRMED +SEQUENCE:0 +LOCATION;LANGUAGE=en-US: +BEGIN:VALARM +ACTION:DISPLAY +DESCRIPTION:REMINDER +TRIGGER;RELATED=START:-PT15M +END:VALARM +END:VEVENT +END:VCALENDAR +EOF + +actual="$MH_TEST_DIR/test-convert$$.actual" +repl -noformat \ + -convertargs text/calendar '-reply accept -contenttype' -nowhatnowproc last +SIGNATURE=Recip mhbuild - <`mhpath +`/draft | egrep -v '^DTSTAMP:' >"$actual" +check "$actual" "$expected" + + +finish_test exit $failed