]>
diplodocus.org Git - nmh/blob - test/mhshow/test-charset
2 ######################################################
4 # Test charset conversion functionality
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname "$0"`/..
/..
12 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
15 .
"$MH_OBJ_DIR/test/common.sh"
19 check_exit
'-eq 1' mhshow
-
21 require_locale en_US.UTF
-8 en_US.UTF8 en_US.utf
-8 en_US.utf8
23 skip_param_value_checks
=0
24 if test "$ICONV_ENABLED" -eq 0; then
28 if ! iconv -l | grep EBCDIC
-US >/dev
/null
; then
29 #### For unknown reasons, the parameter values checks
30 #### fail on the FreeBSD10 buildbot. It doesn't
31 #### support EBCDIC-US, which is used by the checks,
32 #### so use that to detect whether to skip the check.
33 skip_param_value_checks
=1
37 expected
=$MH_TEST_DIR/$$.expected
38 actual
=$MH_TEST_DIR/$$.actual
40 echo 'mhshow-charset-windows-1252: echo "This is a test"' >> "$MH"
42 # Write message with bogus quoted-printable data.
43 start_test
'Write message with bogus quoted-printable data'
45 msgnum
=`basename $msgfile`
51 Content-Type: text/plain; charset=windows-1252
52 Content-Transfer-Encoding: quoted-printable
53 Content-Description: bogus quoted-printable data
54 Date: Sun, 18 Dec 2005 00:52:39 +0100
61 Date: Sun, 18 Dec 2005 00:52:39 +0100
67 Content-Description: bogus quoted-printable data
69 [ part - text/plain - bogus quoted-printable data ${text_size}B ]
73 run_prog mhshow
$msgnum > $actual 2>&1
74 check
"$expected" "$actual" 'keep first' : bogus quoted
-printable data
77 start_test
'locale profile component'
78 #### Used LC_ALL above, now use locale profile component instead.
79 printf "locale: $LC_ALL\n" >> "${MH}"
82 run_prog mhshow
$msgnum > $actual 2>&1
83 check
"$expected" "$actual" : locale profile component
86 start_test
'Encoded parameter value'
88 msgnum
=`basename $msgfile`
89 #### The encoded charset name is really UTF-8 encoded,
90 #### but say it's UTF-16 to exercise the iconv code,
91 #### if it's available, in get_param_value().
97 Content-Type: text/plain; charset*=EBCDIC-US''%e4%e3%c6%60%f8
98 Content-Transfer-Encoding: quoted-printable
99 Content-Description: bogus quoted-printable data
100 Date: Sun, 18 Dec 2005 00:52:39 +0100
105 cat > $expected <<EOF
107 Date: Sun, 18 Dec 2005 00:52:39 +0100
109 From: foo@example.edu
113 Content-Description: bogus quoted-printable data
115 [ part - text/plain - bogus quoted-printable data 11B ]
119 if test $skip_param_value_checks -eq 0; then
120 run_prog mhshow
$msgnum > $actual 2>&1
121 check
"$expected" "$actual" : encoded parameter value
125 start_test
'replacement character in parameter value'
126 #### The output of this test doesn't show it, but it covers the
127 #### noiconv: portion of get_param_value().
128 cat > $msgfile <<'EOF'
129 Subject: invalid parameter value charset
131 Content-Type: text/plain; charset*=invalid''%0Dus-ascii
134 cat > $expected <<EOF
136 Subject: invalid parameter value charset
140 [ part - text/plain - 0B ]
143 if test $skip_param_value_checks -eq 0; then
144 run_prog mhshow
$msgnum > $actual 2>&1
145 check
"$expected" "$actual"