Rework in the test framework; updated and new tests
[mmh] / test / tests / burst / test-burst-mime
1 #!/bin/sh
2 #
3 # Tests to see if bursting MIME messages works correctly.
4 #
5
6 . "$MH_TEST_COMMON"
7
8 #
9 # Create a one-part test message that we can burst
10 #
11
12 msgpath="`mhpath b`"
13 msgnum="${msgpath##*/}"
14
15 cat >"$msgpath" <<EOF
16 From: Test Burst Message <burst1@example.com>
17 To: Test Recipient <recipient@example.com>
18 Date: Friday, 29 Sep 2006 00:00:00
19 Subject: Test MIME digest
20 MIME-Version: 1.0
21 Content-type: message/rfc822
22
23 From: Mister Burster <burst2@example.com>
24 To: Nobody 1 <nobody1@example.com>
25 Date: Thursday, 28 Sep 2006 00:01:00
26 Subject: Message one
27
28 - - This line should not be unstuffed
29
30 EOF
31
32 runandcheck "burst $msgnum" <<!
33 burst: message 11 not in digest format, continuing...
34 !
35
36 runandcheck "scan $msgnum-l" <<!
37   11  2006-09-29 00:00  Test Burst Messag  Test MIME digest
38 !
39
40 #
41 # Create another test message that does multipart/digest checking
42 #
43
44 msgpath="`mhpath b`"
45 msgnum="${msgpath##*/}"
46
47 cat > "$msgpath" <<EOF
48 From: Test Burst Message <burst1@example.com>
49 To: Test Recipient <recipient@example.com>
50 Date: Friday, 29 Sep 2006 00:00:00
51 Subject: Test digest
52 MIME-Version: 1.0
53 Content-Type: multipart/digest; boundary="----- =_aaaaaaaaaa0"
54
55 This is a preamble
56
57 ------- =_aaaaaaaaaa0
58
59 Content-Type: message/rfc822
60
61 From: Mister Burster <burst2@example.com>
62 To: Nobody 1 <nobody1@example.com>
63 Date: Thursday, 28 Sep 2006 00:01:00
64 Subject: Message one
65
66 - -This is message one
67
68 ------- =_aaaaaaaaaa0
69
70 From: Mister Burster <burst3@example.com>
71 To: Nobody 2 <nobody2@example.com>
72 Date: Thursday, 28 Sep 2006 00:02:00
73 Subject: Message two
74
75 This is message two
76 - For real.
77
78 ------- =_aaaaaaaaaa0
79
80 From: Mister Burster <burst4@example.com>
81 To: Nobody 3 <nobody3@example.com>
82 Date: Thursday, 28 Sep 2006 00:03:00
83 Subject: Message three
84
85 Will this one work?
86
87 ------- =_aaaaaaaaaa0--
88
89 EOF
90
91 runandcheck "burst $msgnum" <<!
92 !
93
94 runandcheck "scan $msgnum-l" <<!
95   12  2006-09-29 00:00  Test Burst Messag  Test digest
96   13+ `date +'%Y-%m-%d %H:%M'`                     
97   14  2006-09-28 00:02  Mister Burster     Message two
98   15  2006-09-28 00:03  Mister Burster     Message three
99 !
100
101 #
102 # Check to see if each message is what we expect
103 #
104
105 folder -fast "$msgnum" >/dev/null
106
107 runandcheck "next" <<!
108
109 part       message/rfc822             157
110 Date:    Thu, 28 Sep 2006 00:01:00
111 From:    Mister Burster <burst2@example.com>
112 To:      Nobody 1 <nobody1@example.com>
113 Subject: Message one
114
115 part       text/plain                  21
116 -This is message one
117 !
118
119 runandcheck "next" <<!
120 Date:    Thu, 28 Sep 2006 00:02:00
121 From:    Mister Burster <burst3@example.com>
122 To:      Nobody 2 <nobody2@example.com>
123 Subject: Message two
124
125 part       text/plain                  30
126 This is message two
127 For real.
128 !
129
130 #
131 # The CR/LF that appears right before the boundary line is considered part
132 # of the boundary line, so this has the practical effect of "eating" a
133 # blank line if it's before the boundary (RFC 2046. 5.1.1).  So make sure
134 # a double blank line results in only one blank line at the end of a message.
135 #
136
137 runandcheck "next" <<!
138 Date:    Thu, 28 Sep 2006 00:03:00
139 From:    Mister Burster <burst4@example.com>
140 To:      Nobody 3 <nobody3@example.com>
141 Subject: Message three
142
143 part       text/plain                  20
144 Will this one work?
145 !