]>
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 #### Use ap from PATH.
20 PATH
=`mhparam libdir`:$PATH
22 if test "$ICONV_ENABLED" -eq 0; then
23 test_skip
'test-textcharset requires that nmh have been built with iconv'
26 LC_ALL
=en_US.UTF-8
; export LC_ALL
28 expected
="$MH_TEST_DIR"/$$.expected
29 actual
="$MH_TEST_DIR"/$$.actual
31 # check charset conversion
36 Subject: test display with charset conversion
38 Content-Type: text/plain; charset=windows-1252
39 Content-Transfer-Encoding: quoted-printable
40 Date: Sun, 18 Dec 2005 00:52:39 +0100
45 cat >"$expected" <<EOF
46 Date: Sun, 18 Dec 2005 00:52:39 +0100
49 Subject: test display with charset conversion
57 run_prog mhshow
-nopause last
>"$actual" 2>&1
58 check
"$expected" "$actual"
61 mhshow-show-text/plain: echo %{charset}
64 # check expansion of %{charset} by itself
69 Subject: test display with %{charset} expansion
71 Content-Type: text/plain; charset=windows-1252
72 Content-Transfer-Encoding: quoted-printable
73 Date: Sun, 18 Dec 2005 00:52:39 +0100
78 cat >"$expected" <<EOF
79 Date: Sun, 18 Dec 2005 00:52:39 +0100
82 Subject: test display with %{charset} expansion
89 run_prog mhshow
-nopause last
>"$actual" 2>&1
90 check
"$expected" "$actual"
92 # check expansion of empty %{charset} by itself
97 Subject: test display with empty %{charset} expansion
99 Content-Type: text/plain
100 Content-Transfer-Encoding: quoted-printable
101 Date: Sun, 18 Dec 2005 00:52:39 +0100
106 cat >"$expected" <<EOF
107 Date: Sun, 18 Dec 2005 00:52:39 +0100
109 From: foo@example.edu
110 Subject: test display with empty %{charset} expansion
117 run_prog mhshow
-nopause last
>"$actual" 2>&1
118 check
"$expected" "$actual"
120 grep -v 'mhshow-show-text/plain:' "$MH" >"$MH.new"
121 mv -f "$MH.new" "$MH"
123 mhshow-show-text/plain: echo `ap -format '%(void(lit %{charset}))%<(nonnull)-I %(putstr)%>' 0`
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"
141 # check expansion of empty embedded %{charset} with no text following
142 cat >"$expected" <<EOF
143 Date: Sun, 18 Dec 2005 00:52:39 +0100
145 From: foo@example.edu
146 Subject: test display with empty %{charset} expansion
153 run_prog mhshow
-nopause last
>"$actual" 2>&1
154 check
"$expected" "$actual"
156 sed -e 's%\(mhshow-show-text/plain:.*\)%\1 file%' "$MH" >"$MH.new"
157 mv -f "$MH.new" "$MH"
159 # check expansion of embedded %{charset} with text following
160 cat >"$expected" <<EOF
161 Date: Sun, 18 Dec 2005 00:52:39 +0100
163 From: foo@example.edu
164 Subject: test display with %{charset} expansion
171 run_prog mhshow
-nopause prev
>"$actual" 2>&1
172 check
"$expected" "$actual"
174 # check expansion of empty embedded %{charset} with text following
175 cat >"$expected" <<EOF
176 Date: Sun, 18 Dec 2005 00:52:39 +0100
178 From: foo@example.edu
179 Subject: test display with empty %{charset} expansion
186 run_prog mhshow
-nopause last
>"$actual" 2>&1
187 check
"$expected" "$actual"
189 sed -e 's/%{charset}/%{unknown}/' "$MH" >"$MH.new"
190 mv -f "$MH.new" "$MH"
192 # check expansion of unknown parameter
194 cat >"$msgfile" <<EOF
195 From: foo@example.edu
197 Subject: test display with unknown C-T parameter expansion
199 Content-Type: text/plain; charset=windows-1252
200 Content-Transfer-Encoding: quoted-printable
201 Date: Sun, 18 Dec 2005 00:52:39 +0100
206 cat >"$expected" <<EOF
207 Date: Sun, 18 Dec 2005 00:52:39 +0100
209 From: foo@example.edu
210 Subject: test display with unknown C-T parameter expansion
217 run_prog mhshow
-nopause last
>"$actual" 2>&1
218 check
"$expected" "$actual"