]> diplodocus.org Git - nmh/blob - test/mhbuild/test-ext-params
More cleaned and conversion to the new parameter API.
[nmh] / test / mhbuild / test-ext-params
1 #!/bin/sh
2 ######################################################
3 #
4 # Test the creation of RFC 2231 encoded parameters
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 # Try out a draft with some 8-bit encoded parameters
24 #
25
26 cat > "$draft" <<EOF
27 To: Mr Test <mrtest@example.com>
28 cc:
29 Fcc: +outbox
30 ------
31 This is a test message
32 #image/jpeg {attachment; filename="tïny.jpg"} ${srcdir}/test/mhbuild/tiny.jpg
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: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
43
44 ------- =_aaaaaaaaaa0
45 Content-Type: text/plain; charset="us-ascii"
46
47 This is a test message
48
49 ------- =_aaaaaaaaaa0
50 Content-Type: image/jpeg
51 Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
52 Content-Transfer-Encoding: base64
53
54 /9g=
55
56 ------- =_aaaaaaaaaa0--
57 EOF
58
59 check "$draft" "$expected"
60
61 #
62 # Try out a draft with some long parameters
63 #
64
65 cat > "$draft" <<EOF
66 To: Mr Test <mrtest@example.com>
67 cc:
68 Fcc: +outbox
69 ------
70 This is a test message
71 #image/jpeg {attachment; filename="This is an example of a rather long filename that is longer than would fit on a normal line.jpg"} \
72 ${srcdir}/test/mhbuild/tiny.jpg
73 EOF
74
75 run_prog mhbuild "$draft"
76
77 cat > "$expected" <<EOF
78 To: Mr Test <mrtest@example.com>
79 cc:
80 Fcc: +outbox
81 MIME-Version: 1.0
82 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
83
84 ------- =_aaaaaaaaaa0
85 Content-Type: text/plain; charset="us-ascii"
86
87 This is a test message
88
89 ------- =_aaaaaaaaaa0
90 Content-Type: image/jpeg
91 Content-Disposition: attachment;
92 filename*0="This is an example of a rather long filename that is lo";
93 filename*1="nger than would fit on a normal line.jpg"
94 Content-Transfer-Encoding: base64
95
96 /9g=
97
98 ------- =_aaaaaaaaaa0--
99 EOF
100
101 check "$draft" "$expected"
102
103 #
104 # Try out attach with a filename with 8-bit characters
105 #
106
107 cp "${srcdir}/test/mhbuild/tiny.jpg" "$MH_TEST_DIR/tïny.jpg"
108
109 cat > "$draft" <<EOF
110 To: Mr Test <mrtest@example.com>
111 cc:
112 Fcc: +outbox
113 Attach: $MH_TEST_DIR/tïny.jpg
114 ------
115 This is a test message
116 EOF
117
118 run_prog mhbuild "$draft"
119
120 cat > "$expected" <<EOF
121 To: Mr Test <mrtest@example.com>
122 cc:
123 Fcc: +outbox
124 MIME-Version: 1.0
125 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
126
127 ------- =_aaaaaaaaaa0
128 Content-Type: text/plain; charset="us-ascii"
129
130 This is a test message
131
132 ------- =_aaaaaaaaaa0
133 Content-Type: image/jpeg; name*=UTF-8''t%C3%AFny.jpg
134 Content-Description: =?UTF-8?B?dMOvbnkuanBn?=
135 Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
136 Content-Transfer-Encoding: base64
137
138 /9g=
139
140 ------- =_aaaaaaaaaa0--
141 EOF
142
143 check "$draft" "$expected"
144
145 exit ${failed:-0}