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}
61 # check expansion of %{charset} by itself
63 cat >"$msgfile" <<'EOF'
66 Subject: test display with %{charset} expansion
68 Content-Type: text/plain; charset=windows-1252
69 Content-Transfer-Encoding: quoted-printable
70 Date: Sun, 18 Dec 2005 00:52:39 +0100
75 cat >"$expected" <<'EOF'
76 Date: Sun, 18 Dec 2005 00:52:39 +0100
79 Subject: test display with %{charset} expansion
86 run_prog mhshow -nopause last >"$actual" 2>&1
87 check "$expected" "$actual"
89 # check expansion of empty %{charset} by itself
91 cat >"$msgfile" <<'EOF'
94 Subject: test display with empty %{charset} expansion
96 Content-Type: text/plain
97 Content-Transfer-Encoding: quoted-printable
98 Date: Sun, 18 Dec 2005 00:52:39 +0100
103 cat >"$expected" <<'EOF'
104 Date: Sun, 18 Dec 2005 00:52:39 +0100
106 From: foo@example.edu
107 Subject: test display with empty %{charset} expansion
114 run_prog mhshow -nopause last >"$actual" 2>&1
115 check "$expected" "$actual"
117 grep -v 'mhshow-show-text/plain:' "$MH" >"$MH.new"
118 mv -f "$MH.new" "$MH"
120 mhshow-show-text/plain: charset=%{charset}; echo ${charset:+-I $charset}
123 # check expansion of embedded %{charset} with no text following
124 cat >"$expected" <<'EOF'
125 Date: Sun, 18 Dec 2005 00:52:39 +0100
127 From: foo@example.edu
128 Subject: test display with %{charset} expansion
135 run_prog mhshow -nopause prev >"$actual" 2>&1
136 check "$expected" "$actual"
138 # check expansion of empty embedded %{charset} with no text following
139 cat >"$expected" <<'EOF'
140 Date: Sun, 18 Dec 2005 00:52:39 +0100
142 From: foo@example.edu
143 Subject: test display with empty %{charset} expansion
150 run_prog mhshow -nopause last >"$actual" 2>&1
151 check "$expected" "$actual"
153 sed -e 's%\(mhshow-show-text/plain:.*\)%\1 file%' "$MH" >"$MH.new"
154 mv -f "$MH.new" "$MH"
156 # check expansion of embedded %{charset} with text following
157 cat >"$expected" <<'EOF'
158 Date: Sun, 18 Dec 2005 00:52:39 +0100
160 From: foo@example.edu
161 Subject: test display with %{charset} expansion
168 run_prog mhshow -nopause prev >"$actual" 2>&1
169 check "$expected" "$actual"
171 # check expansion of empty embedded %{charset} with text following
172 cat >"$expected" <<'EOF'
173 Date: Sun, 18 Dec 2005 00:52:39 +0100
175 From: foo@example.edu
176 Subject: test display with empty %{charset} expansion
183 run_prog mhshow -nopause last >"$actual" 2>&1
184 check "$expected" "$actual"
186 sed -e 's/charset/method/g' "$MH" >"$MH.new"
187 mv -f "$MH.new" "$MH"
189 # check parameter value quoting
191 cat >"$msgfile" <<'EOF'
192 From: foo@example.edu
194 Subject: test C-T parameter expansion quoting
196 Content-Type: text/plain; method=$QUOTEME'
197 Content-Transfer-Encoding: quoted-printable
198 Date: Sun, 18 Dec 2005 00:52:39 +0100
203 cat >"$expected" <<'EOF'
204 Date: Sun, 18 Dec 2005 00:52:39 +0100
206 From: foo@example.edu
207 Subject: test C-T parameter expansion quoting
214 run_prog mhshow -nopause last >"$actual" 2>&1
215 check "$expected" "$actual"
217 sed -e 's/method/unknown/g' "$MH" >"$MH.new"
218 mv -f "$MH.new" "$MH"
220 # check that unknown parameter is not expanded
222 cat >"$msgfile" <<'EOF'
223 From: foo@example.edu
225 Subject: test display with unknown C-T parameter expansion
227 Content-Type: text/plain; charset=windows-1252
228 Content-Transfer-Encoding: quoted-printable
229 Date: Sun, 18 Dec 2005 00:52:39 +0100
234 cat >"$expected" <<'EOF'
235 Date: Sun, 18 Dec 2005 00:52:39 +0100
237 From: foo@example.edu
238 Subject: test display with unknown C-T parameter expansion
245 run_prog mhshow -nopause last >"$actual" 2>&1
246 check "$expected" "$actual"