]> diplodocus.org Git - nmh/blobdiff - test/mhfixmsg/test-mhfixmsg
Added OAuth2 support to build_nmh.
[nmh] / test / mhfixmsg / test-mhfixmsg
index 323fb72aa4f87a7598d31626bc189294d2c626d5..61821c271124606623244bfcfe96edd78ae41ab1 100755 (executable)
@@ -52,6 +52,7 @@ Usage: mhfixmsg [+folder] [msgs] [switches]
   -decodetext 8bit|7bit
   -nodecodetext
   -decodetypes
+  -[no]crlflinebreaks
   -[no]textcharset
   -[no]reformat
   -[no]replacetextplain
@@ -1053,7 +1054,7 @@ run_test 'mhfixmsg last -outfile '"$actual" ''
 check "$expected" "$actual"
 
 
-# check stripping of CRs from ASCII text context
+# check not stripping of CRs from ASCII text context (default)
 cat >"$expected" <<EOF
 MIME-Version: 1.0
 From: sender@example.com
@@ -1061,8 +1062,8 @@ To: recipient@example.com
 Subject: message with CR's
 Date: Mon, 29 Apr 2013 11:51:45 -0400
 
-There are two CR-LF pairs at the end of this sentence.
-
+There are two CR-LF pairs at the end of this sentence.\r
+\r
 EOF
 
 cat >`mhpath new` <<'EOF'
@@ -1080,6 +1081,33 @@ run_prog mhfixmsg last -outfile "$actual"
 check "$expected" "$actual"
 
 
+# check stripping of CRs from ASCII text context
+cat >"$expected" <<EOF
+MIME-Version: 1.0
+From: sender@example.com
+To: recipient@example.com
+Subject: message with CR's
+Date: Mon, 29 Apr 2013 11:51:45 -0400
+
+There were two CR-LF pairs at the end of this sentence.
+
+EOF
+
+cat >`mhpath new` <<'EOF'
+MIME-Version: 1.0
+From: sender@example.com
+To: recipient@example.com
+Subject: message with CR's
+Date: Mon, 29 Apr 2013 11:51:45 -0400
+
+There were two CR-LF pairs at the end of this sentence.\r
+\r
+EOF
+
+run_prog mhfixmsg last -outfile "$actual" -nocrlflinebreaks
+check "$expected" "$actual"
+
+
 # check -replacetextplain
 prepare_space >"$expected" <<EOF
 To: recipient@example.com
@@ -1318,13 +1346,13 @@ Content-Transfer-Encoding: 8bit
 This is the text/plain part.
 
 ------- =_aaaaaaaaaa0
-Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
+Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
 Content-Disposition: attachment; filename="test2.txt"
 Content-Transfer-Encoding: 8bit
 
 <html>
 <head>
-    This is the text/html part.
+    This was the text/html part.
 </head>
 </body>
 </html>
@@ -1348,16 +1376,16 @@ Content-Transfer-Encoding: quoted-printable
 This is the text/plain part.
 
 ------- =_aaaaaaaaaa0
-Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
+Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
 Content-Disposition: attachment; filename="test2.txt"
 Content-Transfer-Encoding: base64
 
-PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
-b2R5Pgo8L2h0bWw+Cg==
+PGh0bWw+CjxoZWFkPgogICAgVGhpcyB3YXMgdGhlIHRleHQvaHRtbCBwYXJ0Lgo8L2hlYWQ+Cjwv
+Ym9keT4KPC9odG1sPgo=
 
 ------- =_aaaaaaaaaa0--
 EOF
-run_prog mhfixmsg last -outfile "$actual"
+run_prog mhfixmsg last -outfile "$actual" -noreformat
 check "$expected" "$actual"
 
 
@@ -1378,15 +1406,32 @@ Content-Transfer-Encoding: 8bit
 This is the text/plain part.
 
 ------- =_aaaaaaaaaa0
-Content-Type: multipart/alternative; boundary="----=_nmh-multipart2"
+Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
+Content-Disposition: attachment; filename="test2.txt"
+Content-Transfer-Encoding: base64
 
-------=_nmh-multipart2
-Content-Type: text/plain; charset="iso-8859-1"; name="test2.txt"
-Content-Transfer-Encoding: 8bit
+PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
+CjwvYm9keT4NCjwvaHRtbD4NCg==
+
+------- =_aaaaaaaaaa0--
+EOF
+
+cat >`mhpath new` <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 4
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: quoted-printable
 
-This is the text/html part.
+This is the text/plain part.
 
-------=_nmh-multipart2
+------- =_aaaaaaaaaa0
 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
 Content-Disposition: attachment; filename="test2.txt"
 Content-Transfer-Encoding: base64
@@ -1394,7 +1439,43 @@ Content-Transfer-Encoding: base64
 PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
 CjwvYm9keT4NCjwvaHRtbD4NCg==
 
-------=_nmh-multipart2--
+------- =_aaaaaaaaaa0--
+EOF
+run_prog mhfixmsg last -outfile "$actual" -decodetypes text/plain -noreformat
+check "$expected" "$actual"
+
+
+# check -decodetypes attachment/ics
+cat >$expected <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 5
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: 8bit
+
+This is the text/plain part.
+
+------- =_aaaaaaaaaa0
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
+Content-Transfer-Encoding: 8bit
+
+BEGIN:VCALENDAR\r
+VERSION:2.0\r
+PRODID:test-mhical\r
+BEGIN:VEVENT\r
+DTSTAMP:20150101T162400Z\r
+DTSTART:20150105T160000\r
+DTEND:20150105T163000\r
+SUMMARY:4 pm meeting\r
+END:VEVENT\r
+END:VCALENDAR\r
 
 ------- =_aaaaaaaaaa0--
 EOF
@@ -1402,7 +1483,7 @@ EOF
 cat >`mhpath new` <<EOF
 To: recipient@example.com
 From: sender@example.com
-Subject: mhfixmsg decode test 4
+Subject: mhfixmsg decode test 5
 MIME-Version: 1.0
 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
 
@@ -1412,19 +1493,89 @@ Content-Disposition: attachment; filename="test1.txt"
 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
 Content-Transfer-Encoding: quoted-printable
 
+This is the=
+ text/plain part.
+
+------- =_aaaaaaaaaa0
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
+Content-Transfer-Encoding: base64
+
+QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
+RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
+CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
+CkVORDpWQ0FMRU5EQVINCg==
+
+------- =_aaaaaaaaaa0--
+EOF
+run_prog mhfixmsg last -outfile "$actual" -noreformat
+check "$expected" "$actual"
+
+
+# check -decodetypes attachment/ics and -nocrlflinebreaks
+cat >$expected <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 5
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: 8bit
+
 This is the text/plain part.
 
 ------- =_aaaaaaaaaa0
-Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
-Content-Disposition: attachment; filename="test2.txt"
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
+Content-Transfer-Encoding: 8bit
+
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:test-mhical
+BEGIN:VEVENT
+DTSTAMP:20150101T162400Z
+DTSTART:20150105T160000
+DTEND:20150105T163000
+SUMMARY:4 pm meeting
+END:VEVENT
+END:VCALENDAR
+
+------- =_aaaaaaaaaa0--
+EOF
+
+cat >`mhpath new` <<EOF
+To: recipient@example.com
+From: sender@example.com
+Subject: mhfixmsg decode test 5
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Disposition: attachment; filename="test1.txt"
+Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
+Content-Transfer-Encoding: quoted-printable
+
+This is the=
+ text/plain part.
+
+------- =_aaaaaaaaaa0
+Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
+Content-Disposition: attachment; filename="invite.ics"
 Content-Transfer-Encoding: base64
 
-PGh0bWw+CjxoZWFkPgogICAgVGhpcyBpcyB0aGUgdGV4dC9odG1sIHBhcnQuCjwvaGVhZD4KPC9i
-b2R5Pgo8L2h0bWw+Cg==
+QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
+RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
+CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
+CkVORDpWQ0FMRU5EQVINCg==
 
 ------- =_aaaaaaaaaa0--
 EOF
-run_prog mhfixmsg last -outfile "$actual" -decodetypes text/plain
+run_prog mhfixmsg last -outfile "$actual" -nocrlflinebreaks -noreformat
 check "$expected" "$actual"