]>
diplodocus.org Git - nmh/blob - test/inc/test-inc-scanout
3 # Check to see if the scan output is correct if we have a message
4 # right on the stdio buffer boundary
9 if test -z "${MH_OBJ_DIR}"; then
10 srcdir
=`dirname "$0"`/..
/..
11 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
14 .
"$MH_OBJ_DIR/test/common.sh"
18 thisdir
="$srcdir/test/inc"
19 expected
="$MH_TEST_DIR/$$.expected"
20 expected_err
="$MH_TEST_DIR/$$.expected_err"
21 actual
="$MH_TEST_DIR/$$.actual"
22 actual_err
="$MH_TEST_DIR/$$.actual_err"
24 cat > "${MH_TEST_DIR}/test.mbox" <<EOF
25 From nobody@nowhereville Jan 1 1970
26 Received: I am the very model of a modern Major-General,
27 Received: I've information vegetable, animal, and mineral,
28 Received: I know the kings of England, and I quote the fights historical
29 Received: From Marathon to Waterloo, in order categorical;
30 Received: I'm very well acquainted, too, with matters mathematical,
31 Received: I understand equations, both the simple and quadratical,
32 Received: About binomial theorem I'm teeming with a lot o' news,
33 Received: With many cheerful facts about the square of the hypotenuse.
34 Received: I'm very good at integral and differential calculus;
35 Received: I know the scientific names of beings animalculous:
36 Received: In short, in matters vegetable, animal, and mineral,
37 Received: I am the very model of a modern Major-General.
38 Received: I know our mythic history, King Arthur's and Sir Caradoc's;
39 Received: I answer hard acrostics, I've a pretty taste for paradox,
40 Received: I quote in elegiacs all the crimes of Heliogabalus,
41 Received: In conics I can floor peculiarities parabolous;
42 Received: I can tell undoubted Raphaels from Gerard Dows and Zoffanies,
43 Received: I know the croaking chorus from The Frogs of Aristophanes!
44 Received: Then I can hum a fugue of which I've heard the music's din afore,c
45 Received: And whistle all the airs from that infernal nonsense Pinafore.
46 Received: Then I can write a washing bill in Babylonic cuneiform,
47 Received: And tell you ev'ry detail of Caractacus's uniform:d
48 Received: In short, in matters vegetable, animal, and mineral,
49 Received: I am the very model of a modern Major-General.
50 Received: In fact, when I know what is meant by "mamelon" and "ravelin",
51 Received: When I can tell at sight a Mauser rifle from a Javelin,
52 Received: When such affairs as sorties and surprises I'm more wary at,
53 Received: And when I know precisely what is meant by "commissariat",
54 Received: When I have learnt what progress has been made in modern gunnery,
55 Received: When I know more of tactics than a novice in a nunnery—
56 Received: In short, when I've a smattering of elemental strategy—
57 Received: You'll say a better Major-General has never sat a gee.
58 Received: For my military knowledge, though I'm plucky and adventury,
59 Received: Has only been brought down to the beginning of the century;
60 Received: But still, in matters vegetable, animal, and mineral,
61 Received: I am the very model of a modern Major-General.
62 Received: For the Angel of Death spread his wings on the blast,
63 Received: And breathed in the face of the foe as he passed:
64 Received: the eyes of the sleepers waxed deadly and chill,
65 Received: And their hearts but once heaved, and for ever grew still!
66 Received: Abbott: Strange as it may seem, they give ball players nowadays very peculiar names.
67 Received: Costello: Funny names?
68 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--
69 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.
70 Received: Abbott: I'm telling you. Who's on first, What's on second, I Don't Know is on third--
71 Received: Costello: You know the fellows' names?
72 Received: Abbott: Yes.
73 Received: Costello: Well, then who's playing first?
74 Received: Abbott: Yes.
75 Received: Costello: I mean the fellow's name on first base.
76 Received: Abbott: Who.
77 Received: Costello: The fellow playin' first base.
78 Received: Abbott: Who.
79 Received: Costello: The guy on first base.
80 Received: Abbott: Who is on first.
81 Received: Costello: Well, what are you askin' me for?
82 Received: Abbott: I'm not asking you--I'm telling you. Who is on first.
83 Received: Costello: I'm asking you--who's on first?
84 Received: Abbott: That's the man's name.
85 Received: Costello: That's who's name?
86 Received: Abbott: Yes.
87 Received: Costello: When you pay off the first baseman every month, who gets the money?
88 X-Spam-Source: Definitely spam! Seriously!
89 From: Mr Nobody <nobody1@example.com>
90 To: Another Nobody <nobody2@example.com>
91 Date: Thu, 1 Mar 2012 01:02:03 -0500
92 Subject: Who is on first?
94 Abbott: Every dollar of it. And why not, the man's entitled to it.
97 Costello: So who gets it?
98 Abbott: Why shouldn't he? Sometimes his wife comes down and collects it.
100 Abbott: Yes. After all, the man earns it.
103 Costello: Well, all I'm trying to find out is what's the guy's name on first base?
104 Abbott: Oh, no, no. What is on second base.
105 Costello: I'm not asking you who's on second.
106 Abbott: Who's on first!
109 cat > "${MH_TEST_DIR}/test.mbox.2" <<EOF
110 Received: I am the very model of a modern Major-General,
111 Received: I've information vegetable, animal, and mineral,
112 Received: I know the kings of England, and I quote the fights historical
113 Received: From Marathon to Waterloo, in order categorical;
114 Received: I'm very well acquainted, too, with matters mathematical,
115 Received: I understand equations, both the simple and quadratical,
116 Received: About binomial theorem I'm teeming with a lot o' news,
117 Received: With many cheerful facts about the square of the hypotenuse.
118 Received: I'm very good at integral and differential calculus;
119 Received: I know the scientific names of beings animalculous:
120 Received: In short, in matters vegetable, animal, and mineral,
121 Received: I am the very model of a modern Major-General.
122 Received: I know our mythic history, King Arthur's and Sir Caradoc's;
123 Received: I answer hard acrostics, I've a pretty taste for paradox,
124 Received: I quote in elegiacs all the crimes of Heliogabalus,
125 Received: In conics I can floor peculiarities parabolous;
126 Received: I can tell undoubted Raphaels from Gerard Dows and Zoffanies,
127 Received: I know the croaking chorus from The Frogs of Aristophanes!
128 Received: Then I can hum a fugue of which I've heard the music's din afore,c
129 Received: And whistle all the airs from that infernal nonsense Pinafore.
130 Received: Then I can write a washing bill in Babylonic cuneiform,
131 Received: And tell you ev'ry detail of Caractacus's uniform:d
132 Received: In short, in matters vegetable, animal, and mineral,
133 Received: I am the very model of a modern Major-General.
134 Received: In fact, when I know what is meant by "mamelon" and "ravelin",
135 Received: When I can tell at sight a Mauser rifle from a Javelin,
136 Received: When such affairs as sorties and surprises I'm more wary at,
137 Received: And when I know precisely what is meant by "commissariat",
138 Received: When I have learnt what progress has been made in modern gunnery,
139 Received: When I know more of tactics than a novice in a nunnery—
140 Received: In short, when I've a smattering of elemental strategy—
141 Received: You'll say a better Major-General has never sat a gee.
142 Received: For my military knowledge, though I'm plucky and adventury,
143 Received: Has only been brought down to the beginning of the century;
144 Received: But still, in matters vegetable, animal, and mineral,
145 Received: I am the very model of a modern Major-General.
146 Received: For the Angel of Death spread his wings on the blast,
147 Received: And breathed in the face of the foe as he passed:
148 Received: the eyes of the sleepers waxed deadly and chill,
149 Received: And their hearts but once heaved, and for ever grew still!
150 Received: Abbott: Strange as it may seem, they give ball players nowadays very peculiar names.
151 Received: Costello: Funny names?
152 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--
153 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.
154 Received: Abbott: I'm telling you. Who's on first, What's on second, I Don't Know is on third--
155 Received: Costello: You know the fellows' names?
156 Received: Abbott: Yes.
157 Received: Costello: Well, then who's playing first?
158 Received: Abbott: Yes.
159 Received: Costello: I mean the fellow's name on first base.
160 Received: Abbott: Who.
161 Received: Costello: The fellow playin' first base.
162 Received: Abbott: Who.
163 Received: Costello: The guy on first base.
164 Received: Abbott: Who is on first.
165 Received: Costello: Well, what are you askin' me for?
166 Received: Abbott: I'm not asking you--I'm telling you. Who is on first.
167 Received: Costello: I'm asking you--who's on first?
168 Received: Abbott: That's the man's name.
169 Received: Costello: That's who's name?
170 Received: Abbott: Yes.
171 Received: Costello: When you pay off the first baseman every month, who gets the money?
172 X-Spam-Source: Definitely spam! Seriously!
173 From: Mr Nobody <nobody1@example.com>
174 To: Another Nobody <nobody2@example.com>
175 Date: Thu, 1 Mar 2012 01:02:03 -0500
176 Subject: Who is on first?
178 Abbott: Every dollar of it. And why not, the man's entitled to it.
181 Costello: So who gets it?
182 Abbott: Why shouldn't he? Sometimes his wife comes down and collects it.
183 Costello: Who's wife?
184 Abbott: Yes. After all, the man earns it.
187 Costello: Well, all I'm trying to find out is what's the guy's name on first base?
188 Abbott: Oh, no, no. What is on second base.
189 Costello: I'm not asking you who's on second.
190 Abbott: Who's on first!
193 run_test
"inc -file ${MH_TEST_DIR}/test.mbox -width 120 -truncate" \
194 "Incorporating new mail into inbox...
196 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cos"
198 check
`mhpath +inbox 11` "${MH_TEST_DIR}/test.mbox.2" "keep first"
199 rm -f "${MH_TEST_DIR}/test.mbox" "${MH_TEST_DIR}/test.mbox.2"
201 run_test
"scan -width 120 +inbox 11" \
202 " 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cos"
204 # check header field name with ':' character than lands on m_getfld() buffer
205 run_test
"scan -width 60 -file $thisdir/lots_of_headers.txt" \
206 ' 1 01/10 No Such User all that and nothing to say?'
208 cat >"$expected" <<EOF
211 cat >"$expected_err" <<EOF
212 scan: eof encountered in field "Received"
213 ??Format error (message -1) in component 2
216 # check m_getfld() handling of fields with trailing whitespace
217 # Even though header field names aren't supposed to have spaces (RFC
218 # 28220, m_getfld () trims trailing whitespace from them.
219 cat >`mhpath new` <<EOF
220 Date : Sun, 18 Dec 2005 00:52:39 +0100
221 From : foo@example.edu
225 run_test
'scan last' ' 12 12/18 foo@example.edu test'
228 # check m_getfld() handling of empty header field
229 scan
-width 13 -file "$thisdir"/malformed_message.txt
>"$actual" 2>"$actual_err"
231 check
"$expected" "$actual"
232 check
"$expected_err" "$actual_err"