]>
diplodocus.org Git - nmh/blob - test/mhbuild/test-utf8-body
2 ######################################################
4 # Test UTF-8 body along with an attachment
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"
18 testname
="${MH_TEST_DIR}/$$"
20 LC_ALL
=en_US.UTF
-8; export LC_ALL
22 #### Rely on sendmail/pipe below to override default mts.
23 mts_fakesendmail
="${MHMTSCONF}-fakesendmail"
24 cp "${MHMTSCONF}" "$mts_fakesendmail"
25 printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
26 MHMTSCONF
="$mts_fakesendmail"
28 # argument: expected output
31 run_prog send
-draft -mts sendmail
/pipe
33 # fakesendmail drops the message and any cc's into this mbox.
34 mbox
="${MH_TEST_DIR}"/Mail
/fakesendmail.mbox
35 inc
-silent -file "$mbox"
36 rm -f "$mbox" "$mbox.map"
39 # It's hard to calculate the exact Date: header post is going to
40 # use, so we'll just use sed to remove the actual date so we can easily
41 # compare it against our "correct" output. And same for charset.
43 sed -e 's/^Date:.*/Date:/' -e 's/; charset="[^;]*//' \
44 "`mhpath cur`" > "${testname}.actual"
46 check
"${testname}.actual" "$1"
49 # check that 7-bit body isn't encoded
50 cat > "${MH_TEST_DIR}/attachment.txt" <<EOF
54 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
55 From: Mr Nobody <nobody@example.com>
56 To: Somebody <somebody@example.com>
58 Attach: $MH_TEST_DIR/attachment.txt
63 cat > "${testname}.expected" <<EOF
64 From: Mr Nobody <nobody@example.com>
65 To: Somebody <somebody@example.com>
68 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
72 Content-Type: text/plain
77 Content-Type: text/plain; name="attachment.txt"
78 Content-Description: attachment.txt
79 Content-Disposition: attachment; filename="attachment.txt"
83 ------- =_aaaaaaaaaa0--
86 test_attachment
"${testname}.expected"
88 # check that 8-bit body is encoded as quoted-printable text/plain,
89 # even with an attachment
91 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
92 From: Mr Nobody <nobody@example.com>
93 To: Somebody <somebody@example.com>
95 Attach: $MH_TEST_DIR/attachment.txt
100 cat > "${testname}.expected" <<EOF
101 From: Mr Nobody <nobody@example.com>
102 To: Somebody <somebody@example.com>
105 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
106 Content-Transfer-Encoding: 8bit
109 ------- =_aaaaaaaaaa0
110 Content-Type: text/plain
111 Content-Transfer-Encoding: 8bit
115 ------- =_aaaaaaaaaa0
116 Content-Type: text/plain; name="attachment.txt"
117 Content-Description: attachment.txt
118 Content-Disposition: attachment; filename="attachment.txt"
120 this is an attachment
122 ------- =_aaaaaaaaaa0--
125 test_attachment
"${testname}.expected"
127 rm -f ${MHMTSCONF} "${MH_TEST_DIR}/attachment.txt"
131 # emacs hackage to ensure that it writes the inverted exclamation
132 # point as UTF-8 multibyte character \xC2\xA1 instead of just \xA1.