Added -check/-nocheck switches to sortm(1). Also removed obsolete
[mmh] / 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 cat > "${MH_TEST_DIR}/test.mbox" <<EOF
19 From nobody@nowhereville Jan 1 1970
20 Received: I am the very model of a modern Major-General,
21 Received: I've information vegetable, animal, and mineral,
22 Received: I know the kings of England, and I quote the fights historical
23 Received: From Marathon to Waterloo, in order categorical;
24 Received: I'm very well acquainted, too, with matters mathematical,
25 Received: I understand equations, both the simple and quadratical,
26 Received: About binomial theorem I'm teeming with a lot o' news,
27 Received: With many cheerful facts about the square of the hypotenuse.
28 Received: I'm very good at integral and differential calculus;
29 Received: I know the scientific names of beings animalculous:
30 Received: In short, in matters vegetable, animal, and mineral,
31 Received: I am the very model of a modern Major-General.
32 Received: I know our mythic history, King Arthur's and Sir Caradoc's;
33 Received: I answer hard acrostics, I've a pretty taste for paradox,
34 Received: I quote in elegiacs all the crimes of Heliogabalus,
35 Received: In conics I can floor peculiarities parabolous;
36 Received: I can tell undoubted Raphaels from Gerard Dows and Zoffanies,
37 Received: I know the croaking chorus from The Frogs of Aristophanes!
38 Received: Then I can hum a fugue of which I've heard the music's din afore,c
39 Received: And whistle all the airs from that infernal nonsense Pinafore.
40 Received: Then I can write a washing bill in Babylonic cuneiform,
41 Received: And tell you ev'ry detail of Caractacus's uniform:d
42 Received: In short, in matters vegetable, animal, and mineral,
43 Received: I am the very model of a modern Major-General.
44 Received: In fact, when I know what is meant by "mamelon" and "ravelin",
45 Received: When I can tell at sight a Mauser rifle from a Javelin,
46 Received: When such affairs as sorties and surprises I'm more wary at,
47 Received: And when I know precisely what is meant by "commissariat",
48 Received: When I have learnt what progress has been made in modern gunnery,
49 Received: When I know more of tactics than a novice in a nunnery—
50 Received: In short, when I've a smattering of elemental strategy—
51 Received: You'll say a better Major-General has never sat a gee.
52 Received: For my military knowledge, though I'm plucky and adventury,
53 Received: Has only been brought down to the beginning of the century;
54 Received: But still, in matters vegetable, animal, and mineral,
55 Received: I am the very model of a modern Major-General. 
56 Received: For the Angel of Death spread his wings on the blast,
57 Received: And breathed in the face of the foe as he passed:
58 Received: the eyes of the sleepers waxed deadly and chill,
59 Received: And their hearts but once heaved, and for ever grew still!
60 Received: Abbott: Strange as it may seem, they give ball players nowadays very peculiar names.
61 Received: Costello: Funny names?
62 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--
63 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.
64 Received: Abbott: I'm telling you. Who's on first, What's on second, I Don't Know is on third--
65 Received: Costello: You know the fellows' names?
66 Received: Abbott: Yes.
67 Received: Costello: Well, then who's playing first?
68 Received: Abbott: Yes.
69 Received: Costello: I mean the fellow's name on first base.
70 Received: Abbott: Who.
71 Received: Costello: The fellow playin' first base.
72 Received: Abbott: Who.
73 Received: Costello: The guy on first base.
74 Received: Abbott: Who is on first.
75 Received: Costello: Well, what are you askin' me for?
76 Received: Abbott: I'm not asking you--I'm telling you. Who is on first.
77 Received: Costello: I'm asking you--who's on first?
78 Received: Abbott: That's the man's name.
79 Received: Costello: That's who's name?
80 Received: Abbott: Yes.
81 Received: Costello: When you pay off the first baseman every month, who gets the money?
82 X-Spam-Source: Definitely spam!  Seriously!
83 From: Mr Nobody <nobody1@example.com>
84 To: Another Nobody <nobody2@example.com>
85 Date: Thu, 1 Mar 2012 01:02:03 -0500
86 Subject: Who is on first?
87
88 Abbott: Every dollar of it. And why not, the man's entitled to it.
89 Costello: Who is?
90 Abbott: Yes.
91 Costello: So who gets it?
92 Abbott: Why shouldn't he? Sometimes his wife comes down and collects it.
93 Costello: Who's wife?
94 Abbott: Yes. After all, the man earns it.
95 Costello: Who does?
96 Abbott: Absolutely.
97 Costello: Well, all I'm trying to find out is what's the guy's name on first base?
98 Abbott: Oh, no, no. What is on second base.
99 Costello: I'm not asking you who's on second.
100 Abbott: Who's on first!
101 EOF
102
103 cat > "${MH_TEST_DIR}/test.mbox.2" <<EOF
104 Received: I am the very model of a modern Major-General,
105 Received: I've information vegetable, animal, and mineral,
106 Received: I know the kings of England, and I quote the fights historical
107 Received: From Marathon to Waterloo, in order categorical;
108 Received: I'm very well acquainted, too, with matters mathematical,
109 Received: I understand equations, both the simple and quadratical,
110 Received: About binomial theorem I'm teeming with a lot o' news,
111 Received: With many cheerful facts about the square of the hypotenuse.
112 Received: I'm very good at integral and differential calculus;
113 Received: I know the scientific names of beings animalculous:
114 Received: In short, in matters vegetable, animal, and mineral,
115 Received: I am the very model of a modern Major-General.
116 Received: I know our mythic history, King Arthur's and Sir Caradoc's;
117 Received: I answer hard acrostics, I've a pretty taste for paradox,
118 Received: I quote in elegiacs all the crimes of Heliogabalus,
119 Received: In conics I can floor peculiarities parabolous;
120 Received: I can tell undoubted Raphaels from Gerard Dows and Zoffanies,
121 Received: I know the croaking chorus from The Frogs of Aristophanes!
122 Received: Then I can hum a fugue of which I've heard the music's din afore,c
123 Received: And whistle all the airs from that infernal nonsense Pinafore.
124 Received: Then I can write a washing bill in Babylonic cuneiform,
125 Received: And tell you ev'ry detail of Caractacus's uniform:d
126 Received: In short, in matters vegetable, animal, and mineral,
127 Received: I am the very model of a modern Major-General.
128 Received: In fact, when I know what is meant by "mamelon" and "ravelin",
129 Received: When I can tell at sight a Mauser rifle from a Javelin,
130 Received: When such affairs as sorties and surprises I'm more wary at,
131 Received: And when I know precisely what is meant by "commissariat",
132 Received: When I have learnt what progress has been made in modern gunnery,
133 Received: When I know more of tactics than a novice in a nunnery—
134 Received: In short, when I've a smattering of elemental strategy—
135 Received: You'll say a better Major-General has never sat a gee.
136 Received: For my military knowledge, though I'm plucky and adventury,
137 Received: Has only been brought down to the beginning of the century;
138 Received: But still, in matters vegetable, animal, and mineral,
139 Received: I am the very model of a modern Major-General. 
140 Received: For the Angel of Death spread his wings on the blast,
141 Received: And breathed in the face of the foe as he passed:
142 Received: the eyes of the sleepers waxed deadly and chill,
143 Received: And their hearts but once heaved, and for ever grew still!
144 Received: Abbott: Strange as it may seem, they give ball players nowadays very peculiar names.
145 Received: Costello: Funny names?
146 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--
147 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.
148 Received: Abbott: I'm telling you. Who's on first, What's on second, I Don't Know is on third--
149 Received: Costello: You know the fellows' names?
150 Received: Abbott: Yes.
151 Received: Costello: Well, then who's playing first?
152 Received: Abbott: Yes.
153 Received: Costello: I mean the fellow's name on first base.
154 Received: Abbott: Who.
155 Received: Costello: The fellow playin' first base.
156 Received: Abbott: Who.
157 Received: Costello: The guy on first base.
158 Received: Abbott: Who is on first.
159 Received: Costello: Well, what are you askin' me for?
160 Received: Abbott: I'm not asking you--I'm telling you. Who is on first.
161 Received: Costello: I'm asking you--who's on first?
162 Received: Abbott: That's the man's name.
163 Received: Costello: That's who's name?
164 Received: Abbott: Yes.
165 Received: Costello: When you pay off the first baseman every month, who gets the money?
166 X-Spam-Source: Definitely spam!  Seriously!
167 From: Mr Nobody <nobody1@example.com>
168 To: Another Nobody <nobody2@example.com>
169 Date: Thu, 1 Mar 2012 01:02:03 -0500
170 Subject: Who is on first?
171
172 Abbott: Every dollar of it. And why not, the man's entitled to it.
173 Costello: Who is?
174 Abbott: Yes.
175 Costello: So who gets it?
176 Abbott: Why shouldn't he? Sometimes his wife comes down and collects it.
177 Costello: Who's wife?
178 Abbott: Yes. After all, the man earns it.
179 Costello: Who does?
180 Abbott: Absolutely.
181 Costello: Well, all I'm trying to find out is what's the guy's name on first base?
182 Abbott: Oh, no, no. What is on second base.
183 Costello: I'm not asking you who's on second.
184 Abbott: Who's on first!
185 EOF
186
187 run_test "inc -file ${MH_TEST_DIR}/test.mbox -width 120 -truncate" \
188         "Incorporating new mail into inbox...
189
190   11+ 03/01 Mr Nobody          Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cos"
191
192 check `mhpath +inbox 11` "${MH_TEST_DIR}/test.mbox.2" "keep first"
193 rm -f "${MH_TEST_DIR}/test.mbox" "${MH_TEST_DIR}/test.mbox.2"
194
195 run_test "scan -width 120 +inbox 11" \
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"
197
198 exit ${failed:-0}