]> diplodocus.org Git - nmh/blob - test/mhlist/test-ext-params
sbr/mf.c: Simplify logic, ditching endless for-loops and switch.
[nmh] / test / mhlist / test-ext-params
1 #!/bin/sh
2 ######################################################
3 #
4 # Test mhlist with extended parameters (RFC 2231)
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
20
21 expected=$MH_TEST_DIR/$$.expected
22 actual=$MH_TEST_DIR/$$.actual
23
24 #
25 # Write a message with some extended parameters
26 #
27
28 msgfile=`mhpath new`
29 cat > $msgfile <<EOF
30 To: recipient@example.com
31 From: sender@example.com
32 Subject: mhlist ext param test 1
33 MIME-Version: 1.0
34 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
35
36 ------- =_aaaaaaaaaa0
37 Content-Type: text/plain; charset=us-ascii;
38 name*=utf-8''This%20%C3%AFs%20the%20filename
39
40 This is a test
41
42 ------- =_aaaaaaaaaa0
43 Content-Type: image/jpeg;
44 name*0="This is an example of a very long filename. I wonder ";
45 name*1=if;
46 name*2=" this filename might be too long. It should not be. But";
47 name*3=" will it be?.jpg"
48 Content-Disposition: attachment;
49 filename*0="This is an example of a very long filename. I wonder ";
50 filename*1=if;
51 filename*2=" this filename might be too long. It should not be. But";
52 filename*3=" will it be?.jpg"
53 Content-Transfer-Encoding: base64
54
55 /9g=
56
57 ------- =_aaaaaaaaaa0--
58 EOF
59
60 # check to see if we decode parameters correctly.
61
62 run_test 'mhlist last -noheader -verbose -disposition' \
63 ' 11 multipart/mixed 637
64 boundary="----- =_aaaaaaaaaa0"
65 1 text/plain 15
66 charset="us-ascii"
67 name="This ïs the filename"
68 2 image/jpeg 2
69 name="This is an example of a very long filename. I wonder if this filename might be too long. It should not be. But will it be?.jpg"
70 disposition "attachment"
71 filename="This is an example of a very long filename. I wonder if this filename might be too long. It should not be. But will it be?.jpg"'
72
73 #
74 # Make some more complicated message parameters.
75 #
76
77 msgfile=`mhpath new`
78 cat > $msgfile <<EOF
79 To: recipient@example.com
80 From: sender@example.com
81 Subject: mhlist ext param test 2
82 MIME-Version: 1.0
83 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
84
85 ------- =_aaaaaaaaaa0
86 Content-Type: text/plain; charset=us-ascii;
87 name*=utf-8''This%20%C3%AFs%20the%20filename
88
89 This is a test
90
91 ------- =_aaaaaaaaaa0
92 Content-Type: image/jpeg; name*3=" will it be?.jpg";
93 longparam*5*=Sp%C4%B1n%CC%88al%20Tap!;
94 longparam*2=It; name*1=if;
95 longparam*3=" Might be our Long Lost Band";
96 longparam*0*=UTF-8'en'I%20Cannot%20Believe%20It;
97 name*0="This is an example of a very long filename. I wonder ";
98 longparam*4*=%20The%20%C3%96ne%20And%20Only%20;
99 name*2=" this filename might be too long. It should not be. But";
100 longparam*1=", it Looks Like "
101 Content-Transfer-Encoding: base64
102
103 /9g=
104
105 ------- =_aaaaaaaaaa0--
106 EOF
107
108 run_test 'mhlist last -noheader -verbose' \
109 ' 12 multipart/mixed 647
110 boundary="----- =_aaaaaaaaaa0"
111 1 text/plain 15
112 charset="us-ascii"
113 name="This ïs the filename"
114 2 image/jpeg 2
115 longparam="I Cannot Believe It, it Looks Like It Might be our Long Lost Band The Öne And Only Spın̈al Tap!"
116 name="This is an example of a very long filename. I wonder if this filename might be too long. It should not be. But will it be?.jpg"'
117
118 #
119 # Test out message/external-body types, and also make sure we will correctly
120 # decode a URL wrapped with RFC 2017 rules.
121 #
122
123 msgfile=`mhpath new`
124 cat > $msgfile <<EOF
125 To: recipient@example.com
126 From: sender@example.com
127 Subject: mhlist ext param test 3
128 MIME-Version: 1.0
129 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
130
131 ------- =_aaaaaaaaaa0
132 Content-Type: text/plain; charset=us-ascii;
133 name*=utf-8''This%20%C3%AFs%20the%20filename
134
135 This is a test
136
137 ------- =_aaaaaaaaaa0
138 Content-Type: message/external-body; access-type="url";
139 url*1="/that/should-be-wrapped/image.jpeg";
140 url*0="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url"
141
142 Content-Type: image/jpeg
143 Content-Description: Test of a long URL
144 Content-Disposition: attachment; filename=image.jpeg
145
146 ------- =_aaaaaaaaaa0
147 Content-Type: message/external-body; access-type="url";
148 url*0="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url
149 /that/should-be-wrapped/image.jpeg"
150
151 Content-Type: image/jpeg
152 Content-Description: Test of a long URL
153 Content-Disposition: attachment; filename=image.jpeg
154
155 ------- =_aaaaaaaaaa0--
156 EOF
157
158 run_test 'mhlist last -noheader -verbose -disposition' \
159 ' 13 multipart/mixed 775
160 boundary="----- =_aaaaaaaaaa0"
161 1 text/plain 15
162 charset="us-ascii"
163 name="This ïs the filename"
164 2 message/external-body 118
165 access-type="url"
166 url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url/that/should-be-wrapped/image.jpeg"
167 url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url/that/should-be-wrapped/image.jpeg"
168 access-type="url"
169 image/jpeg Test of a long URL
170 disposition "attachment"
171 filename="image.jpeg"
172 3 message/external-body 118
173 access-type="url"
174 url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url /that/should-be-wrapped/image.jpeg"
175 url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url/that/should-be-wrapped/image.jpeg"
176 access-type="url"
177 image/jpeg Test of a long URL
178 disposition "attachment"
179 filename="image.jpeg"'
180
181 exit $failed