]> diplodocus.org Git - nmh/blob - test/inc/test-inc-scanout
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / test / inc / test-inc-scanout
1 #!/bin/sh
2 #
3 # Check to see if the scan output is correct if we have a message
4 # right on the stdio buffer boundary
5 #
6
7 set -e
8
9 if test -z "${MH_OBJ_DIR}"; then
10 srcdir=`dirname "$0"`/../..
11 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
12 fi
13
14 . "$MH_OBJ_DIR/test/common.sh"
15
16 setup_test
17
18 thisdir="$srcdir/test/inc"
19 expected="$MH_TEST_DIR/$$.expected"
20 actual="$MH_TEST_DIR/$$.actual"
21
22 cat > "${MH_TEST_DIR}/test.mbox" <<EOF
23 From nobody@nowhereville Jan 1 1970
24 Received: I am the very model of a modern Major-General,
25 Received: I've information vegetable, animal, and mineral,
26 Received: I know the kings of England, and I quote the fights historical
27 Received: From Marathon to Waterloo, in order categorical;
28 Received: I'm very well acquainted, too, with matters mathematical,
29 Received: I understand equations, both the simple and quadratical,
30 Received: About binomial theorem I'm teeming with a lot o' news,
31 Received: With many cheerful facts about the square of the hypotenuse.
32 Received: I'm very good at integral and differential calculus;
33 Received: I know the scientific names of beings animalculous:
34 Received: In short, in matters vegetable, animal, and mineral,
35 Received: I am the very model of a modern Major-General.
36 Received: I know our mythic history, King Arthur's and Sir Caradoc's;
37 Received: I answer hard acrostics, I've a pretty taste for paradox,
38 Received: I quote in elegiacs all the crimes of Heliogabalus,
39 Received: In conics I can floor peculiarities parabolous;
40 Received: I can tell undoubted Raphaels from Gerard Dows and Zoffanies,
41 Received: I know the croaking chorus from The Frogs of Aristophanes!
42 Received: Then I can hum a fugue of which I've heard the music's din afore,c
43 Received: And whistle all the airs from that infernal nonsense Pinafore.
44 Received: Then I can write a washing bill in Babylonic cuneiform,
45 Received: And tell you ev'ry detail of Caractacus's uniform:d
46 Received: In short, in matters vegetable, animal, and mineral,
47 Received: I am the very model of a modern Major-General.
48 Received: In fact, when I know what is meant by "mamelon" and "ravelin",
49 Received: When I can tell at sight a Mauser rifle from a Javelin,
50 Received: When such affairs as sorties and surprises I'm more wary at,
51 Received: And when I know precisely what is meant by "commissariat",
52 Received: When I have learnt what progress has been made in modern gunnery,
53 Received: When I know more of tactics than a novice in a nunnery—
54 Received: In short, when I've a smattering of elemental strategy—
55 Received: You'll say a better Major-General has never sat a gee.
56 Received: For my military knowledge, though I'm plucky and adventury,
57 Received: Has only been brought down to the beginning of the century;
58 Received: But still, in matters vegetable, animal, and mineral,
59 Received: I am the very model of a modern Major-General.
60 Received: For the Angel of Death spread his wings on the blast,
61 Received: And breathed in the face of the foe as he passed:
62 Received: the eyes of the sleepers waxed deadly and chill,
63 Received: And their hearts but once heaved, and for ever grew still!
64 Received: Abbott: Strange as it may seem, they give ball players nowadays very peculiar names.
65 Received: Costello: Funny names?
66 Received: Abbott: Nicknames, nicknames. Now, on the St. Louis team we have Who's on first, What's on second, I Don't Know is on third--
67 Received: Costello: That's what I want to find out. I want you to tell me the names of the fellows on the St. Louis team.
68 Received: Abbott: I'm telling you. Who's on first, What's on second, I Don't Know is on third--
69 Received: Costello: You know the fellows' names?
70 Received: Abbott: Yes.
71 Received: Costello: Well, then who's playing first?
72 Received: Abbott: Yes.
73 Received: Costello: I mean the fellow's name on first base.
74 Received: Abbott: Who.
75 Received: Costello: The fellow playin' first base.
76 Received: Abbott: Who.
77 Received: Costello: The guy on first base.
78 Received: Abbott: Who is on first.
79 Received: Costello: Well, what are you askin' me for?
80 Received: Abbott: I'm not asking you--I'm telling you. Who is on first.
81 Received: Costello: I'm asking you--who's on first?
82 Received: Abbott: That's the man's name.
83 Received: Costello: That's who's name?
84 Received: Abbott: Yes.
85 Received: Costello: When you pay off the first baseman every month, who gets the money?
86 X-Spam-Source: Definitely spam! Seriously!
87 From: Mr Nobody <nobody1@example.com>
88 To: Another Nobody <nobody2@example.com>
89 Date: Thu, 1 Mar 2012 01:02:03 -0500
90 Subject: Who is on first?
91
92 Abbott: Every dollar of it. And why not, the man's entitled to it.
93 Costello: Who is?
94 Abbott: Yes.
95 Costello: So who gets it?
96 Abbott: Why shouldn't he? Sometimes his wife comes down and collects it.
97 Costello: Who's wife?
98 Abbott: Yes. After all, the man earns it.
99 Costello: Who does?
100 Abbott: Absolutely.
101 Costello: Well, all I'm trying to find out is what's the guy's name on first base?
102 Abbott: Oh, no, no. What is on second base.
103 Costello: I'm not asking you who's on second.
104 Abbott: Who's on first!
105 EOF
106
107 cat > "${MH_TEST_DIR}/test.mbox.2" <<EOF
108 Received: I am the very model of a modern Major-General,
109 Received: I've information vegetable, animal, and mineral,
110 Received: I know the kings of England, and I quote the fights historical
111 Received: From Marathon to Waterloo, in order categorical;
112 Received: I'm very well acquainted, too, with matters mathematical,
113 Received: I understand equations, both the simple and quadratical,
114 Received: About binomial theorem I'm teeming with a lot o' news,
115 Received: With many cheerful facts about the square of the hypotenuse.
116 Received: I'm very good at integral and differential calculus;
117 Received: I know the scientific names of beings animalculous:
118 Received: In short, in matters vegetable, animal, and mineral,
119 Received: I am the very model of a modern Major-General.
120 Received: I know our mythic history, King Arthur's and Sir Caradoc's;
121 Received: I answer hard acrostics, I've a pretty taste for paradox,
122 Received: I quote in elegiacs all the crimes of Heliogabalus,
123 Received: In conics I can floor peculiarities parabolous;
124 Received: I can tell undoubted Raphaels from Gerard Dows and Zoffanies,
125 Received: I know the croaking chorus from The Frogs of Aristophanes!
126 Received: Then I can hum a fugue of which I've heard the music's din afore,c
127 Received: And whistle all the airs from that infernal nonsense Pinafore.
128 Received: Then I can write a washing bill in Babylonic cuneiform,
129 Received: And tell you ev'ry detail of Caractacus's uniform:d
130 Received: In short, in matters vegetable, animal, and mineral,
131 Received: I am the very model of a modern Major-General.
132 Received: In fact, when I know what is meant by "mamelon" and "ravelin",
133 Received: When I can tell at sight a Mauser rifle from a Javelin,
134 Received: When such affairs as sorties and surprises I'm more wary at,
135 Received: And when I know precisely what is meant by "commissariat",
136 Received: When I have learnt what progress has been made in modern gunnery,
137 Received: When I know more of tactics than a novice in a nunnery—
138 Received: In short, when I've a smattering of elemental strategy—
139 Received: You'll say a better Major-General has never sat a gee.
140 Received: For my military knowledge, though I'm plucky and adventury,
141 Received: Has only been brought down to the beginning of the century;
142 Received: But still, in matters vegetable, animal, and mineral,
143 Received: I am the very model of a modern Major-General.
144 Received: For the Angel of Death spread his wings on the blast,
145 Received: And breathed in the face of the foe as he passed:
146 Received: the eyes of the sleepers waxed deadly and chill,
147 Received: And their hearts but once heaved, and for ever grew still!
148 Received: Abbott: Strange as it may seem, they give ball players nowadays very peculiar names.
149 Received: Costello: Funny names?
150 Received: Abbott: Nicknames, nicknames. Now, on the St. Louis team we have Who's on first, What's on second, I Don't Know is on third--
151 Received: Costello: That's what I want to find out. I want you to tell me the names of the fellows on the St. Louis team.
152 Received: Abbott: I'm telling you. Who's on first, What's on second, I Don't Know is on third--
153 Received: Costello: You know the fellows' names?
154 Received: Abbott: Yes.
155 Received: Costello: Well, then who's playing first?
156 Received: Abbott: Yes.
157 Received: Costello: I mean the fellow's name on first base.
158 Received: Abbott: Who.
159 Received: Costello: The fellow playin' first base.
160 Received: Abbott: Who.
161 Received: Costello: The guy on first base.
162 Received: Abbott: Who is on first.
163 Received: Costello: Well, what are you askin' me for?
164 Received: Abbott: I'm not asking you--I'm telling you. Who is on first.
165 Received: Costello: I'm asking you--who's on first?
166 Received: Abbott: That's the man's name.
167 Received: Costello: That's who's name?
168 Received: Abbott: Yes.
169 Received: Costello: When you pay off the first baseman every month, who gets the money?
170 X-Spam-Source: Definitely spam! Seriously!
171 From: Mr Nobody <nobody1@example.com>
172 To: Another Nobody <nobody2@example.com>
173 Date: Thu, 1 Mar 2012 01:02:03 -0500
174 Subject: Who is on first?
175
176 Abbott: Every dollar of it. And why not, the man's entitled to it.
177 Costello: Who is?
178 Abbott: Yes.
179 Costello: So who gets it?
180 Abbott: Why shouldn't he? Sometimes his wife comes down and collects it.
181 Costello: Who's wife?
182 Abbott: Yes. After all, the man earns it.
183 Costello: Who does?
184 Abbott: Absolutely.
185 Costello: Well, all I'm trying to find out is what's the guy's name on first base?
186 Abbott: Oh, no, no. What is on second base.
187 Costello: I'm not asking you who's on second.
188 Abbott: Who's on first!
189 EOF
190
191 run_test "inc -file ${MH_TEST_DIR}/test.mbox -width 120 -truncate" \
192 "Incorporating new mail into inbox...
193
194 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cost"
195
196 check `mhpath +inbox 11` "${MH_TEST_DIR}/test.mbox.2" "keep first"
197 rm -f "${MH_TEST_DIR}/test.mbox" "${MH_TEST_DIR}/test.mbox.2"
198
199 run_test "scan -width 120 +inbox 11" \
200 " 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cost"
201
202 # check header field name with ':' character than lands on m_getfld() buffer
203 cat >"$MH_TEST_DIR/mess" <<EOF
204 Comments: The important characteristic of this message is that the 8193'rd
205 Comments: byte is the ':' at the end of header field name. That tests some
206 Comments: logic in m_getfld (), assuming its MSG_INPUT_SIZE is 8192.
207 Comments: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
208 Comments: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
209 Comments: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
210 Comments: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
211 Comments: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
212 Comments: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
213 Comments: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
214 Comments: HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
215 Comments: IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
216 Comments: JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
217 Comments: KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
218 Comments: LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
219 Comments: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
220 Comments: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
221 Comments: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
222 Comments: PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
223 Comments: QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
224 Comments: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
225 Comments: SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
226 Comments: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
227 Comments: UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
228 Comments: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
229 Comments: WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
230 Comments: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
231 Comments: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
232 Comments: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
233 Comments: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
234 Comments: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
235 Comments: cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
236 Comments: dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
237 Comments: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
238 Comments: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
239 Comments: gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
240 Comments: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
241 Comments: iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
242 Comments: jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
243 Comments: kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
244 Comments: llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
245 Comments: mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
246 Comments: nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
247 Comments: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
248 Comments: pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
249 Comments: qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
250 Comments: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
251 Comments: ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
252 Comments: tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
253 Comments: uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
254 Comments: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
255 Comments: wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
256 Comments: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
257 Comments: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
258 Comments: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
259 Comments: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
260 Comments: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
261 Comments: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
262 Comments: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
263 Comments: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
264 Comments: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
265 Comments: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
266 Comments: HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
267 Comments: IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
268 Comments: JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
269 Comments: KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
270 Comments: LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
271 Comments: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
272 Comments: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
273 Comments: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
274 Comments: PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
275 Comments: QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
276 Comments: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
277 Comments: SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
278 Comments: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
279 Comments: UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
280 Comments: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
281 Comments: WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
282 Comments: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
283 Comments: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
284 Comments: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
285 Comments: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
286 Comments: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
287 Comments: cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
288 Comments: dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
289 Comments: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
290 Comments: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
291 Comments: gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
292 Comments: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
293 Comments: iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
294 Comments: jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
295 Comments: kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
296 Comments: llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
297 Comments: mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
298 Comments: nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
299 Comments: oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
300 Comments: pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
301 Comments: qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
302 Comments: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
303 Comments: ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
304 Comments: tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
305 Comments: uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
306 Comments: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
307 Comments: wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
308 Comments: This is it, the line with the 8193'rd character of ':'.
309 Comments: From somewhere
310 From: No Such User <nosuch@example.com>
311 To: Some Other User <someother@example.com>
312 Subject: all that and nothing to say?
313 Date: Thu, 10 Jan 2013 19:54:01 -0500
314
315 EOF
316
317 run_test 'scan -width 60 -file '"$MH_TEST_DIR/mess" \
318 ' 1 01/10 No Such User all that and nothing to say?'
319 rm -f "$MH_TEST_DIR/mess"
320
321 # check m_getfld() handling of fields with trailing whitespace
322 # Even though header field names aren't supposed to have spaces (RFC
323 # 28220, m_getfld () trims trailing whitespace from them.
324 cat >`mhpath new` <<EOF
325 Date : Sun, 18 Dec 2005 00:52:39 +0100
326 From : foo@example.edu
327 To: bar@example.edu
328 Subject: test
329 EOF
330 run_test 'scan last' ' 12 12/18 foo@example.edu test'
331
332 # check header field body with more than 511 characters
333 cat >"$MH_TEST_DIR/mess" <<EOF
334 Comments: The important characteristic of this message is that this header
335 field body is more than 511 bytes long. That tests the logic in
336 m_getfld () for transitioning to the FLDPLUS state. This is the
337 only use for the FLDPLUS state, handling header field bodies that
338 are longer than the buffer used to retrieve them. The trailing
339 newline after the last character is the 512th character. The 511th
340 character, counting all spaces, even the leading one, is*
341 From: No Such User <nosuch@example.com>
342 To: Some Other User <someother@example.com>
343 Subject: FLDPLUS test
344 Date: Wed, 16 Jan 2013 20:33:58 -0600
345
346 EOF
347
348 run_test 'scan -width 80 -file '"$MH_TEST_DIR"'/mess' \
349 ' 1 01/16 No Such User FLDPLUS test'
350 rm -f "$MH_TEST_DIR/mess"
351
352 # check inc of message with header field body with more than 511 characters
353 cat >"$expected" <<EOF
354 Comments: The important characteristic of this message is that this header
355 field body is more than 511 bytes long. That tests the logic in
356 m_getfld () for transitioning to the FLDPLUS state. This is the
357 only use for the FLDPLUS state, handling header field bodies that
358 are longer than the buffer used to retrieve them. The trailing
359 newline after the last character is the 512th character. The 511th
360 character, counting all spaces, even the leading one, is*
361 And, it continues onto this line.
362 From: No Such User <nosuch@example.com>
363 To: Some Other User <someother@example.com>
364 Subject: FLDPLUS test
365 Date: Wed, 16 Jan 2013 20:33:58 -0600
366 EOF
367
368 cat >"$MH_TEST_DIR/mess" <<EOF
369 From nosuch@example.com Wed 16 Jan 2013 20:33:58 -0600
370 Comments: The important characteristic of this message is that this header
371 field body is more than 511 bytes long. That tests the logic in
372 m_getfld () for transitioning to the FLDPLUS state. This is the
373 only use for the FLDPLUS state, handling header field bodies that
374 are longer than the buffer used to retrieve them. The trailing
375 newline after the last character is the 512th character. The 511th
376 character, counting all spaces, even the leading one, is*
377 And, it continues onto this line.
378 From: No Such User <nosuch@example.com>
379 To: Some Other User <someother@example.com>
380 Subject: FLDPLUS test
381 Date: Wed, 16 Jan 2013 20:33:58 -0600
382
383 EOF
384 run_prog inc -file "$MH_TEST_DIR/mess" >/dev/null
385 check "$expected" `mhpath last` || rmm last
386 rm -f "$MH_TEST_DIR/mess"
387
388 # check scan and inc of mbox with multiple messages
389 echo y | packf -file "$MH_TEST_DIR/msgbox"
390 run_test "scan -width 80 -file $MH_TEST_DIR/msgbox" \
391 ' 1 09/29 Test1 Testing message 1<<This is message number 1 >>
392 2 09/29 Test2 Testing message 2<<This is message number 2 >>
393 3 09/29 Test3 Testing message 3<<This is message number 3 >>
394 4 09/29 Test4 Testing message 4<<This is message number 4 >>
395 5 09/29 Test5 Testing message 5<<This is message number 5 >>
396 6 09/29 Test6 Testing message 6<<This is message number 6 >>
397 7 09/29 Test7 Testing message 7<<This is message number 7 >>
398 8 09/29 Test8 Testing message 8<<This is message number 8 >>
399 9 09/29 Test9 Testing message 9<<This is message number 9 >>
400 10 09/29 Test10 Testing message 10<<This is message number 10 >>
401 11 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And
402 12 12/18 foo@example.edu test'
403 run_test "inc -width 80 -file $MH_TEST_DIR/msgbox -truncate" \
404 'Incorporating new mail into inbox...
405
406 13+ 09/29 Test1 Testing message 1<<This is message number 1 >>
407 14 09/29 Test2 Testing message 2<<This is message number 2 >>
408 15 09/29 Test3 Testing message 3<<This is message number 3 >>
409 16 09/29 Test4 Testing message 4<<This is message number 4 >>
410 17 09/29 Test5 Testing message 5<<This is message number 5 >>
411 18 09/29 Test6 Testing message 6<<This is message number 6 >>
412 19 09/29 Test7 Testing message 7<<This is message number 7 >>
413 20 09/29 Test8 Testing message 8<<This is message number 8 >>
414 21 09/29 Test9 Testing message 9<<This is message number 9 >>
415 22 09/29 Test10 Testing message 10<<This is message number 10 >>
416 23 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And
417 24 12/18 foo@example.edu test'
418 rm -f "$MH_TEST_DIR/msgbox"
419
420 # check mbox with two blank lines between header and body
421 cat >>"$MH_TEST_DIR/msgbox" <<EOF
422 From
423 Date: Mon, 15 Apr 2013 21:02:12 -0500
424 From: me@example.com
425
426
427 test
428 EOF
429
430 run_test "inc -width 60 -file $MH_TEST_DIR/msgbox -truncate" \
431 'Incorporating new mail into inbox...
432
433 25+ 04/15 me@example.com <<test >>'
434 rm -f "$MH_TEST_DIR/msgbox"
435
436 # check inc (m_getfld, actually) of very, very, very short message
437 cat >>"$MH_TEST_DIR/msgbox" <<EOF
438 From
439 Date: Tue, 6 Sep 2016 08:52:32 -0400
440 From: me@example.com
441
442 a
443 EOF
444
445 run_test "inc -width 50 -file $MH_TEST_DIR/msgbox -truncate" \
446 'Incorporating new mail into inbox...
447
448 26+ 09/06 me@example.com <<a >>'
449 rm -f "$MH_TEST_DIR/msgbox"
450
451 # check inc (m_getfld, actually) of very, very short message
452 cat >>"$MH_TEST_DIR/msgbox" <<EOF
453 From
454 Date: Tue, 6 Sep 2016 08:52:32 -0400
455 From: me@example.com
456
457 ab
458 EOF
459
460 run_test "inc -width 50 -file $MH_TEST_DIR/msgbox -truncate" \
461 'Incorporating new mail into inbox...
462
463 27+ 09/06 me@example.com <<ab >>'
464 rm -f "$MH_TEST_DIR/msgbox"
465
466 # check inc (m_getfld, actually) of very short message
467 cat >>"$MH_TEST_DIR/msgbox" <<EOF
468 From
469 Date: Tue, 6 Sep 2016 08:52:32 -0400
470 From: me@example.com
471
472 abc
473 EOF
474
475 run_test "inc -width 50 -file $MH_TEST_DIR/msgbox -truncate" \
476 'Incorporating new mail into inbox...
477
478 28+ 09/06 me@example.com <<abc >>'
479 rm -f "$MH_TEST_DIR/msgbox"
480
481 # check inc (m_getfld, actually) of short message
482 cat >>"$MH_TEST_DIR/msgbox" <<EOF
483 From
484 Date: Tue, 6 Sep 2016 08:52:32 -0400
485 From: me@example.com
486
487 abcd
488 EOF
489
490 run_test "inc -width 50 -file $MH_TEST_DIR/msgbox -truncate" \
491 'Incorporating new mail into inbox...
492
493 29+ 09/06 me@example.com <<abcd >>'
494 rm -f "$MH_TEST_DIR/msgbox"
495
496
497 exit ${failed:-0}