]> diplodocus.org Git - nmh/blob - test/mhshow/test-charset
Fix to commit 0d3875d020fb17d34918f5e81ee7f87fbc5d1565: it seems
[nmh] / test / mhshow / test-charset
1 #!/bin/sh
2 ######################################################
3 #
4 # Test charset conversion functionality
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname "$0"`/../..
12 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 require_locale en_US.utf-8 en_US.utf8
20 LC_ALL=en_US.UTF-8; export LC_ALL
21
22 test "$ICONV_ENABLED" -eq 0 && text_size=10 || text_size=11
23
24 expected=$MH_TEST_DIR/$$.expected
25 actual=$MH_TEST_DIR/$$.actual
26
27 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
28
29 # Write message with bogus quoted-printable data.
30 msgfile=`mhpath new`
31 msgnum=`basename $msgfile`
32 cat > $msgfile <<EOF
33 From: foo@example.edu
34 To: bar@example.edu
35 Subject: test
36 MIME-Version: 1.0
37 Content-Type: text/plain; charset=windows-1252
38 Content-Transfer-Encoding: quoted-printable
39 Content-Description: bogus quoted-printable data
40 Date: Sun, 18 Dec 2005 00:52:39 +0100
41
42 4 =F7 2 =3D 2
43 EOF
44
45 cat > $expected <<EOF
46 Date: Sun, 18 Dec 2005 00:52:39 +0100
47 To: bar@example.edu
48 From: foo@example.edu
49 Subject: test
50
51 MIME-Version: 1.0
52 Content-Description: bogus quoted-printable data
53
54 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
55 This is a test
56 EOF
57
58 run_prog mhshow $msgnum > $actual 2>&1
59 check "$expected" "$actual"
60
61 exit $failed