]> diplodocus.org Git - nmh/blob - test/mhshow/test-charset
Add support for the -sendmail flag to send/post, to support changing the
[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 [ Message inbox:11 ]
47 Date: Sun, 18 Dec 2005 00:52:39 +0100
48 To: bar@example.edu
49 From: foo@example.edu
50 Subject: test
51
52 MIME-Version: 1.0
53 Content-Description: bogus quoted-printable data
54
55 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
56 This is a test
57 EOF
58
59 run_prog mhshow $msgnum > $actual 2>&1
60 check "$expected" "$actual" : bogus quoted-printable data
61
62 exit $failed