]> diplodocus.org Git - nmh/blob - test/mhbuild/test-cte
Add a new base64 CTE test.
[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
50 #
51
52 cat > "$draft" <<EOF
53 To: Mr Test <mrtest@example.com>
54 cc:
55 Fcc: +outbox
56 ------
57 #<text/plain *b64
58 This is a test of a message with a shørt line.
59 EOF
60
61 run_prog mhbuild "$draft"
62
63 cat > "$expected" <<EOF
64 To: Mr Test <mrtest@example.com>
65 cc:
66 Fcc: +outbox
67 MIME-Version: 1.0
68 Content-Type: text/plain; charset="UTF-8"
69 Content-Transfer-Encoding: base64
70
71 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtZXNzYWdlIHdpdGggYSBzaMO4cnQgbGluZS4NCg==
72 EOF
73
74 check "$draft" "$expected"
75
76 exit ${failed:-0}