1 # Common string expansions
3 # This is the main string expansion test that tests those expansions that will
4 # be present in the basic Exim binary which we require in order to run these
5 # tests at all. Specialized expansion tests also exist for optional features
6 # in other test scripts.
11 # These expansions can test variables in the configuration, but as there
12 # is no message being processed, there is no message-related data. But
13 # that of course gets tested in plenty of other places.
15 # Some fixed variables
18 exim_version: $exim_version
19 config_dir: $config_dir
20 config_file: $config_file
21 primary_hostname: $primary_hostname
22 primary_hostname: ${primary_hostname}
23 qualify_domain: $qualify_domain
24 bounce_return_size_limit: ${bounce_return_size_limit}
25 spool_directory: $spool_directory
26 queue_name: $queue_name
28 h_subject: $h_subject:(should be empty)
29 h_subject:$h_subject (should be empty)
30 header in curlies: ${header_subject:} (should fail)
32 # \$message_headers should be empty
33 message_headers: >$message_headers<
41 # Overlong names and overbig numbers
43 +$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
44 +${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
45 +$11111111111111111111111111111111111
46 +${11111111111111111111111111111111111}
61 eval: ${eval:-2 - (-3)}
62 eval: ${eval:-2 - (-3}
63 eval: ${eval:-2 - -3)}
67 eval: ${eval:(2*(1+1))/2 + 40K}
72 eval10: ${eval10:0x1234}
75 eval: ${eval:0xc & 5 }
79 eval: ${eval:0xc >> 2}
80 eval: ${eval:0xc >> 4 }
82 eval: ${eval:~255&0x1234}
83 eval: ${eval:~ 255&0x1234}
84 eval: ${eval: -(~255&0x1234)}
88 filter: "${filter{a:b:c}{eq{1}{1}}}"
89 filter: ${filter{a:b:c}{!eq{$item}{b}}}
90 filter: ${filter{<' a'b'c}{!eq{$item}{b}}}
91 filter: ${filter{<' ''a'b' ''c}{!eq{$item}{b}}}
92 filter: "${filter{}{!eq{$item}{b}}}"
93 # check operation when the condition modifies the 'value' variable
94 ${filter {E} {inlisti{$item}{ e }}}
96 map: "${map{}{$item}}"
97 map: ${map{a:b:c}{$item}}
98 map: ${map{a:b:c}{:$item:}}
99 map: ${if eq{1}{0}{${map{a:b:c}{:$item:}}}{fail string}}
100 map: ${map{:b:c}{[$item]}}
102 reduce: "${reduce{}{+}{$value$item}}"
103 reduce: ${reduce{a:b:c}{+}{$value$item}}
104 reduce: ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
105 reduce: ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
106 # Check for extract corrupting reduce's $value
107 reduce: ${reduce {b}{a aaa}{${extract{1}{ }{$value}} , $item}}
109 listnamed: ${listnamed:dlist}
110 listnamed: ${listnamed:+dlist}
111 listnamed: ${listnamed:hlist}
112 listnamed: ${listnamed:elist}
113 listnamed: ${listnamed:flist}
114 listnamed: ${listnamed:nolist}
115 listnamed: ${listnamed_d:dlist}
116 listnamed: ${listnamed_d:hlist}
117 listnamed: ${listnamed_z:dlist}
119 listcount: ${listcount:a:b:c}
120 listcount: ${listcount:}
121 listcount: ${listcount:<;a;b;c}
122 listcount: ${listcount:${listnamed:dlist}}
124 listextract: ${listextract{ 2}{a:b:c:d}}
125 listextract: ${listextract{-2}{<,a,b,c,d}{X${value}X}}
126 listextract: ${listextract{ 5}{a:b:c:d}}
127 listextract: ${listextract{-5}{a:b:c:d}}
128 listextract: ${listextract{ 5}{a:b:c:d}{}{fail}}
129 listextract: ${listextract{ 5}{a:b:c:d}{}fail}
131 listquote: ${listquote{:}{abcd}}
132 listquote: ${listquote{:}{ab:cd}}
133 listquote: ${listquote{:}{:a:b:c:d:}}
134 listquote: ${listquote{:}{ab::cd}}
135 listquote: ${listquote{;}{ab:cd}}
136 listquote: ${listquote{;}{ab;cd}}
137 listquote: ${listquote{ }{ ab cd}}
138 listquote: <${listquote{:}{}}>
140 sort: ${sort{3:2:1:4}{<}{$item}}
141 sort: ${sort {<, 3,2,1,4}{>}{$item}}
142 sort: ${sort{c:B:a:aa}{lti}{$item}}
143 sort: ${sort{666 r99.ex.com:10 smtp.ex.com:100 r2.ex.com}{<}{${sg {$item}{([0-9]*).*\$}{\$1}}}}
144 sort: ${sort{666,r99.ex.com:10,smtp.ex.com:100,r2.ex.com}{<}{${listextract{1}{<,$item}}}}
145 sort: "${sort{}{<}{$item}}"
147 # Tests with iscntrl() and illegal separators
149 map: ${map{<\n a\n\nb\nc}{'$item'}}
151 reduce: ${reduce {<n 1\n2\n3}{0}{${eval:$value+$item}}}
152 reduce: ${reduce {<\n 1\n2\n3}{0}{${eval:$value+$item}}}
153 reduce: ${reduce { <\n 1\n 2 \n 3 }{0}{${eval:$value+$item}}}
154 reduce: ${reduce {<\x7f 1\x7f2\177 3}{0}{${eval:$value+$item}}}
160 acl: ${acl {a_nosuch}}
162 acl: ${acl {a_ret}{person@dom.ain}}
163 acl: ${acl {a_ret}{firstarg}{secondarg}}
164 acl: ${acl {a_ret}{arg with spaces}}
166 acl: ${acl {a_none}{person@dom.ain}}
168 acl: ${acl {a_deny}{person@dom.ain}}
169 acl: ${acl {a_defer}}
170 acl: ${acl {a_sub}{top_arg_1}{top_arg_2}{top_arg_3}}
171 acl: ${reduce {1:2:3:4} {} {$value ${acl {a_ret}{$item}}}}
173 addrss: ${address:local-part@dom.ain}
174 addrss: ${address:Exim Person <local-part@dom.ain> (that's me)}
175 addrss: ${address:Exim Person <local-part(comment)@dom.ain> (that's me)}
176 addrss: ${address:Exim Person <local-part@dom.ain(comment)> (that's me)}
177 addrss: ${address:Exim Person <local-part(comment)@dom.ain(comment2)> (that's me)}
178 addrss: ${address:Exim Person <local-part.(comment)dot-atom@dom.ain(comment2)> (that's me)}
179 addrss: ${address:Exim Person <(comment)local-part@dom.ain(comment2)> (that's me)}
180 domain: ${domain:local-part@dom.ain}
181 domain: ${domain:Exim Person <local-part@dom.ain> (that's me)}
182 domain: ${domain:Exim Person <local-part(foo)@(bar)dom.ain> (that's me)}
183 domain: ${domain:a.b.c}
185 addresses: ${addresses:>' 'abc@xyz, 'pqr@xyz}
186 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me)}
187 addresses: ${addresses:>+ Exim Person <local-part@dom.ain> (that's me),\
189 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me), \
190 xyz@abc, nullgroupname:;, group: p@q, r@s; }
191 addresses: ${addresses:local-part@dom.ain <local-part@dom.ain>}
192 addresses: ${addresses:>}
194 escape: ${escape:B7·F2ò}
195 excape8bit: ${escape8bit:undisturbed text\ttab\nnewline\ttab\\backslash \176tilde\177DEL\200\x81.}
197 expand: \$primary_hostname ${expand:\$primary_hostname}
198 hash: ${hash_3:monty} ${hash_5:monty} ${hash_4_62:monty python}
199 hash: ${hash_3:abc}X ${hash_3:ab}X ${hash_3:a}X ${hash_3:}X
200 hex2b64:${hex2b64:12345678}
201 hex2b64:${hex2b64:abcdef}
202 hex2b64:${hex2b64:ABCDEF}
203 hex2b64:${hex2b64:1a2b3c4d5e6f}
204 hex2b64:${hex2b64:1a2b3c4d5e6}
205 hex2b64:${hex2b64:1a2b3c4d5e6g}
206 hex2b64:${hex2b64:${md5:the quick brown fox}}
207 hex2b64:${hex2b64:${sha1:the quick brown fox}}
209 base32: 0 <${base32:0}>
210 base32: 1 <${base32:1}>
211 base32: 31 <${base32:31}>
212 base32: 32 <${base32:32}>
213 base32: 42 <${base32:42}>
214 base32 error: 0x1 ${base32:0x1}
216 base32d: 0 ${base32d:${base32:0}}
217 base32d: 1 ${base32d:${base32:1}}
218 base32d: 31 ${base32d:${base32:31}}
219 base32d: 32 ${base32d:${base32:32}}
220 base32d: 42 ${base32d:${base32:42}}
221 base32d error: ABC ${base32d:ABC}
223 the base62 operator is actually a base36 operator in the Darwin and Cygwin
224 environments. Write cunning tests that produce the same output in both cases,
225 while doing a reasonable check.
228 {eq {${base62:12345}}{0003D7}}\
229 {eq {${base62:12345}}{0009IX}}\
232 {eq {${base62d:0003D7}}{12345}}\
233 {eq {${base62d:0009IX}}{12345}}\
236 {eq {${base62d:3D7}}{12345}}\
237 {eq {${base62d:9IX}}{12345}}\
239 base62 error: ${base62:12345x}
240 base62d error:${base62d:0003D7.}
242 hmac: ${hmac{md5}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
243 hmac: ${hmac{sha1}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
244 md5: ${md5:the quick brown fox jumps over the lazy dog}
247 mask: ${mask:192.168.10.206/28}
248 mask: ${mask:192.168.10.206/32}
249 mask: ${mask:192.168.10.206/33}
250 mask: ${mask:192.168.10.206/0}
251 mask: ${mask:192.168.10.206}
252 mask: ${mask:a.b.c.d}
253 mask: ${mask:2a00:2:3:4:5:6:7:8/79}
254 mask: ${mask:2a00:2:3:4:5:6:7:8/128}
255 mask: ${mask:2a00:2:3:4:5:6:7:8/129}
256 mask_n: ${mask_n:2a00:2:3:4:5:6:7:8/79}
257 ipv6denorm: ${ipv6denorm:::1}
258 ipv6denorm: ${ipv6denorm:fe00::1}
259 ipv6denorm: ${ipv6denorm:192.168.0.1}
260 ipv6denorm: ${ipv6denorm:fe80::192.168.0.1}
261 ipv6norm: ${ipv6norm:0:0:0::1}
262 ipv6norm: ${ipv6norm:2a00::0}
263 ipv6norm: ${ipv6norm:2a00::1}
264 ipv6norm: ${ipv6norm:2a00:eadf:0000:0000:0000:0000:0001:0000}
265 ipv6norm: ${ipv6norm:2a00:eadf:0000:0001:0000:0000:0000:0000}
266 ipv6norm: ${ipv6norm:2a00:0:0:0::}
267 ipv6norm: ${ipv6norm:2a00:2:3:4:5:6:7:8}trailing_text
268 nhash: ${nhash_24:monty} ${nhash_8_63:monty python}
269 lc/uc: ${lc:The Quick} ${uc: Brown Fox}
270 length: ${length_10:The quick brown fox} ${l_10:abc}
271 lclpt: ${local_part:local-part@dom.ain}
272 lclpt: ${local_part:Exim Person <local-part@dom.ain> (that's me)}
273 lclpt: ${local_part:Exim Person <local(comment).part@dom.(comment2)ain> (that's me)}
274 lclpt: ${local_part:a.b.c}
275 quote: ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef}
276 quote: ${quote:nl(\n)}
277 quote: ${quote:cr(\r)}
278 quote: ${quote:tab(\t)}
279 quote: ${quote:xff(\xff)}
280 quote: Empty>${quote:}<
281 quote_local_part: ${quote_local_part:abcd}
282 quote_local_part: ${quote_local_part:O'Reilly}
283 quote_local_part: ${quote_local_part:a space}
284 quote_local_part: ${quote_local_part:.something}
285 quote_local_part: ${quote_local_part:something.}
286 quote_local_part: ${quote_local_part:joe.bloggs}
287 quote_local_part: ${quote_local_part:a!b}
288 quote_local_part: ${quote_local_part:x@y}
289 quote_local_part: ${quote_local_part:ab*cd}
290 quote_local_part: ${quote_local_part:x:y}
291 quote_local_part: ${quote_local_part:ab\cd"ef}
292 quote_local_part: ${quote_local_part:}
293 rxquote:${rxquote:aZ09_,-Q} ${rxquote:ab*cd} ${rxquote:ab\cd"ef}
294 hexquote: ${hexquote:\
295 \001\002\003\004\005\006\007 \010\011\012\013\014\015\016\017 \
296 \020\021\022\023\024\025\026\027 \030\031\032\033\034\035\036\037 \
297 \040\041\042\043\044\045\046\047 \050\051\052\053\054\055\056\057 \
298 \060\061\062\063\064\065\066\067 \070\071\072\073\074\075\076\077 \
299 \100\101\102\103\104\105\106\107 \110\111\112\113\114\115\116\117 \
300 \120\121\122\123\124\125\126\127 \130\131\132\133\134\135\136\137 \
301 \140\141\142\143\144\145\146\147 \150\151\152\153\154\155\156\157 \
302 \160\161\162\163\164\165\166\167 \170\171\172\173\174\175\176\177}
303 substr: ${substr_3_2:rhubarb} ${s_-5_2:1234567} ${s_-5_2:12} ${s_-3_2:12}
304 substr: ${s_3:rhubarb} ${s_-2:rhubarb}
306 substr: ${substr_10:abc}
307 str2b64:${str2b64:abcd}
308 str2b64:${str2b64:The quick brown \n fox}
309 base64: ${base64:abcd}
310 base64: ${base64:The quick brown \n fox}
311 base64d:${base64d:YWJjZA==}
312 base64d:${base64d:VGhlIHF1aWNrIGJyb3duIAogZm94}
315 strlen: ${strlen:abcdefgh}
316 time_eval: ${time_eval:10s}
317 time_eval: ${time_eval:2h}
318 time_eval: ${time_eval:1d5m}
319 time_eval: ${time_eval:1w2d3h4m5s}
320 time_eval: ${time_eval:14}
321 time_eval: ${time_eval:rhubarb}
322 time_interval: ${time_interval:0}
323 time_interval: ${time_interval:44}
324 time_interval: ${time_interval:999999}
325 time_interval: ${time_interval:-1}
326 time_interval: ${time_interval:rhubarb}
328 # stat is a bit tricky, but some of the fields of the aux-var directory
329 # should be the same on all systems
331 stat: ${extract{mode}{${stat:DIR/aux-var}}}
332 stat: ${extract{smode}{${stat:DIR/aux-var}}}
333 stat: ${stat:/a/non/existent/file}
335 # "Operators" that have expanded arguments
337 hash: ${hash{3}{monty}} ${hash{5}{monty}} ${hash{4}{62}{monty python}}
338 hash: ${hash{3}{abc}}X ${hash{3}{ab}}X ${hash{3}{a}}X ${hash{3}{}}X
339 nhash: ${nhash{24}{monty}} ${nhash{8}{63}{monty python}}
340 length: ${length{10}{The quick brown fox}} ${length{10}{abc}}
341 substr: ${substr{3}{2}{rhubarb}} ${substr{-5}{2}{1234567}} ${substr{-5}{2}{12}} ${substr{-3}{2}{12}}
342 substr: ${substr{${if eq{1}{1}{-8}}}{${if eq{1}{0}{25}{1}}}{abcde}}
347 ${hash{nonnumber}{abcd}}
348 ${hash{3}{2}{4}{abcd}}
349 ${substr{-3}{-2}{abcd}}
353 addrss: ${if eq {1}{2}{${address:invalid}}{NO}}
354 domain: ${if eq {1}{2}{${domain:invalid}}{NO}}
355 escape: ${if eq {1}{2}{${escape:invalid}}{NO}}
356 expand: ${if eq {1}{2}{\$primary_hostname ${expand:\$invalid}}{NO}}
357 hash: ${if eq {1}{2}{${hash_3:invalid}}{NO}}
358 md5: ${if eq {1}{2}{${md5:invalid}}{NO}}
359 mask: ${if eq {1}{2}{${mask:invalid}}{NO}}
361 # Number suffixes in conditions
362 1k: ${if >{1}{1k}{n}{y}}
363 1K: ${if >{1}{1K}{n}{y}}
364 1M: ${if >{1}{1M}{n}{y}}
365 1G: ${if >{1}{1G}{n}{y}}
368 # >32b should work, >64b not
370 1 > 2047M ${if >{1}{2047M}{y}{n}}
371 1 > 2048M ${if >{1}{2048M}{y}{n}}
372 1 > 4096000000 ${if >{1}{4096000000}{y}{n}}
373 1 > 4096M ${if >{1}{4096M}{y}{n}}
374 1 > 4611686018427387904 ${if >{1}{4611686018427387904} {y}{n}}
375 1 > 46116860184273879040 ${if >{1}{46116860184273879040}{y}{n}}
379 2=2: ${if ={2}{2}{y}{n}}
380 2==2: ${if =={2}{2}{y}{n}}
381 3=2: ${if ={3}{2}{y}{n}}
382 2==3: ${if =={2}{3}{y}{n}}
383 !2=2: ${if !={2}{2}{y}{n}}
384 !2==2: ${if !=={2}{2}{y}{n}}
385 !3=2: ${if !={3}{2}{y}{n}}
386 !2==3: ${if !=={2}{3}{y}{n}}
387 2>3: ${if >{2}{3}{y}{n}}
388 3>3: ${if >{3}{3}{y}{n}}
389 4>3: ${if >{4}{3}{y}{n}}
390 1>-1: ${if >{1}{-1}{y}{n}}
391 2>=3: ${if >={2}{3}{y}{n}}
392 3>=3: ${if >={3}{3}{y}{n}}
393 4>=3: ${if >={4}{3}{y}{n}}
394 2<3: ${if <{2}{3}{y}{n}}
395 3<3: ${if <{3}{3}{y}{n}}
396 4<3: ${if <{4}{3}{y}{n}}
397 2<=3: ${if <={2}{3}{y}{n}}
398 3<=3: ${if <={3}{3}{y}{n}}
399 4<=3: ${if <={4}{3}{y}{n}}
400 5<=3: ${if <={ 5 } { 3 } {y}{n}}
401 -3<=1: ${if <={-3}{1}{y}{n}}
403 5>3k: ${if >{5 } {3k }{y}{n}}
404 5>3m: ${if >{5 } {3m }{y}{n}}
405 5>3z: ${if >{5 } {3z }{y}{n}}
406 5>a: ${if >{ 5 } {a}{y}{n}}
407 5>bad: ${if >{5 } {${lookup{trick}lsearch{DIR/aux-fixed/0002.lsearch}}} {y}{n}}
409 >0: ${if > {}{0}{y}{n}}
410 =: ${if = {}{}{y}{n}}
411 -2<: ${if < {-2}{}{y}{n}}
412 08>07: ${if > {08}{07}{y}{n}}
413 011=11: ${if = {011}{11}{y}{n}}
415 def:y ${if def:tod_log{y}{n}}
416 def:n ${if def:host{y}{n}}
417 def:f ${if def:post{y}{n}}
418 def:h_f ${if def:h_xxx {y}{n}}
419 def:h_f ${if def:h_xxx:{y}{n}}
420 def:d: ${if def:tod_log:{y}{n}}
422 exists: ${if exists{/etc/passwd}{y}{n}}
423 exists: ${if exists{/doesnt}{y}{n}}
425 eq: ${if eq{abc}{abc}{y}{n}}
426 eq: ${if eq{abc}{xyz}{y}{n}}
427 !eq: ${if !eq{abc}{abc}{y}{n}}
428 !eq: ${if !eq{abc}{xyz}{y}{n}}
430 eqi: ${if eqi{abc}{abc}{y}{n}}
431 eqi: ${if eqi{abc}{ABC}{y}{n}}
432 eqi: ${if eqi{abc}{xyz}{y}{n}}
433 !eqi: ${if !eqi{abc}{abc}{y}{n}}
434 !eqi: ${if !eqi{abc}{aBc}{y}{n}}
435 !eqi: ${if !eqi{abc}{xyz}{y}{n}}
437 lt: ${if lt{ABC}{abc}{y}{n}}
438 lti: ${if lti{ABC}{abc}{y}{n}}
439 le: ${if le{ABC}{abc}{y}{n}}
440 lei: ${if lei{ABC}{abc}{y}{n}}
441 gt: ${if gt{ABC}{abc}{y}{n}}
442 gti: ${if gti{ABC}{abc}{y}{n}}
443 ge: ${if ge{ABC}{abc}{y}{n}}
444 gei: ${if gei{ABC}{abc}{y}{n}}
446 isip: ${if isip {1.2.3.4}{y}{n}} 1.2.3.4
447 isip4: ${if isip4{1.2.3.4}{y}{n}} 1.2.3.4
448 isip6: ${if isip6{1.2.3.4}{y}{n}} 1.2.3.4
449 isip: ${if isip {::1.2.3.256}{y}{n}} ::1.2.3.256
450 isip4: ${if isip4{1.2.3.256}{y}{n}} 1.2.3.256
451 isip: ${if isip {1:2:3:4}{y}{n}} 1:2:3:4
452 isip4: ${if isip4{1:2:3:4}{y}{n}} 1:2:3:4
453 isip6: ${if isip6{1:2:3:4}{y}{n}} 1:2:3:4
454 isip: ${if isip {::1}{y}{n}} ::1
455 isip4: ${if isip4{::1}{y}{n}} ::1
456 isip6: ${if isip6{::1}{y}{n}} ::1
457 isip: ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
458 isip4: ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
459 isip6: ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
460 isip: ${if isip {fe80::1.2.3.4}{y}{n}} fe80::1.2.3.4
461 isip: ${if isip {rhubarb}{y}{n}} rhubarb
462 isip4: ${if isip4{rhubarb}{y}{n}} rhubarb
463 isip6: ${if isip6{rhubarb}{y}{n}} rhubarb
465 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
466 match: ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
467 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail}
468 match: ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail}
469 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail}
470 # check for empty capture group
471 match: ${if match{abc}{\N^(\S+)\s*(\S.+)*$\N}{<$2>}{}}
473 match_domain: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
474 match_domain: ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}}
475 match_domain: ${if match_domain{5.aa.bb}{+dlist}{yes}{no}}
476 match_domain: ${if match_domain{xxxyz}{+dlist}{yes}{no}}
477 match_domain: ${if match_domain{xyz}{+dlist}{yes}{no}}
479 ${if match{x@zz.aa.bb}{^(.*)} \
482 ${if match_domain{${domain:$1}}{+dlist}{[$1]}} \
487 ${if match{x@xxxabc}{^(.*)} \
490 ${if match_domain{${domain:$1}}{^\Nxxx(.*)\N}{[$1]}} \
495 match_address: ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}}
496 match_address: ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}}
498 match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}}
499 match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}}
501 match_ip: 01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}}
502 match_ip: 02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}}
503 match_ip: 03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}}
504 match_ip: 04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}}
505 match_ip: 05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}}
506 match_ip: 06 ${if match_ip{1.2.3.4}{:4.5.6.7}}
507 match_ip: 07 ${if match_ip{}{:4.5.6.7}}
508 match_ip: 08 ${if match_ip{V4NET.11.12.13}{+hlist}}
509 match_ip: 09 ${if match_ip{V4NET.11.12.14}{+hlist}}
510 match_ip: 10 ${if match_ip{192.168.3.4}{+hlist}}
511 match_ip: 11 ${if match_ip{somename}{+hlist}}
512 match_ip: 12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
513 match_ip: 13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
514 match_ip: 14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
515 match_ip: 15 ${if match_ip{abcd::dcba}{net-iplsearch;DIR/aux-fixed/0002.matchip}}
517 queue_running: ${if queue_running{y}{n}}
518 first_delivery: ${if first_delivery{y}{n}}
520 queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}}
521 first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}}
523 # acl expansion condition
524 acl if: ${if acl {{a_ret}} {Y:$value}{N:$value}}
525 acl if: ${if acl {{a_ret}{argY}} {Y:$value}{N:$value}}
526 acl if: ${if acl {{a_deny}{argN}{arg2}} {Y:$value}{N:$value}}
527 acl if: ${if acl {{a_defer}{argN}{arg2}} {Y:$value}{N:$value}}
529 # Default values for both if strings
531 \${if eq{1}{1}} >${if eq{1}{1}}<
532 \${if eq{1}{2}} >${if eq{1}{2}}<
534 # Lookups: DIR is the testing directory. In this test we can only use the
535 # lookups that are required in all cases.
537 ${lookup{postmaster}lsearch {DIR/aux-fixed/0002.aliases}{$value}fail}
538 ${lookup{postmaster}lsearch,ret=full{DIR/aux-fixed/0002.aliases}{$value}fail}
540 ${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
541 ${lookup{x@z}lsearch* {DIR/aux-fixed/0002.starat}{$value}fail}
542 ${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
543 ${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
545 ${lookup{x@y}lsearch*@,ret=full {DIR/aux-fixed/0002.starat}{$value}fail}
546 ${lookup{x@z}lsearch*,ret=full {DIR/aux-fixed/0002.starat}{$value}fail}
547 ${lookup{x@z}lsearch*@,ret=full {DIR/aux-fixed/0002.starat}{$value}fail}
548 ${lookup{x@w}lsearch*@,ret=full {DIR/aux-fixed/0002.starat}{$value}fail}
550 ${lookup{a.b.c.d} partial-lsearch {DIR/aux-fixed/0002.domains}{$value}fail}
551 ${lookup{x.y.z} partial-lsearch {DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
552 ${lookup{p.q} partial-lsearch {DIR/aux-fixed/0002.domains}{$value}fail}
553 ${lookup{o.p.q} partial-lsearch {DIR/aux-fixed/0002.domains}{$value}fail}
554 ${lookup{m.n.o.p.q}partial-lsearch {DIR/aux-fixed/0002.domains}{$value}fail}
555 ${lookup{x.y.z} partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
556 ${lookup{x.y.z} partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
558 ${lookup{a.b.c.d} partial-lsearch,ret=full {DIR/aux-fixed/0002.domains}{$value}fail}
559 ${lookup{x.y.z} partial-lsearch,ret=full {DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
560 ${lookup{p.q} partial-lsearch,ret=full {DIR/aux-fixed/0002.domains}{$value}fail}
561 ${lookup{o.p.q} partial-lsearch,ret=full {DIR/aux-fixed/0002.domains}{$value}fail}
562 ${lookup{m.n.o.p.q}partial-lsearch,ret=full {DIR/aux-fixed/0002.domains}{$value}fail}
563 ${lookup{x.y.z} partial1-lsearch,ret=full{DIR/aux-fixed/0002.domains}{$value}fail}
564 ${lookup{x.y.z} partial0-lsearch,ret=full{DIR/aux-fixed/0002.domains}{$value}fail}
566 q1: ${lookup{abc} lsearch{DIR/aux-fixed/0002.quoted}}
567 q2: ${lookup{xyz} lsearch{DIR/aux-fixed/0002.quoted}}
568 q3: ${lookup{pqr} lsearch{DIR/aux-fixed/0002.quoted}}
569 q4: ${lookup{a:b} lsearch{DIR/aux-fixed/0002.quoted}}
570 q5: ${lookup{"quoted"} lsearch{DIR/aux-fixed/0002.quoted}}
571 q6: ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}}
572 q7: ${lookup{b\\s} lsearch{DIR/aux-fixed/0002.quoted}}
574 q1f: ${lookup{abc} lsearch,ret=full{DIR/aux-fixed/0002.quoted}}
575 q2f: ${lookup{xyz} lsearch,ret=full{DIR/aux-fixed/0002.quoted}}
576 q3f: ${lookup{pqr} lsearch,ret=full{DIR/aux-fixed/0002.quoted}}
577 q4f: ${lookup{a:b} lsearch,ret=full{DIR/aux-fixed/0002.quoted}}
578 q5f: ${lookup{"quoted"} lsearch,ret=full{DIR/aux-fixed/0002.quoted}}
579 q6f: ${lookup{white space}lsearch,ret=full{DIR/aux-fixed/0002.quoted}}
580 q7f: ${lookup{b\\s} lsearch,ret=full{DIR/aux-fixed/0002.quoted}}
582 abc: ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}}
583 a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}}
584 ab.c: ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}}
585 xyz: ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}}
586 .Xyz: ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}}
587 .Zyz: ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}}
588 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
589 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
590 a:b: ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}}
591 a.b: ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}}
592 a..b: ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}}
593 a9b: ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}}
594 a99b: ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}}
596 # Should give the same results as above because expansion does nothing
598 abc: ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}}
599 a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}}
600 ab.c: ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}}
601 xyz: ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}}
602 .Xyz: ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}}
603 .Zyz: ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}}
604 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
605 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
606 a:b: ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}}
608 # Should fail because of no expansion
610 a.b: ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
611 a..b: ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
612 a9b: ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
613 a99b: ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
615 # But these should succeed
617 a\\:b: ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
618 a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}
620 # Some tests of case-(in)dependence
622 .MiXeD-CD: ${lookup{MiXeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
623 .MixeD-CD: ${lookup{MixeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
624 .MiXeD-Ncd: ${lookup{MiXeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
625 .MixeD-Ncd: ${lookup{MixeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
627 # IP address (CIDR) lookups
629 1.2.3.4: ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}
630 1.2.3.5: ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}}
631 1.2.3.5: ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}}
632 abcd::cdab: ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}}
633 192.168.1.2: ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}}
634 192.168.5.6: ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}}
635 abcd:abcd:: ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
636 abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
637 abcd:abcd::3 ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}}
638 rhubarb ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}}
641 # Nested Lookups - style 1
643 ${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
644 ${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
646 # Nested Lookups - style 2
648 ${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
649 ${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
651 # Other nesting tests
653 ${lookup{one}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{one}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{one}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
654 ${lookup{two}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{two}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{two}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
655 ${lookup{both}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{both}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{both}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
656 ${lookup{neither}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{neither}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{neither}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
658 # Lookup quotes for standardly expected lookups
660 lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
661 xxx ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
665 ${extract{B}{A=1 B=2 C=3}}
666 ${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}}
667 ${extract{2}{:}{1:2:3}}
668 ${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}}
669 empty:<${extract{D}{A=1 B=2 C=3}}>
670 empty:<${extract{4}{:}{1:2:3}}>
671 ${extract{C}{A=1 B=2 C=3}{<$value>}}
672 ${extract{3}{:}{1:2:3}{<$value>}}
673 empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}>
674 empty:<${extract{4}{:}{1:2:3}{<$value>}}>
675 ${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}}
676 ${extract{4}{:}{1:2:3}{<$value>}{no 4}}
677 ${extract{Z}{A=1 B=2 C=3}{<$value>}fail}
678 ${extract{4}{:}{1:2:3}{<$value>}fail}
679 ${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}}
680 ${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}}
681 ${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}}
682 ${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}}
683 ${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}}
684 ${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}}
685 ${extract{-3}{:,}{a,,b::c}}
686 ${extract{2}{:,}{a,,b::c}}
687 ${extract{3}{:,}{a,,b::c}}
688 ${extract{a-b}{X = "one two" a-b "three four" 5=99}}
691 ${extract{ 2 }{ }{a b c}}
693 ${map{a,1:b,2:c,3}{${extract{1}{,}{$item}{$value}{}}}}
694 ${map{a,1:b,2:c,3}{${extract{1}{,}{$item}{$value}{failcase}{bogus_argument}}}}
695 ${map{a,1:b,2:c,3}{${extract{1}{,}{$item}{$value}fail}}}
699 abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}}
700 abcdea a z ${tr{abcdea}{a}{z}}
701 abcdea a ${tr{abcdea}{a}{}}
702 abcdea abc z ${tr{abcdea}{abc}{z}}
705 "TrUe" ${if bool{TrUe}{true}{false}} EXPECT: true
706 "FALSE" ${if bool{FALSE}{true}{false}} EXPECT: false
707 " yes" ${if bool{ yes}{true}{false}} EXPECT: true
708 " no" ${if bool{ no}{true}{false}} EXPECT: false
709 "yes " ${if bool{yes }{true}{false}} EXPECT: true
710 "-1" ${if bool{-1}{true}{false}} EXPECT: true
711 "0" ${if bool{0}{true}{false}} EXPECT: false
712 "1" ${if bool{1}{true}{false}} EXPECT: true
713 " 0 " ${if bool{ 0 }{true}{false}} EXPECT: false
714 " 1 " ${if bool{ 1 }{true}{false}} EXPECT: true
715 "1111111111111111111" ${if bool{1111111111111111111}{true}{false}} EXPECT: true
716 "9" ${if bool{9}{true}{false}} EXPECT: true
717 " " ${if bool{ }{true}{false}} EXPECT: false
718 "text" ${if bool{text}{true}{false}} EXPECT: error
719 " text" ${if bool{ text}{true}{false}} EXPECT: error
720 "-text" ${if bool{-text}{true}{false}} EXPECT: error
721 "text " ${if bool{text }{true}{false}} EXPECT: error
722 " text " ${if bool{ text }{true}{false}} EXPECT: error
723 "00" ${if bool{00}{true}{false}} EXPECT: false
724 "!true" ${if !bool{true}{true}{false}} EXPECT: false
725 "!false" ${if !bool{false}{true}{false}} EXPECT: true
727 "TrUe" ${if bool_lax{TrUe}{true}{false}} EXPECT: true
728 "FALSE" ${if bool_lax{FALSE}{true}{false}} EXPECT: false
729 " yes" ${if bool_lax{ yes}{true}{false}} EXPECT: true
730 " no" ${if bool_lax{ no}{true}{false}} EXPECT: false
731 "yes " ${if bool_lax{yes }{true}{false}} EXPECT: true
732 "-1" ${if bool_lax{-1}{true}{false}} EXPECT: true
733 "0" ${if bool_lax{0}{true}{false}} EXPECT: false
734 "1" ${if bool_lax{1}{true}{false}} EXPECT: true
735 " 0 " ${if bool_lax{ 0 }{true}{false}} EXPECT: false
736 " 1 " ${if bool_lax{ 1 }{true}{false}} EXPECT: true
737 "1111111111111111111" ${if bool_lax{1111111111111111111}{true}{false}} EXPECT: true
738 "9" ${if bool_lax{9}{true}{false}} EXPECT: true
739 " " ${if bool_lax{ }{true}{false}} EXPECT: false
740 "text" ${if bool_lax{text}{true}{false}} EXPECT: true
741 " text" ${if bool_lax{ text}{true}{false}} EXPECT: true
742 "text " ${if bool_lax{text }{true}{false}} EXPECT: true
743 " text " ${if bool_lax{ text }{true}{false}} EXPECT: true
744 "00" ${if bool_lax{00}{true}{false}} EXPECT: true
745 "!true" ${if !bool_lax{true}{true}{false}} EXPECT: false
746 "!false" ${if !bool_lax{false}{true}{false}} EXPECT: true
751 <:abcd:> ${rfc2047:<:abcd:>}
752 <:ab cd:> ${rfc2047:<:ab cd:>}
753 long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
754 long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit by a long way; in fact this one will go over the 150 character limit}
758 ${rfc2047d:abcd abcd}
759 ${rfc2047d:<:abcd:> =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=}
760 ${rfc2047d:<:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=}
761 ${rfc2047d:Long: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit?=}
762 ${rfc2047d:Long: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fac?= =?iso-8859-8?Q?t_this_one_will_go_over_the_150_character_limit?=}
766 abcd ${from_utf8:abcd}
767 aÀÿd ${from_utf8:aÃ
\80ÿd}
768 toobig ${from_utf8:aĀd}
772 \${sg{abcdefabcdef}{abc}{xyz}} =${sg{abcdefabcdef}{abc}{xyz}}
773 \${sg{ab:xy::z}{:}{::}} =${sg{ab:xy::z}{:}{::}}
774 \${sg{abcdefabcdef}{(..)[^c]}{>\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>$1<}}
775 \${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}
776 \${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}
777 \${sg{abbab}{a*}{+}} =${sg{abbab}{a*}{+}}
782 ${readfile{DIR/aux-fixed/0002.readfile}}
783 ${readfile{DIR/aux-fixed/0002.readfile}{}}
784 ${readfile{DIR/aux-fixed/0002.readfile}{:}}
785 ${readfile{DIR/aux-fixed/0002.readfile}{ - }}
786 ${readfile{/non/exist/file}}
787 ${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}}
788 >${readfile{DIR/aux-fixed/0002.readfile}{!}}\
793 ${run{DIR/aux-fixed/0002.runfile 0}}
795 ${run{DIR/aux-fixed/0002.runfile 0}{1}{2}}
797 ${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}}
799 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}}
801 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}}
803 ${run{DIR/test-nonexist}{Y}{N}}
805 >>${run{DIR/bin/iefbr14}}<<
807 ${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
809 ${run,preexpand {DIR/aux-fixed/0002.runfile 0}}
814 ${prvs{userx@test.ex}{secret}}
815 ${prvs{userx@test.ex}{secret}{1}}
816 ${prvs{userx@test.ex}{secret}{8}}
820 ${prvs{userx@test.ex}{secret}{12}}
821 ${prvs{userx@test.ex}{secret}{rhubarb}}
822 ${prvs{userx@test.ex}{secret}{}}
824 # Correct checks; can't put explicit addresses in the tests, because they
825 # will change over time.
827 ${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}}
828 result=$prvscheck_result
830 ${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\
831 {>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}}
832 result=$prvscheck_result
834 ${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}}
835 result=$prvscheck_result
839 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}}
840 result=$prvscheck_result
842 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}}
843 result=$prvscheck_result
847 >>${prvscheck{userx@test.ex}{secret}}<<
848 result=$prvscheck_result
855 ${expand:abcd${tod_log}
857 ${if and {xyz}{a}{b}}
858 ${if and {{xya}}{a}{b}}
859 ${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}}
860 ${if eq {$h_xyz}{1}{y}{n}}
861 ${if eq {$h_xyz:}{1}{y}{n}
862 ${if def:h_xyz}{y}{n}}
863 ${if or {eq {}{}{yes}{no}}
864 ${if or {{eq {}{}{yes}{no}}
865 ${if or {{eq {}{}}{yes}{no}}
869 # Iterations: forany and forall
871 ${if forany{a:b:c}{eq{$item}{a}}{yes}{no}}
872 ${if forany{a:b:c}{eq{$item}{b}}{yes}{no}}
873 ${if forany{a:b:c}{eq{$item}{c}}{yes}{no}}
874 ${if forany {a:b:c} {eq {$item} {z}} {yes} {no}}
875 ${if !forany{a:b:c}{eq{$item}{z}}{yes}{no}}
876 ${if !forany{a:b:c}{eq{$item}{a}}{yes}{no}}
877 ${if forany{}{eq{$item}{a}}{yes}{no}}
878 ${if !forany{}{eq{$item}{a}}{yes}{no}}
879 ${if forany{<, $primary_hostname,foo,bar}{eq{$item}{$primary_hostname}}{yes}{no}}
881 ${if forany{}{yes}{no}}
882 ${if forany{a:b:c}{gt{$item}{a}{yes}{no}}
884 ${if forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
885 ${if forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
886 ${if forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
887 ${if forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
889 ${if !forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
890 ${if !forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
891 ${if !forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
892 ${if !forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
898 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
901 {outer=yes}{outer=no}} item='$item' (unset)
907 {$item: ${if !forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
910 {outer=yes}{outer=no}}
912 # Error inside nest - check message is helpful
916 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}{true}{false}}}\
919 {outer=yes}{outer=no}}
922 # Miscellaneous (for bug fixes, etc)
924 ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
929 ${env {NO_SUCH_VARIABLE} {oops, success} {correct}}
933 ${extract json {Url} \
934 { \{ \"Url\": \"http://www.example.com/image/481989943\",\
940 ${extract json {Width} \
941 { \{ \"Url\": \"http://www.example.com/image/481989943\",\
947 ${extract json {2} {[116, 943, 234, 38793]} }
948 ${extract json {2} {${extract json{IDs} {\{"other":"foo", "IDs": [116, 943, 234]\} }}} }
950 ${extract json {2} {["red", "green", "blue", "black"]} }
951 ${extract jsons{2} {["red", "green", "blue", "black"]} }
952 <${extract jsons{5} {["red", "green", "blue", "black"]} }>
955 ${extract json {seconds} { \{"hours":0, "mins":0, "seconds":59\} }}
956 ${extract json {seconds} {${extract json {2} { ["irrelevant", \{"hours":0, "mins":0, "seconds":59\}] }}}}
958 ${extract json{IDs}{ \{"IDs": \{"1":116, "2":943, "3":234\}\} }}
959 expect: {"1":116, "2":943, "3":234}
961 ${extract json{IDs}{ \{"id": \{"a":101, "b":102\}, "IDs": \{"1":116, "2":943, "3":234\}\} }}
962 expect: {"1":116, "2":943, "3":234}
964 <${extract json{nonexistent}{ \{"id": \{"a":101, "b":102\}, "IDs": \{"1":116, "2":943, "3":234\}\} }}>
966 <${extract jsons{nonexistent}{ \{"id": \{"a":101, "b":102\}, "IDs": \{"1":116, "2":943, "3":234\}\} }}>
969 ${if forany_json {[1, 2, 3]}{={$item}{1}}{yes}{no}}
970 ${if forany_jsons{["A", "B", "C"]}{eq{$item}{B}}{yes}{no}}
973 # Test "escape" with print_topbitchars
974 exim -be -DPTBC=print_topbitchars
975 escape: ${escape:B7·F2ò}
977 # Checkout expansion debugging
978 exim -d-all+expand -f sndr@dom -be
979 primary_hostname: $primary_hostname
980 sender_address: $sender_address
981 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
982 match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
983 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
984 match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}}
986 exim -d-all+expand+noutf8 -be
987 primary_hostname: $primary_hostname
988 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
989 match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
990 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
991 match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}}
993 # Sender host name and address etc, all unset
995 -be Sender host name and address etc, all unset
996 -oMa sender_host_address = $sender_host_address
997 sender_host_port = $sender_host_port
998 -oMaa sender_host_authenticated = $sender_host_authenticated
999 -oMai authenticated_id = $authenticated_id
1000 -oMas authenticated_sender = $authenticated_sender
1001 -oMi interface_address = $interface_address
1002 interface_port = $interface_port
1003 -oMr received_protocol = $received_protocol
1004 -oMs sender_host_name = $sender_host_name
1005 -oMt sender_ident = $sender_ident
1007 # Sender host name and address etc, all set except host name.
1008 exim -d-all+expand -be -oMa V4NET.0.0.1.1234 -oMaa AAA -oMai philip -oMas xx@yy.zz -oMi 1.1.1.1.99 -oMr special -oMt me
1009 -be Sender host name and address etc, all set except host name.
1010 -oMa sender_host_address = $sender_host_address
1011 sender_host_port = $sender_host_port
1012 -oMaa sender_host_authenticated = $sender_host_authenticated
1013 -oMai authenticated_id = $authenticated_id
1014 -oMas authenticated_sender = $authenticated_sender
1015 -oMi interface_address = $interface_address
1016 interface_port = $interface_port
1017 -oMr received_protocol = $received_protocol
1018 -oMt sender_ident = $sender_ident
1020 # Sender host name explicitly set
1021 exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name
1022 -be Sender host name explicitly set
1023 -oMa sender_host_address = $sender_host_address
1024 sender_host_port = $sender_host_port
1025 -oMs sender_host_name = $sender_host_name
1027 # Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
1028 exim -be -oMa V4NET.11.12.13
1029 be Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
1030 -oMs sender_host_name = $sender_host_name
1031 host_lookup_failed = $host_lookup_failed
1033 # Sender host name and protocol set by Sendmail-compatible option
1034 exim -be -pspecial:host.name
1035 -be Sender host name and protocol set by Sendmail-compatible option
1036 -p received_protocol = $received_protocol
1037 -p sender_host_name = $sender_host_name
1039 # Sender host name and address etc, all set except host name,
1040 # which should therefore be looked up from the address, but not if
1041 # we are skipping. The debug output for this test will show when
1042 # the lookup occurs.
1043 exim -d-all+host_lookup+expand -be -oMa V4NET.0.0.1.1234 -oMaa AAA -oMai philip -oMas xx@yy.zz -oMi 1.1.1.1.99 -oMr special -oMt me
1044 -be Sender host name and address etc, all set except host name
1045 -oMa sender_host_address = $sender_host_address
1046 sender_host_port = $sender_host_port
1047 -oMaa sender_host_authenticated = $sender_host_authenticated
1048 -oMai authenticated_id = $authenticated_id
1049 -oMas authenticated_sender = $authenticated_sender
1050 -oMi interface_address = $interface_address
1051 interface_port = $interface_port
1052 -oMr received_protocol = $received_protocol
1053 ----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}}
1054 -oMs sender_host_name = $sender_host_name
1055 -oMt sender_ident = $sender_ident
1057 # Test no auto host name lookup for query-style lookups
1058 exim -d -bh V4NET.0.0.1
1060 exim -d -bh V4NET.0.0.2
1062 # Test $reply_address
1063 exim -bh V4NET.0.0.0
1093 # Check RFC 2047 decoding with (default) length check
1094 exim -bh V4NET.0.0.0
1099 Subject: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_it_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fact_this_one_will_go_over_the_150_character_limit?=
1103 # Check RFC 2047 decoding with length check disabled
1104 exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0
1109 Subject: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_it_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fact_this_one_will_go_over_the_150_character_limit?=
1113 # Certain kind of error
1115 match_ip: 15 ${if match_ip{1.2.3.4}{1.2.3}}
1116 match_ip: 16 ${if match_ip{1.2.3.4}{1.2.3.4/abc}}
1118 # Operation of inlist and negated inlist
1120 ${if inlist{aa}{aa} {in list}{not in list}}
1121 ${if !inlist{aa}{aa} {not in list}{in list}}
1123 # listextract from tainted list
1124 exim -be -oMs my.target.host.name
1125 '\${listextract {2} {<. $sender_host_name}}' => '${listextract {2} {<. $sender_host_name}}'