]>
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 run_prog mhshow
-part 1.1.1 -form mhl.null
$msgnum 2>&1 |
140 squeeze_whitespace
>$actual
141 check
"$expected" "$actual" : part
1.1.1
144 # Write the expected output.
145 cat > $expected <<EOF
147 [ part 1.2 - text/plain - 33B ]
148 This is the body text/plain part.
152 start_test
'text/plain alternative part'
153 run_prog mhshow
-part 1.2 -form mhl.null
$msgnum > $actual 2>&1
154 check
"$expected" "$actual" : part
1.2
156 # Write the expected output.
157 cat > $expected <<EOF
159 [ part 1.1 - text/plain - 33B ]
160 This is the body text/plain part.
164 start_test
'conflicting text/plain, part 1 switches'
165 run_prog mhshow
-prefer text
/plain
-part 1 -form mhl.null
$msgnum > $actual 2>&1
166 check
"$expected" "$actual" : part conflicting text
/plain
, part
1 switches
168 # Write the expected output.
169 cat > $expected <<EOF
171 [ part 2 - text/plain - 93B ]
172 _______________________________________________
173 This is the final text/plain signature part.
177 start_test
'final text/plain part'
178 run_prog mhshow
-part 2 -form mhl.null
$msgnum > $actual 2>&1
179 check
"$expected" "$actual" : part
2
181 # Write the expected output.
182 cat > $expected <<EOF
184 [ part 1.2 - text/plain - 33B ]
185 This is the body text/plain part.
186 [ part 2 - text/plain - 93B ]
187 _______________________________________________
188 This is the final text/plain signature part.
192 start_test
'all text/plain parts'
193 run_prog mhshow
-type text
/plain
-form mhl.null
$msgnum > $actual 2>&1
194 check
"$expected" "$actual" : type text
/plain
196 # Write the expected output.
197 cat > $expected <<EOF
199 [ part 1.1 - text/plain - 33B ]
200 This is the body text/plain part.
201 [ part 2 - text/plain - 93B ]
202 _______________________________________________
203 This is the final text/plain signature part.
206 start_test
'prefer text/plain'
207 run_prog mhshow
-prefer text
/plain
-form mhl.null
$msgnum > $actual 2>&1
208 check
"$expected" "$actual" : prefer text
/plain