]>
diplodocus.org Git - nmh/blob - test/mhshow/test-subpart
2 ######################################################
4 # Test show of one part, fixed by
5 # 31cba404636730df219dd009ca5893ccc56d46af
7 ######################################################
11 if test -z "${MH_OBJ_DIR}"; then
12 srcdir
=`dirname "$0"`/..
/..
13 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
16 .
"$MH_OBJ_DIR/test/common.sh"
20 expected
=$MH_TEST_DIR/$$.expected
21 actual
=$MH_TEST_DIR/$$.actual
23 mhn_defaults
="$MH_INST_DIR${nmhetcdir}/mhn.defaults"
25 if grep mhfixmsg
-format-text/html
"${mhn_defaults}" >/dev
/null
; then
26 can_reformat_texthtml
=1
27 if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \
29 #### w3m uses $HOME/.w3m/, and creates it if it doesn't exist. To
30 #### support testing with non-writeable $HOME, and to not leave
31 #### relics from this test if it is writeable but doesn't already
32 #### have a .w3m, and to not depend on whatever is in that if it
33 #### does already exist, overwrite $HOME if using w3m.
34 HOME
="$MHTMPDIR"; export HOME
37 echo "$0: skipping html checks because no text browser was found"
38 can_reformat_texthtml
=0
41 # Write message with a text/plain subpart.
43 msgnum
=`basename $msgfile`
46 Content-Type: multipart/mixed; boundary="NextPart_001"
47 Content-class: urn:content-classes:message
48 Date: Thu, 19 May 2011 00:00:00 -0000
49 From: sender@example.com
50 To: recipient@example.com
52 This is a multi-part message in MIME format.
55 Content-Type: multipart/related;
56 type="multipart/alternative";
57 boundary="NextPart_002"
60 Content-Type: text/plain;
63 This is the text/plain part.
70 # Write the expected output.
73 [ part 1.1 - text/plain - 29B ]
74 This is the text/plain part.
78 start_test
'text/plain part'
79 run_prog mhshow
-part 1.1 -form mhl.null
$msgnum > $actual 2>&1
80 check
"$expected" "$actual" : part
1.1
83 # tests of -part/-type/-prefer
86 To: example@example.org
87 From: someone <someone@example.com>
88 Subject: mhshow -part/-type/-prefer test
89 Date: Thu, 29 Jan 2015 18:12:21 +0000 (GMT)
90 Content-Type: multipart/mixed; boundary="BoundaryMixed"
93 Content-type: multipart/alternative;
94 boundary="BoundaryAlternative1"
96 --BoundaryAlternative1
97 Content-type: text/plain; charset=US-ASCII; format=flowed
98 Content-transfer-encoding: 8bit
100 This is the body text/plain part.
101 --BoundaryAlternative1
102 Content-type: multipart/related;
103 boundary="BoundaryAlternative2"; type="text/html"
105 --BoundaryAlternative2
106 Content-type: text/html; CHARSET=US-ASCII
107 Content-transfer-encoding: quoted-printable
109 <html><body><div><span style=3D"line-height: 1.5;">
110 This is the text/html body part.
111 </span></div></body></html>
113 --BoundaryAlternative2--
115 --BoundaryAlternative1--
118 Content-Type: text/plain; charset="us-ascii"
120 Content-Transfer-Encoding: 7bit
121 Content-Disposition: inline
123 _______________________________________________
124 This is the final text/plain signature part.
129 # Write the expected output.
130 if [ $can_reformat_texthtml -eq 1 ]; then
131 cat > $expected <<EOF
133 [ part 1.1.1 - text/html - 111B ]
134 This is the text/html body part.
138 start_test
'text/html part'
139 # The sed command removes blank lines and leading space that lynx inserts.
140 run_prog mhshow
-part 1.1.1 -form mhl.null
$msgnum |
141 sed '/^$/D; s/^ *//;' > $actual 2>&1
142 check
"$expected" "$actual" : part
1.1.1
145 # Write the expected output.
146 cat > $expected <<EOF
148 [ part 1.2 - text/plain - 33B ]
149 This is the body text/plain part.
153 start_test
'text/plain alternative part'
154 run_prog mhshow
-part 1.2 -form mhl.null
$msgnum > $actual 2>&1
155 check
"$expected" "$actual" : part
1.2
157 # Write the expected output.
158 cat > $expected <<EOF
160 [ part 1.1 - text/plain - 33B ]
161 This is the body text/plain part.
165 start_test
'conflicting text/plain, part 1 switches'
166 run_prog mhshow
-prefer text
/plain
-part 1 -form mhl.null
$msgnum > $actual 2>&1
167 check
"$expected" "$actual" : part conflicting text
/plain
, part
1 switches
169 # Write the expected output.
170 cat > $expected <<EOF
172 [ part 2 - text/plain - 93B ]
173 _______________________________________________
174 This is the final text/plain signature part.
178 start_test
'final text/plain part'
179 run_prog mhshow
-part 2 -form mhl.null
$msgnum > $actual 2>&1
180 check
"$expected" "$actual" : part
2
182 # Write the expected output.
183 cat > $expected <<EOF
185 [ part 1.2 - text/plain - 33B ]
186 This is the body text/plain part.
187 [ part 2 - text/plain - 93B ]
188 _______________________________________________
189 This is the final text/plain signature part.
193 start_test
'all text/plain parts'
194 run_prog mhshow
-type text
/plain
-form mhl.null
$msgnum > $actual 2>&1
195 check
"$expected" "$actual" : type text
/plain
197 # Write the expected output.
198 cat > $expected <<EOF
200 [ part 1.1 - text/plain - 33B ]
201 This is the body text/plain part.
202 [ part 2 - text/plain - 93B ]
203 _______________________________________________
204 This is the final text/plain signature part.
207 start_test
'prefer text/plain'
208 run_prog mhshow
-prefer text
/plain
-form mhl.null
$msgnum > $actual 2>&1
209 check
"$expected" "$actual" : prefer text
/plain