2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 . "$MH_OBJ_DIR/test/common.sh"
19 expected=$MH_TEST_DIR/$$.expected
20 actual=$MH_TEST_DIR/$$.actual
23 # check with no options and no current message
24 run_test 'mhlist' 'mhlist: no cur message'
26 # check with no options and current message
27 folder +inbox 5 > /dev/null
29 msg part type/subtype size description
33 check $expected $actual 'keep first'
36 run_test 'mhlist 5 -noheaders' ' 5 text/plain 25'
39 mhlist -noheaders -headers > $actual 2>&1
40 check $expected $actual 'keep first'
42 # check with folder and current message
43 mhlist +inbox > $actual 2>&1
44 check $expected $actual 'keep first'
46 # check with specified message
47 mhlist 5 > $actual 2>&1
48 check $expected $actual 'keep first'
51 mhlist -file "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
52 check $expected $actual
56 msg part type/subtype size description
59 mhlist -file - < "$MH_TEST_DIR/Mail/inbox/5" > $actual 2>&1
60 check $expected $actual
62 # check message number greater than highest
63 run_test 'mhlist 11' "mhlist: message 11 doesn't exist"
65 # check multiple messages
67 msg part type/subtype size description
71 mhlist 2 8 > $actual 2>&1
72 check $expected $actual
74 # Write message with a text/plain subpart.
77 To: recipient@example.com
78 From: sender@example.com
81 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
84 Content-Type: multipart/related;
85 type="multipart/alternative";
86 boundary="subpart__1.1"
89 Content-Type: text/plain; charset="iso-8859-1"
90 Content-Disposition: attachment; filename="test1"
92 This is the first text/plain part, in a subpart.
97 Content-Type: text/plain; charset="iso-8859-1"
98 Content-Disposition: attachment; filename="test2"
99 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
100 Content-Transfer-Encoding: quoted-printable
102 This is the second text/plain part.
104 ------- =_aaaaaaaaaa0
105 Content-Type: text/plain; charset="iso-8859-1"; name="test3"
106 Content-Disposition: attachment; filename="test3"
108 This is the third text/plain part.
110 ------- =_aaaaaaaaaa0
111 Content-Type: text/plain; charset="iso-8859-1"
112 Content-Disposition: attachment; filename="test4"
113 Content-Transfer-Encoding: base64
115 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
117 ------- =_aaaaaaaaaa0--
121 run_test 'mhlist last -part 3 -noheader' \
122 ' 11 multipart/mixed 936
123 1 multipart/related 180
126 # check -part of a subpart
127 run_test 'mhlist last -part 1.1 -noheader' \
128 ' 11 multipart/mixed 936
129 1 multipart/related 180
133 run_test 'mhlist last -type text/plain -noheader' \
134 ' 11 multipart/mixed 936
135 1 multipart/related 180
142 run_test 'mhlist last -part 4 -noheader -norealsize' \
143 ' 11 multipart/mixed 936
144 1 multipart/related 180
147 # check -realsize, the default
148 run_test 'mhlist last -part 4 -noheader -norealsize -realsize' \
149 ' 11 multipart/mixed 936
150 1 multipart/related 180
154 run_test 'mhlist last -part 2 -noheader -check' \
155 ' 11 multipart/mixed 936
156 1 multipart/related 180
159 # check -check with bad MD5 checksum
160 sed 's/\(Content-MD5: \)kq+Hnc/\1BADBAD/' $msgfile > $MH_TEST_DIR/$$.tmp
161 mv -f $MH_TEST_DIR/$$.tmp $msgfile
162 run_test 'mhlist last -part 2 -noheader -check' \
163 ' 11 multipart/mixed 936
164 1 multipart/related 180
166 mhlist: content integrity suspect (digest mismatch) -- continuing
167 (content text/plain in message 11, part 2)'
169 # check -nocheck, the default
170 run_test 'mhlist last -part 2 -noheader -check -nocheck' \
171 ' 11 multipart/mixed 936
172 1 multipart/related 180
176 run_test 'mhlist 11 -verbose -noheader' \
177 ' 11 multipart/mixed 936
178 boundary="----- =_aaaaaaaaaa0"
179 1 multipart/related 180
180 type="multipart/alternative"
181 boundary="subpart__1.1"
190 charset="iso-8859-1"'