Rework in the test framework; updated and new tests
[mmh] / test / tests / burst / test-burst-mime
diff --git a/test/tests/burst/test-burst-mime b/test/tests/burst/test-burst-mime
new file mode 100755 (executable)
index 0000000..19ddaaa
--- /dev/null
@@ -0,0 +1,145 @@
+#!/bin/sh
+#
+# Tests to see if bursting MIME messages works correctly.
+#
+
+. "$MH_TEST_COMMON"
+
+#
+# Create a one-part test message that we can burst
+#
+
+msgpath="`mhpath b`"
+msgnum="${msgpath##*/}"
+
+cat >"$msgpath" <<EOF
+From: Test Burst Message <burst1@example.com>
+To: Test Recipient <recipient@example.com>
+Date: Friday, 29 Sep 2006 00:00:00
+Subject: Test MIME digest
+MIME-Version: 1.0
+Content-type: message/rfc822
+
+From: Mister Burster <burst2@example.com>
+To: Nobody 1 <nobody1@example.com>
+Date: Thursday, 28 Sep 2006 00:01:00
+Subject: Message one
+
+- - This line should not be unstuffed
+
+EOF
+
+runandcheck "burst $msgnum" <<!
+burst: message 11 not in digest format, continuing...
+!
+
+runandcheck "scan $msgnum-l" <<!
+  11  2006-09-29 00:00  Test Burst Messag  Test MIME digest
+!
+
+#
+# Create another test message that does multipart/digest checking
+#
+
+msgpath="`mhpath b`"
+msgnum="${msgpath##*/}"
+
+cat > "$msgpath" <<EOF
+From: Test Burst Message <burst1@example.com>
+To: Test Recipient <recipient@example.com>
+Date: Friday, 29 Sep 2006 00:00:00
+Subject: Test digest
+MIME-Version: 1.0
+Content-Type: multipart/digest; boundary="----- =_aaaaaaaaaa0"
+
+This is a preamble
+
+------- =_aaaaaaaaaa0
+
+Content-Type: message/rfc822
+
+From: Mister Burster <burst2@example.com>
+To: Nobody 1 <nobody1@example.com>
+Date: Thursday, 28 Sep 2006 00:01:00
+Subject: Message one
+
+- -This is message one
+
+------- =_aaaaaaaaaa0
+
+From: Mister Burster <burst3@example.com>
+To: Nobody 2 <nobody2@example.com>
+Date: Thursday, 28 Sep 2006 00:02:00
+Subject: Message two
+
+This is message two
+- For real.
+
+------- =_aaaaaaaaaa0
+
+From: Mister Burster <burst4@example.com>
+To: Nobody 3 <nobody3@example.com>
+Date: Thursday, 28 Sep 2006 00:03:00
+Subject: Message three
+
+Will this one work?
+
+------- =_aaaaaaaaaa0--
+
+EOF
+
+runandcheck "burst $msgnum" <<!
+!
+
+runandcheck "scan $msgnum-l" <<!
+  12  2006-09-29 00:00  Test Burst Messag  Test digest
+  13+ `date +'%Y-%m-%d %H:%M'`                     
+  14  2006-09-28 00:02  Mister Burster     Message two
+  15  2006-09-28 00:03  Mister Burster     Message three
+!
+
+#
+# Check to see if each message is what we expect
+#
+
+folder -fast "$msgnum" >/dev/null
+
+runandcheck "next" <<!
+
+part       message/rfc822             157
+Date:    Thu, 28 Sep 2006 00:01:00
+From:    Mister Burster <burst2@example.com>
+To:      Nobody 1 <nobody1@example.com>
+Subject: Message one
+
+part       text/plain                  21
+-This is message one
+!
+
+runandcheck "next" <<!
+Date:    Thu, 28 Sep 2006 00:02:00
+From:    Mister Burster <burst3@example.com>
+To:      Nobody 2 <nobody2@example.com>
+Subject: Message two
+
+part       text/plain                  30
+This is message two
+For real.
+!
+
+#
+# The CR/LF that appears right before the boundary line is considered part
+# of the boundary line, so this has the practical effect of "eating" a
+# blank line if it's before the boundary (RFC 2046. 5.1.1).  So make sure
+# a double blank line results in only one blank line at the end of a message.
+#
+
+runandcheck "next" <<!
+Date:    Thu, 28 Sep 2006 00:03:00
+From:    Mister Burster <burst4@example.com>
+To:      Nobody 3 <nobody3@example.com>
+Subject: Message three
+
+part       text/plain                  20
+Will this one work?
+!