]> diplodocus.org Git - nmh/blob - test/burst/test-burst
dtimep.l: Delete unused macros SKIPSP and SKIPTOSP.
[nmh] / test / burst / test-burst
1 #!/bin/sh
2 #
3 # Tests to see if bursting messages works correctly.
4 #
5
6 if test -z "${MH_OBJ_DIR}"; then
7 srcdir=`dirname "$0"`/../..
8 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
9 fi
10
11 . "${MH_OBJ_DIR}/test/common.sh"
12
13 setup_test
14
15 check_exit '-eq 1' burst -
16 check_exit '-eq 0' burst -help
17 check_exit '-eq 1' burst -xyzzy
18 check_exit '-eq 0' burst -version
19 check_exit '-eq 1' burst -inplace -noinplace
20 check_exit '-eq 1' burst -mime -automime -nomime
21 check_exit '-eq 1' burst -quiet -noquiet
22 check_exit '-eq 1' burst -verbose -noverbose
23 check_exit '-eq 1' burst + @
24
25 #
26 # Create a test message that we can burst
27 #
28
29 cat > "${MH_TEST_DIR}/Mail/inbox/11" <<EOF
30 From: Test Burst Message <burst1@example.com>
31 To: Test Recipient <recipient@example.com>
32 Date: Friday, 29 Sep 2006 00:00:00
33 Subject: Test digest
34
35 ------- Message one
36
37 From: Mister Burster <burst2@example.com>
38 To: Nobody 1 <nobody1@example.com>
39 Date: Thursday, 28 Sep 2006 00:01:00
40 Subject: Message one
41
42 This is message one
43
44 ------- Message two
45
46 From: Mister Burster <burst3@example.com>
47 To: Nobody 2 <nobody2@example.com>
48 Date: Thursday, 28 Sep 2006 00:02:00
49 Subject: Message two
50
51 This is message two
52 For real.
53
54 -------
55
56 End of all messages
57 EOF
58
59 run_prog burst 11 || exit
60
61 run_test 'scan -width 80 11-last' "\
62 11 09/29 Test Burst Messag Test digest<<------- Message one From: Mister Bur
63 12+ 09/28 Mister Burster Message one<<This is message one >>
64 13 09/28 Mister Burster Message two<<This is message two For real. >>"
65
66 #
67 # Create another test message that stresses the boundary checker a bit
68 #
69
70 cat > "${MH_TEST_DIR}/Mail/inbox/14" <<EOF
71 From: Test Burst Message <burst1@example.com>
72 To: Test Recipient <recipient@example.com>
73 Date: Friday, 29 Sep 2006 00:00:00
74 Subject: Test digest
75
76 This is a preamble
77 ------- Message one
78
79 From: Mister Burster <burst2@example.com>
80 To: Nobody 1 <nobody1@example.com>
81 Date: Thursday, 28 Sep 2006 00:01:00
82 Subject: Message one
83
84 - -This is message one
85
86 ------- Message two
87 From: Mister Burster <burst3@example.com>
88 To: Nobody 2 <nobody2@example.com>
89 Date: Thursday, 28 Sep 2006 00:02:00
90 Subject: Message two
91
92 This is message two
93 - For real.
94 ------- Message three
95
96
97
98 From: Mister Burster <burst4@example.com>
99 To: Nobody 3 <nobody3@example.com>
100 Date: Thursday, 28 Sep 2006 00:03:00
101 Subject: Message three
102
103 Will this one work?
104
105
106 ------ Message three
107 End of all messages
108 EOF
109
110 run_prog burst 14 || exit
111
112 run_test 'scan -width 80 14-last' "\
113 14 09/29 Test Burst Messag Test digest<<This is a preamble ------- Message o
114 15+ 09/28 Mister Burster Message one<<-This is message one >>
115 16 09/28 Mister Burster Message two<<This is message two For real. >>
116 17 09/28 Mister Burster Message three<<Will this one work? >>"
117
118 #
119 # Check to see if each message is what we expect
120 #
121
122 run_test 'show -noheader -noshow 15' \
123 "From: Mister Burster <burst2@example.com>
124 To: Nobody 1 <nobody1@example.com>
125 Date: Thursday, 28 Sep 2006 00:01:00
126 Subject: Message one
127
128 -This is message one"
129
130 run_test 'show -noheader -noshow 16' \
131 "From: Mister Burster <burst3@example.com>
132 To: Nobody 2 <nobody2@example.com>
133 Date: Thursday, 28 Sep 2006 00:02:00
134 Subject: Message two
135
136 This is message two
137 For real."
138
139 #
140 # Backticks used by run_test can consume blank lines at the end of the
141 # command output, so use check for this one.
142 #
143
144 expected="${MH_TEST_DIR}/$$.expected"
145 cat > "${expected}" <<EOF
146 From: Mister Burster <burst4@example.com>
147 To: Nobody 3 <nobody3@example.com>
148 Date: Thursday, 28 Sep 2006 00:03:00
149 Subject: Message three
150
151 Will this one work?
152
153 EOF
154
155 check "${expected}" `mhpath 17`
156
157 exit $failed