]> diplodocus.org Git - nmh/blob - test/mhshow/test-charset
uip/anno.c: Increase coverage.
[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 check_exit '-eq 1' mhshow - # gcov
20
21 require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
22
23 test "$ICONV_ENABLED" -eq 0 && text_size=10 || text_size=11
24
25 expected=$MH_TEST_DIR/$$.expected
26 actual=$MH_TEST_DIR/$$.actual
27
28 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
29
30 # Write message with bogus quoted-printable data.
31 start_test 'Write message with bogus quoted-printable data'
32 msgfile=`mhpath new`
33 msgnum=`basename $msgfile`
34 cat > $msgfile <<EOF
35 From: foo@example.edu
36 To: bar@example.edu
37 Subject: test
38 MIME-Version: 1.0
39 Content-Type: text/plain; charset=windows-1252
40 Content-Transfer-Encoding: quoted-printable
41 Content-Description: bogus quoted-printable data
42 Date: Sun, 18 Dec 2005 00:52:39 +0100
43
44 4 =F7 2 =3D 2
45 EOF
46
47 cat > $expected <<EOF
48 [ Message inbox:11 ]
49 Date: Sun, 18 Dec 2005 00:52:39 +0100
50 To: bar@example.edu
51 From: foo@example.edu
52 Subject: test
53
54 MIME-Version: 1.0
55 Content-Description: bogus quoted-printable data
56
57 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
58 This is a test
59 EOF
60
61 run_prog mhshow $msgnum > $actual 2>&1
62 check "$expected" "$actual" 'keep first' : bogus quoted-printable data
63
64
65 start_test 'locale profile component'
66 #### Used LC_ALL above, now use locale profile component instead.
67 printf "locale: $LC_ALL\n" >> "${MH}"
68 unset LC_ALL
69
70 run_prog mhshow $msgnum > $actual 2>&1
71 check "$expected" "$actual" : locale profile component
72
73
74 finish_test
75 exit $failed