File: test-charset

package info (click to toggle)
nmh 1.6-16
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 6,312 kB
  • ctags: 3,934
  • sloc: ansic: 48,921; sh: 16,427; makefile: 560; perl: 509; lex: 402; awk: 74
file content (61 lines) | stat: -rwxr-xr-x 1,304 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
######################################################
#
# Test charset conversion functionality
#
######################################################

set -e

if test -z "${MH_OBJ_DIR}"; then
    srcdir=`dirname "$0"`/../..
    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
fi

. "$MH_OBJ_DIR/test/common.sh"

setup_test

if ! locale -a | grep -iq en_us.utf; then
    test_skip "no suitable locale available"
fi
LC_ALL=en_US.UTF-8; export LC_ALL

test "$ICONV_ENABLED" -eq 0  &&  text_size=10  || text_size=11

expected=$MH_TEST_DIR/$$.expected
actual=$MH_TEST_DIR/$$.actual

echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"

# Write message with bogus quoted-printable data.
msgfile=`mhpath new`
msgnum=`basename $msgfile`
cat > $msgfile <<EOF
From: foo@example.edu
To: bar@example.edu
Subject: test
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Date: Sun, 18 Dec 2005 00:52:39 +0100

4 =F7 2 =3D 2
EOF

cat > $expected <<EOF
Date:    Sun, 18 Dec 2005 00:52:39 +0100
To:      bar@example.edu
From:    foo@example.edu
Subject: test

MIME-Version: 1.0

part       text/plain                  $text_size
This is a test
EOF

run_prog mhshow $msgnum > $actual 2>&1
check "$expected" "$actual"

exit $failed