]>
diplodocus.org Git - nmh/blob - test/mhshow/test-textcharset
2 ##########################################################
4 # Test display of text/plain parts with charset conversion
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 if test "$ICONV_ENABLED" -eq 0; then
20 test_skip
'test-textcharset requires that nmh have been built with iconv'
23 LC_ALL
=en_US.UTF
-8; export LC_ALL
25 expected
="$MH_TEST_DIR"/$$.expected
26 actual
="$MH_TEST_DIR"/$$.actual
28 # check charset conversion
30 cat >"$msgfile" <<'EOF'
33 Subject: test display with charset conversion
35 Content-Type: text/plain; charset=windows-1252
36 Content-Transfer-Encoding: quoted-printable
37 Date: Sun, 18 Dec 2005 00:52:39 +0100
42 cat >"$expected" <<'EOF'
43 Date: Sun, 18 Dec 2005 00:52:39 +0100
46 Subject: test display with charset conversion
54 run_prog mhshow
-nopause last
>"$actual" 2>&1
55 check
"$expected" "$actual"
58 mhshow-show-text/plain: echo %{charset}
62 # check expansion of %{charset} by itself
64 cat >"$msgfile" <<'EOF'
67 Subject: test display with %{charset} expansion
69 Content-Type: text/plain; charset=windows-1252
70 Content-Transfer-Encoding: quoted-printable
71 Date: Sun, 18 Dec 2005 00:52:39 +0100
76 cat >"$expected" <<'EOF'
77 Date: Sun, 18 Dec 2005 00:52:39 +0100
80 Subject: test display with %{charset} expansion
87 run_prog mhshow
-nopause last
>"$actual" 2>&1
88 check
"$expected" "$actual"
91 # check expansion of empty %{charset} by itself
93 cat >"$msgfile" <<'EOF'
96 Subject: test display with empty %{charset} expansion
98 Content-Type: text/plain
99 Content-Transfer-Encoding: quoted-printable
100 Date: Sun, 18 Dec 2005 00:52:39 +0100
105 cat >"$expected" <<'EOF'
106 Date: Sun, 18 Dec 2005 00:52:39 +0100
108 From: foo@example.edu
109 Subject: test display with empty %{charset} expansion
116 run_prog mhshow
-nopause last
>"$actual" 2>&1
117 check
"$expected" "$actual"
120 grep -v 'mhshow-show-text/plain:' "$MH" >"$MH.new"
121 mv -f "$MH.new" "$MH"
123 mhshow-show-text/plain: charset=%{charset}; echo ${charset:+-I $charset}
126 # check expansion of embedded %{charset} with no text following
127 cat >"$expected" <<'EOF'
128 Date: Sun, 18 Dec 2005 00:52:39 +0100
130 From: foo@example.edu
131 Subject: test display with %{charset} expansion
138 run_prog mhshow
-nopause prev
>"$actual" 2>&1
139 check
"$expected" "$actual"
142 # check expansion of empty embedded %{charset} with no text following
143 cat >"$expected" <<'EOF'
144 Date: Sun, 18 Dec 2005 00:52:39 +0100
146 From: foo@example.edu
147 Subject: test display with empty %{charset} expansion
154 run_prog mhshow
-nopause last
>"$actual" 2>&1
155 check
"$expected" "$actual"
158 sed -e 's%\(mhshow-show-text/plain:.*\)%\1 file%' "$MH" >"$MH.new"
159 mv -f "$MH.new" "$MH"
161 # check expansion of embedded %{charset} with text following
162 cat >"$expected" <<'EOF'
163 Date: Sun, 18 Dec 2005 00:52:39 +0100
165 From: foo@example.edu
166 Subject: test display with %{charset} expansion
173 run_prog mhshow
-nopause prev
>"$actual" 2>&1
174 check
"$expected" "$actual"
177 # check expansion of empty embedded %{charset} with text following
178 cat >"$expected" <<'EOF'
179 Date: Sun, 18 Dec 2005 00:52:39 +0100
181 From: foo@example.edu
182 Subject: test display with empty %{charset} expansion
189 run_prog mhshow
-nopause last
>"$actual" 2>&1
190 check
"$expected" "$actual"
193 sed -e 's/charset/method/g' "$MH" >"$MH.new"
194 mv -f "$MH.new" "$MH"
196 # check parameter value quoting
198 cat >"$msgfile" <<'EOF'
199 From: foo@example.edu
201 Subject: test C-T parameter expansion quoting
203 Content-Type: text/plain; method=$QUOTEME'
204 Content-Transfer-Encoding: quoted-printable
205 Date: Sun, 18 Dec 2005 00:52:39 +0100
210 cat >"$expected" <<'EOF'
211 Date: Sun, 18 Dec 2005 00:52:39 +0100
213 From: foo@example.edu
214 Subject: test C-T parameter expansion quoting
221 run_prog mhshow
-nopause last
>"$actual" 2>&1
222 check
"$expected" "$actual"
225 sed -e 's/method/unknown/g' "$MH" >"$MH.new"
226 mv -f "$MH.new" "$MH"
228 # check that unknown parameter is not expanded
230 cat >"$msgfile" <<'EOF'
231 From: foo@example.edu
233 Subject: test display with unknown C-T parameter expansion
235 Content-Type: text/plain; charset=windows-1252
236 Content-Transfer-Encoding: quoted-printable
237 Date: Sun, 18 Dec 2005 00:52:39 +0100
242 cat >"$expected" <<'EOF'
243 Date: Sun, 18 Dec 2005 00:52:39 +0100
245 From: foo@example.edu
246 Subject: test display with unknown C-T parameter expansion
253 run_prog mhshow
-nopause last
>"$actual" 2>&1
254 check
"$expected" "$actual"
257 grep -v '^mhshow-show-text/plain: ' "$MH" >>"$MH.new"
258 mv -f "$MH.new" "$MH"
260 mhshow-show-text/plain: true '%F' %F
263 # check parameter value quoting with text following
265 cat >"$msgfile" <<'EOF'
266 From: foo@example.edu
268 Subject: check parameter value quoting with text following
270 Content-Type: text/plain
271 Date: Sun, 18 Dec 2005 00:52:39 +0100
276 cat >"$expected" <<'EOF'
277 Date: Sun, 18 Dec 2005 00:52:39 +0100
279 From: foo@example.edu
280 Subject: check parameter value quoting with text following
286 run_prog mhshow
-nopause last
>"$actual" 2>&1
287 check
"$expected" "$actual"