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