Rework in the test framework; updated and new tests
[mmh] / test / tests / burst / test-burst
1 #!/bin/sh
2 #
3 # Tests to see if bursting messages works correctly.
4 #
5
6 . "$MH_TEST_COMMON"
7
8 #
9 # Create a 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 digest
20
21 ------- Message one
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 is message one
29
30 ------- Message two
31
32 From: Mister Burster <burst3@example.com>
33 To: Nobody 2 <nobody2@example.com>
34 Date: Thursday, 28 Sep 2006 00:02:00
35 Subject: Message two
36
37 This is message two
38 For real.
39
40 -------
41
42 End of all messages
43 EOF
44
45 runandcheck "scan $msgnum" <<!
46   11  2006-09-29 00:00  Test Burst Messag  Test digest
47 !
48
49 runandcheck "burst $msgnum" <<!
50 !
51
52 runandcheck "scan $msgnum-l" <<!
53   11  2006-09-29 00:00  Test Burst Messag  Test digest
54   12+ 2006-09-28 00:01  Mister Burster     Message one
55   13  2006-09-28 00:02  Mister Burster     Message two
56 !
57
58
59 #
60 # Create another test message that stresses the boundary checker a bit
61 #
62
63 msgpath="`mhpath b`"
64 msgnum="${msgpath##*/}"
65
66 cat >"$msgpath" <<EOF
67 From: Test Burst Message <burst1@example.com>
68 To: Test Recipient <recipient@example.com>
69 Date: Friday, 29 Sep 2006 00:00:00
70 Subject: Test digest
71
72 This is a preamble
73 ------- Message one
74
75 From: Mister Burster <burst2@example.com>
76 To: Nobody 1 <nobody1@example.com>
77 Date: Thursday, 28 Sep 2006 00:01:00
78 Subject: Message one
79
80 - -This is message one
81
82 ------- Message two
83 From: Mister Burster <burst3@example.com>
84 To: Nobody 2 <nobody2@example.com>
85 Date: Thursday, 28 Sep 2006 00:02:00
86 Subject: Message two
87
88 This is message two
89 - For real.
90 ------- Message three
91
92
93
94 From: Mister Burster <burst4@example.com>
95 To: Nobody 3 <nobody3@example.com>
96 Date: Thursday, 28 Sep 2006 00:03:00
97 Subject: Message three
98
99 Will this one work?
100
101
102 ------ Message three
103 End of all messages
104 EOF
105
106 runandcheck "burst $msgnum" <<!
107 burst: message 14 not in digest format, continuing...
108 !
109
110 # mmh's burst(1) is picky about the input format
111
112 exit
113
114 # If we make burst to be more liberal in accepting not perfect
115 # boundaries in the input, we can run the following tests
116
117
118 runandcheck "scan $msgnum-l" <<!
119   14  09/29 Test Burst Messag  Test digest
120   15+ 09/28 Mister Burster     Message one
121   16  09/28 Mister Burster     Message two
122   17  09/28 Mister Burster     Message three
123 !
124
125 #
126 # Check to see if each message is what we expect
127 #
128
129 folder -fast "$msgnum" >/dev/null
130
131 runandcheck "next" <<!
132 From: Mister Burster <burst2@example.com>
133 To: Nobody 1 <nobody1@example.com>
134 Date: Thursday, 28 Sep 2006 00:01:00
135 Subject: Message one
136
137 -This is message one
138 !
139
140 runandcheck "next" <<!
141 From: Mister Burster <burst3@example.com>
142 To: Nobody 2 <nobody2@example.com>
143 Date: Thursday, 28 Sep 2006 00:02:00
144 Subject: Message two
145
146 This is message two
147 For real.
148 !
149
150 runandcheck "next" <<!
151 From: Mister Burster <burst4@example.com>
152 To: Nobody 3 <nobody3@example.com>
153 Date: Thursday, 28 Sep 2006 00:03:00
154 Subject: Message three
155
156 Will this one work?
157
158 !