]> diplodocus.org Git - nmh/blob - test/mhbuild/test-cte
More fixes (and tests) for the base64 encoder.
[nmh] / test / mhbuild / test-cte
1 #!/bin/sh
2 #########################################################
3 #
4 # Test the use of explicit Content-Transfer-Encoding tags
5 #
6 #########################################################
7
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir=`dirname "$0"`/../..
10 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
11 fi
12
13 . "$MH_OBJ_DIR/test/common.sh"
14
15 setup_test
16
17 LC_ALL=en_US.UTF-8; export LC_ALL
18
19 draft="$MH_TEST_DIR/$$.draft"
20 expected="$MH_TEST_DIR/$$.expected"
21
22 #
23 # Force some text to be quoted-printable
24 #
25
26 cat > "$draft" <<EOF
27 To: Mr Test <mrtest@example.com>
28 cc:
29 Fcc: +outbox
30 ------
31 #<text/plain *qp
32 This is a test of a message with a shørt line.
33 EOF
34
35 run_prog mhbuild "$draft"
36
37 cat > "$expected" <<EOF
38 To: Mr Test <mrtest@example.com>
39 cc:
40 Fcc: +outbox
41 MIME-Version: 1.0
42 Content-Type: text/plain; charset="UTF-8"
43 Content-Transfer-Encoding: quoted-printable
44
45 This is a test of a message with a sh=C3=B8rt line.
46 EOF
47
48 #
49 # Force some text to be base64, to test out the encoder. Try at different
50 # line lengths to check out the padding on the
51 #
52
53 cat > "$draft" <<EOF
54 To: Mr Test <mrtest@example.com>
55 cc:
56 Fcc: +outbox
57 ------
58 #<text/plain *b64
59 This is a test of a message with a shørt line.
60 EOF
61
62 run_prog mhbuild "$draft"
63
64 cat > "$expected" <<EOF
65 To: Mr Test <mrtest@example.com>
66 cc:
67 Fcc: +outbox
68 MIME-Version: 1.0
69 Content-Type: text/plain; charset="UTF-8"
70 Content-Transfer-Encoding: base64
71
72 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtZXNzYWdlIHdpdGggYSBzaMO4cnQgbGluZS4NCg==
73 EOF
74
75 check "$draft" "$expected"
76
77 cat > "$draft" <<EOF
78 To: Mr Test <mrtest@example.com>
79 cc:
80 Fcc: +outbox
81 ------
82 #<text/plain *b64
83 This is a test of a mëssage with a shørt line.
84 EOF
85
86 run_prog mhbuild "$draft"
87
88 cat > "$expected" <<EOF
89 To: Mr Test <mrtest@example.com>
90 cc:
91 Fcc: +outbox
92 MIME-Version: 1.0
93 Content-Type: text/plain; charset="UTF-8"
94 Content-Transfer-Encoding: base64
95
96 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc2FnZSB3aXRoIGEgc2jDuHJ0IGxpbmUuDQo=
97 EOF
98
99 check "$draft" "$expected"
100
101 exit ${failed:-0}