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 # Write message with a text/plain subpart.
25 msgnum=`basename $msgfile`
28 Content-Type: multipart/mixed; boundary="NextPart_001"
29 Content-class: urn:content-classes:message
30 Date: Thu, 19 May 2011 00:00:00 -0000
31 From: sender@example.com
32 To: recipient@example.com
34 This is a multi-part message in MIME format.
37 Content-Type: multipart/related;
38 type="multipart/alternative";
39 boundary="NextPart_002"
42 Content-Type: text/plain;
45 This is the text/plain part.
52 # Write the expected output.
55 [ part 1.1 - text/plain - 29B ]
56 This is the text/plain part.
60 run_prog mhshow -part 1.1 -form mhl.null $msgnum > $actual 2>&1
61 check "$expected" "$actual" : part 1.1
64 # tests of -part/-type/-prefer
67 To: example@example.org
68 From: someone <someone@example.com>
69 Subject: mhshow -part/-type/-prefer test
70 Date: Thu, 29 Jan 2015 18:12:21 +0000 (GMT)
71 Content-Type: multipart/mixed; boundary="BoundaryMixed"
74 Content-type: multipart/alternative;
75 boundary="BoundaryAlternative1"
77 --BoundaryAlternative1
78 Content-type: text/plain; charset=US-ASCII; format=flowed
79 Content-transfer-encoding: 8bit
81 This is the body text/plain part.
82 --BoundaryAlternative1
83 Content-type: multipart/related;
84 boundary="BoundaryAlternative2"; type="text/html"
86 --BoundaryAlternative2
87 Content-type: text/html; CHARSET=US-ASCII
88 Content-transfer-encoding: quoted-printable
90 <html><body><div><span style=3D"line-height: 1.5;">
91 This is the text/html body part.
92 </span></div></body></html>
94 --BoundaryAlternative2--
96 --BoundaryAlternative1--
99 Content-Type: text/plain; charset="us-ascii"
101 Content-Transfer-Encoding: 7bit
102 Content-Disposition: inline
104 _______________________________________________
105 This is the final text/plain signature part.
110 # Write the expected output.
111 cat > $expected <<EOF
113 [ part 1.1.1 - text/html - 111B ]
114 This is the text/html body part.
118 # The sed command removes blank lines and leading space that lynx inserts.
119 run_prog mhshow -part 1.1.1 -form mhl.null $msgnum |
120 sed '/^$/D; s/^ *//;' > $actual 2>&1
121 check "$expected" "$actual" : part 1.1.1
123 # Write the expected output.
124 cat > $expected <<EOF
126 [ part 1.2 - text/plain - 33B ]
127 This is the body text/plain part.
131 run_prog mhshow -part 1.2 -form mhl.null $msgnum > $actual 2>&1
132 check "$expected" "$actual" : part 1.2
134 # Write the expected output.
135 cat > $expected <<EOF
137 [ part 1.1 - text/plain - 33B ]
138 This is the body text/plain part.
142 run_prog mhshow -prefer text/plain -part 1 -form mhl.null $msgnum > $actual 2>&1
143 check "$expected" "$actual" : part conflicting text/plain, part 1 switches
145 # Write the expected output.
146 cat > $expected <<EOF
148 [ part 2 - text/plain - 93B ]
149 _______________________________________________
150 This is the final text/plain signature part.
154 run_prog mhshow -part 2 -form mhl.null $msgnum > $actual 2>&1
155 check "$expected" "$actual" : part 2
157 # Write the expected output.
158 cat > $expected <<EOF
160 [ part 1.2 - text/plain - 33B ]
161 This is the body text/plain part.
162 [ part 2 - text/plain - 93B ]
163 _______________________________________________
164 This is the final text/plain signature part.
168 run_prog mhshow -type text/plain -form mhl.null $msgnum > $actual 2>&1
169 check "$expected" "$actual" : type text/plain
171 # Write the expected output.
172 cat > $expected <<EOF
174 [ part 1.1 - text/plain - 33B ]
175 This is the body text/plain part.
176 [ part 2 - text/plain - 93B ]
177 _______________________________________________
178 This is the final text/plain signature part.
181 run_prog mhshow -prefer text/plain -form mhl.null $msgnum > $actual 2>&1
182 check "$expected" "$actual" : prefer text/plain