]> diplodocus.org Git - nmh/blob - test/mhshow/test-charset
Fixed test-charset to pass without iconv.
[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 LC_ALL=en_US.UTF-8; export LC_ALL
20
21 test "$ICONV_ENABLED" -eq 0 && text_size=10 || text_size=11
22
23 expected=$MH_TEST_DIR/$$.expected
24 actual=$MH_TEST_DIR/$$.actual
25
26 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
27
28 # Write message with bogus quoted-printable data.
29 msgfile=`mhpath new`
30 msgnum=`basename $msgfile`
31 cat > $msgfile <<EOF
32 From: foo@example.edu
33 To: bar@example.edu
34 Subject: test
35 MIME-Version: 1.0
36 Content-Type: text/plain; charset=windows-1252
37 Content-Transfer-Encoding: quoted-printable
38 Content-Description: bogus quoted-printable data
39 Date: Sun, 18 Dec 2005 00:52:39 +0100
40
41 4 =F7 2 =3D 2
42 EOF
43
44 cat > $expected <<EOF
45 Date: Sun, 18 Dec 2005 00:52:39 +0100
46 To: bar@example.edu
47 From: foo@example.edu
48 Subject: test
49
50 MIME-Version: 1.0
51 Content-Description: bogus quoted-printable data
52
53 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
54 This is a test
55 EOF
56
57 run_prog mhshow $msgnum > $actual 2>&1
58 check "$expected" "$actual"
59
60 exit $failed