]> diplodocus.org Git - nmh/blob - test/mhshow/test-charset
Replace `if (p) free(p)' with `mh_xfree(p)'.
[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 en_US.utf-8 en_US.utf8
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 start_test '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" 'keep first' : bogus quoted-printable data
61
62
63 start_test 'locale profile component'
64 #### Used LC_ALL above, now use locale profile component instead.
65 printf "locale: $LC_ALL\n" >> "${MH}"
66 unset LC_ALL
67
68 run_prog mhshow $msgnum > $actual 2>&1
69 check "$expected" "$actual" : locale profile component
70
71
72 finish_test
73 exit $failed