]> diplodocus.org Git - nmh/blob - test/mhshow/test-textcharset
Need to set locale to something other than UTF-8 on Cygwin for
[nmh] / test / mhshow / test-textcharset
1 #!/bin/sh
2 ##########################################################
3 #
4 # Test display of text/plain parts with charset conversion
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 if test "$ICONV_ENABLED" -eq 0; then
20 echo "$0: skipping test-textcharset because nmh was built without iconv"
21 exit 0
22 fi
23
24 expected="$MH_TEST_DIR"/$$.expected
25 actual="$MH_TEST_DIR"/$$.actual
26
27 msgfile=`mhpath new`
28 cat >"$msgfile" <<EOF
29 From: foo@example.edu
30 To: bar@example.edu
31 Subject: test display with charset conversion
32 MIME-Version: 1.0
33 Content-Type: text/plain; charset=windows-1252
34 Content-Transfer-Encoding: quoted-printable
35 Date: Sun, 18 Dec 2005 00:52:39 +0100
36
37 4 =F7 2 =3D 2
38 EOF
39
40 # Check -notextcharset.
41 cat >"$expected" <<EOF
42 Date: Sun, 18 Dec 2005 00:52:39 +0100
43 To: bar@example.edu
44 From: foo@example.edu
45 Subject: test display with charset conversion
46
47 MIME-Version: 1.0
48
49 EOF
50
51 LC_ALL=C; export LC_ALL
52 run_prog mhshow -textcharset UTF-8 -notextcharset -nopause last >"$actual" 2>&1
53 check "$expected" "$actual"
54
55 # Check -textcharset.
56 cat >"$expected" <<EOF
57 Date: Sun, 18 Dec 2005 00:52:39 +0100
58 To: bar@example.edu
59 From: foo@example.edu
60 Subject: test display with charset conversion
61
62 MIME-Version: 1.0
63
64 part text/plain 10
65 4 รท 2 = 2
66 EOF
67
68 run_prog mhshow -textcharset UTF-8 -nopause last >"$actual" 2>&1
69 check "$expected" "$actual" 'keep first'
70
71 # Check use of user's locale.
72 LC_ALL=en_US.UTF-8; export LC_ALL
73 run_prog mhshow -nopause last >"$actual" 2>&1
74 check "$expected" "$actual"
75
76 exit $failed