mk-conf.sh: work with old shells (mdocmx.sh does it right, pfff!)
[s-mailx.git] / cc-test.sh
blob47d8965ca6a3d54a06f2822d2baf7a1372d7125b
1 #!/bin/sh -
2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
4 SNAIL=./s-nail
5 ARGS='-:/ -# -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
6 CONF=./make.rc
7 BODY=./.cc-body.txt
8 MBOX=./.cc-test.mbox
9 MAIL=/dev/null
11 if ( command -v command ) >/dev/null 2>&1; then :; else
12 command() {
13 shift
14 which "${@}"
18 MAKE="${MAKE:-`command -v make`}"
19 awk=${awk:-`command -v awk`}
20 cat=${cat:-`command -v cat`}
21 cksum=${cksum:-`command -v cksum`}
22 rm=${rm:-`command -v rm`}
23 sed=${sed:-`command -v sed`}
24 grep=${grep:-`command -v grep`}
26 if [ -z "${UTF8_LOCALE}" ]; then
27 UTF8_LOCALE=
28 if command -v locale >/dev/null 2>&1; then
29 UTF8_LOCALE=`(locale -a | ${grep} -i utf8 | uniq) 2>/dev/null`
33 ## -- >8 -- 8< -- ##
35 export SNAIL ARGS CONF BODY MBOX MAIL MAKE awk cat cksum rm sed grep
37 LC_ALL=C LANG=C ADDARG_UNI=-Sttycharset=UTF-8
38 TZ=UTC
39 # Wed Oct 2 01:50:07 UTC 1996
40 SOURCE_DATE_EPOCH=844221007
42 export LC_ALL LANG ADDARG_UNI TZ SOURCE_DATE_EPOCH
44 # Problem: force $SHELL to be a real shell. It seems some testing environments
45 # use nologin(?), but we need a real shell for command execution
46 if { echo ${SHELL} | ${grep} nologin; } >/dev/null 2>&1; then
47 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
48 SHELL=/bin/sh
49 export SHELL
52 ESTAT=0
54 usage() {
55 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
56 exit 1
59 CHECK_ONLY=
60 [ ${#} -gt 0 ] && {
61 [ "${1}" = --check-only ] || usage
62 [ ${#} -gt 2 ] && usage
63 [ ${#} -eq 2 ] && SNAIL="${2}"
64 [ -x "${SNAIL}" ] || usage
65 CHECK_ONLY=1
68 # cc_all_configs()
69 # Test all configs TODO doesn't cover all *combinations*, stupid!
70 cc_all_configs() {
71 < ${CONF} ${awk} '
72 BEGIN {
73 NOTME["OPT_AUTOCC"] = 1
74 NOTME["OPT_DEBUG"] = 1
75 NOTME["OPT_DEVEL"] = 1
76 NOTME["OPT_NOEXTMD5"] = 1
77 NOTME["OPT_NOALLOCA"] = 1
78 NOTME["OPT_NOMEMDBG"] = 1
79 NOTME["OPT_NYD2"] = 1
80 i = 0
82 /^[[:space:]]*OPT_/ {
83 sub(/^[[:space:]]*/, "")
84 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
85 # does not seem to be a compliant escape for =
86 #sub(/=.*$/, "")
87 $1 = substr($1, 1, index($1, "=") - 1)
88 if (NOTME[$1])
89 next
90 data[i++] = $1
92 END {
93 # Doing this completely sequentially and not doing make distclean in
94 # between runs should effectively result in lesser compilations.
95 # It is completely dumb nonetheless... TODO
96 for (j = 1; j < i; ++j) {
97 for (k = 1; k < j; ++k)
98 printf data[k] "=1 "
99 for (k = j; k < i; ++k)
100 printf data[k] "=0 "
101 printf "OPT_AUTOCC=1\n"
103 for (j = 1; j < i; ++j) {
104 for (k = 1; k < j; ++k)
105 printf data[k] "=0 "
106 for (k = j; k < i; ++k)
107 printf data[k] "=1 "
108 printf "OPT_AUTOCC=1\n"
110 # With debug
111 for (j = 1; j < i; ++j) {
112 for (k = 1; k < j; ++k)
113 printf data[k] "=1 "
114 for (k = j; k < i; ++k)
115 printf data[k] "=0 "
116 printf "OPT_AUTOCC=1\n"
117 printf "OPT_DEBUG=1\n"
119 for (j = 1; j < i; ++j) {
120 for (k = 1; k < j; ++k)
121 printf data[k] "=0 "
122 for (k = j; k < i; ++k)
123 printf data[k] "=1 "
124 printf "OPT_AUTOCC=1\n"
125 printf "OPT_DEBUG=1\n"
128 printf "CONFIG=NULL OPT_AUTOCC=0\n"
129 printf "CONFIG=NULL OPT_AUTOCC=1\n"
130 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
131 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
132 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
133 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
134 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
135 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
136 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
137 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
138 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
139 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
140 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
141 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
142 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
143 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
145 ' | while read c; do
146 printf "\n\n##########\n$c\n"
147 printf "\n\n##########\n$c\n" >&2
148 sh -c "${MAKE} ${c}"
149 t_all
150 done
151 ${MAKE} distclean
154 # cksum_test()
155 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
156 # cksum(1) of the resulting data and compare against the checksum $3
157 cksum_test() {
158 tid=${1} f=${2} s=${3}
159 printf "${tid}: "
160 #-e '/^Date:/d' \
161 csum="`${sed} -e '/^From /d' \
162 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
163 -e '/^\[-- Message/d' | ${cksum}`";
164 if [ "${csum}" = "${s}" ]; then
165 printf 'ok\n'
166 else
167 ESTAT=1
168 printf 'error: checksum mismatch (got %s)\n' "${csum}"
172 have_feat() {
173 ( "${SNAIL}" ${ARGS} -Xversion -Xx | ${grep} ${1} ) >/dev/null 2>&1
176 # t_behave()
177 # Basic (easily testable) behaviour tests
178 t_behave() {
179 __behave_wysh
180 __behave_ifelse
181 __behave_localopts
183 # FIXME __behave_alias
185 # FIXME __behave_mlist
187 have_feat +smime && __behave_smime
190 __behave_wysh() {
191 # Nestable conditions test
192 ${rm} -f "${BODY}" "${MBOX}"
193 ${cat} <<- '__EOT' > "${BODY}"
195 echo abcd
196 echo a'b'c'd'
197 echo a"b"c"d"
198 echo a$'b'c$'d'
199 echo 'abcd'
200 echo "abcd"
201 echo $'abcd'
202 echo a\ b\ c\ d
203 echo a 'b c' d
204 echo a "b c" d
205 echo a $'b c' d
207 echo 'a$`"\'
208 echo "a\$\`'\"\\"
209 echo $'a\$`\'\"\\'
210 echo $'a\$`\'"\\'
211 # DIET=CURD TIED=
212 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
213 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
214 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
216 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
217 echo a$'\u0041\u41\u0C1\U00000041\U41'c
218 echo a$'\377'c
219 echo a$'\0377'c
220 echo a$'\400'c
221 echo a$'\0400'c
222 echo a$'\U1100001'c
224 echo a$'b\0c'd
225 echo a$'b\00c'de
226 echo a$'b\000c'df
227 echo a$'b\0000c'dg
228 echo a$'b\x0c'dh
229 echo a$'b\x00c'di
230 echo a$'b\u0'dj
231 echo a$'b\u00'dk
232 echo a$'b\u000'dl
233 echo a$'b\u0000'dm
234 echo a$'b\U0'dn
235 echo a$'b\U00'do
236 echo a$'b\U000'dp
237 echo a$'b\U0000'dq
238 echo a$'b\U00000'dr
239 echo a$'b\U000000'ds
240 echo a$'b\U0000000'dt
241 echo a$'b\U00000000'du
243 echo a$'\cI'b
244 echo a$'\011'b
245 echo a$'\x9'b
246 echo a$'\u9'b
247 echo a$'\U9'b
248 echo a$'\c@'b c d
249 __EOT
251 if [ -z "${UTF8_LOCALE}" ]; then
252 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
253 else
254 < "${BODY}" DIET=CURD TIED= \
255 LC_ALL=${UTF8_LOCALE} "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
256 #abcd
257 #abcd
258 #abcd
259 #abcd
260 #abcd
261 #abcd
262 #abcd
263 #a b c d
264 #a b c d
265 #a b c d
266 #a b c d
267 #a$`"\
268 #a$`'"\
269 #a$`'"\
270 #a$`'"\
271 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
272 #aCURDbc${DIET}d${TIED}e
273 #a${DIET}b${TIED}cCURDde
274 #aAAAAAAAc
275 #aAAÁAAc
276 #aÿc
277 #aÿc
278 #abd
279 #abde
280 #abdf
281 #abdg
282 #ab\fdh
283 #abdi
284 #abdj
285 #abdk
286 #abdl
287 #abdm
288 #abdn
289 #abdo
290 #abdp
291 #abdq
292 #abdr
293 #abds
294 #abdt
295 #abdu
296 #a b
297 #a b
298 #a b
299 #a b
300 #a b
302 cksum_test behave:wysh_unicode "${MBOX}" '475805847 317'
305 < "${BODY}" DIET=CURD TIED= "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
306 #abcd
307 #abcd
308 #abcd
309 #abcd
310 #abcd
311 #abcd
312 #abcd
313 #a b c d
314 #a b c d
315 #a b c d
316 #a b c d
317 #a$`"\
318 #a$`'"\
319 #a$`'"\
320 #a$`'"\
321 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
322 #aCURDbc${DIET}d${TIED}e
323 #a${DIET}b${TIED}cCURDde
324 #aAAAAAAAc
325 #aAA\u0C1AAc
326 #aÿc
327 #aÿc
328 #abd
329 #abde
330 #abdf
331 #abdg
332 #ab\fdh
333 #abdi
334 #abdj
335 #abdk
336 #abdl
337 #abdm
338 #abdn
339 #abdo
340 #abdp
341 #abdq
342 #abdr
343 #abds
344 #abdt
345 #abdu
346 #a b
347 #a b
348 #a b
349 #a b
350 #a b
352 cksum_test behave:wysh_c "${MBOX}" '1473887148 321'
353 ${rm} -f "${BODY}" "${MBOX}"
356 __behave_ifelse() {
357 # Nestable conditions test
358 ${rm} -f "${MBOX}"
359 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
360 if 0
361 echo 1.err
362 else
363 echo 1.ok
364 endif
365 if 1
366 echo 2.ok
367 else
368 echo 2.err
369 endif
370 if $dietcurd
371 echo 3.err
372 else
373 echo 3.ok
374 endif
375 set dietcurd=yoho
376 if $dietcurd
377 echo 4.ok
378 else
379 echo 4.err
380 endif
381 if $dietcurd == 'yoho'
382 echo 5.ok
383 else
384 echo 5.err
385 endif
386 if $dietcurd != 'yoho'
387 echo 6.err
388 else
389 echo 6.ok
390 endif
391 # Nesting
392 if faLse
393 echo 7.err1
394 if tRue
395 echo 7.err2
396 if yEs
397 echo 7.err3
398 else
399 echo 7.err4
400 endif
401 echo 7.err5
402 endif
403 echo 7.err6
404 else
405 echo 7.ok7
406 if YeS
407 echo 7.ok8
408 if No
409 echo 7.err9
410 else
411 echo 7.ok9
412 endif
413 echo 7.ok10
414 else
415 echo 7.err11
416 if yeS
417 echo 7.err12
418 else
419 echo 7.err13
420 endif
421 endif
422 echo 7.ok14
423 endif
424 if r
425 echo 8.ok1
426 if R
427 echo 8.ok2
428 else
429 echo 8.err2
430 endif
431 echo 8.ok3
432 else
433 echo 8.err1
434 endif
435 if s
436 echo 9.err1
437 else
438 echo 9.ok1
439 if S
440 echo 9.err2
441 else
442 echo 9.ok2
443 endif
444 echo 9.ok3
445 endif
446 # `elif'
447 if $dietcurd == 'yohu'
448 echo 10.err1
449 elif $dietcurd == 'yoha'
450 echo 10.err2
451 elif $dietcurd == 'yohe'
452 echo 10.err3
453 elif $dietcurd == 'yoho'
454 echo 10.ok1
455 if $dietcurd == 'yohu'
456 echo 10.err4
457 elif $dietcurd == 'yoha'
458 echo 10.err5
459 elif $dietcurd == 'yohe'
460 echo 10.err6
461 elif $dietcurd == 'yoho'
462 echo 10.ok2
463 if $dietcurd == 'yohu'
464 echo 10.err7
465 elif $dietcurd == 'yoha'
466 echo 10.err8
467 elif $dietcurd == 'yohe'
468 echo 10.err9
469 elif $dietcurd == 'yoho'
470 echo 10.ok3
471 else
472 echo 10.err10
473 endif
474 else
475 echo 10.err11
476 endif
477 else
478 echo 10.err12
479 endif
480 # integer conversion, <..>..
481 set dietcurd=10
482 if $dietcurd < 11
483 echo 11.ok1
484 if $dietcurd > 9
485 echo 11.ok2
486 else
487 echo 11.err2
488 endif
489 if $dietcurd == 10
490 echo 11.ok3
491 else
492 echo 11.err3
493 endif
494 if $dietcurd >= 10
495 echo 11.ok4
496 else
497 echo 11.err4
498 endif
499 if $dietcurd <= 10
500 echo 11.ok5
501 else
502 echo 11.err5
503 endif
504 if $dietcurd >= 11
505 echo 11.err6
506 else
507 echo 11.ok6
508 endif
509 if $dietcurd <= 9
510 echo 11.err7
511 else
512 echo 11.ok7
513 endif
514 else
515 echo 11.err1
516 endif
517 set dietcurd=Abc
518 if $dietcurd < aBd
519 echo 12.ok1
520 if $dietcurd > abB
521 echo 12.ok2
522 else
523 echo 12.err2
524 endif
525 if $dietcurd == aBC
526 echo 12.ok3
527 else
528 echo 12.err3
529 endif
530 if $dietcurd >= AbC
531 echo 12.ok4
532 else
533 echo 12.err4
534 endif
535 if $dietcurd <= ABc
536 echo 12.ok5
537 else
538 echo 12.err5
539 endif
540 if $dietcurd >= abd
541 echo 12.err6
542 else
543 echo 12.ok6
544 endif
545 if $dietcurd <= abb
546 echo 12.err7
547 else
548 echo 12.ok7
549 endif
550 else
551 echo 12.err1
552 endif
553 if $dietcurd =@ aB
554 echo 13.ok
555 else
556 echo 13.err
557 endif
558 if $dietcurd =@ bC
559 echo 14.ok
560 else
561 echo 14.err
562 endif
563 if $dietcurd !@ aB
564 echo 15.err
565 else
566 echo 15.ok
567 endif
568 if $dietcurd !@ bC
569 echo 15.err
570 else
571 echo 15.ok
572 endif
573 if $dietcurd =@ Cd
574 echo 16.err
575 else
576 echo 16.ok
577 endif
578 if $dietcurd !@ Cd
579 echo 17.ok
580 else
581 echo 17.err
582 endif
583 set diet=abc curd=abc
584 if $diet == $curd
585 echo 18.ok
586 else
587 echo 18.err
588 endif
589 set diet=abc curd=abcd
590 if $diet != $curd
591 echo 19.ok
592 else
593 echo 19.err
594 endif
595 # 1. Shitty grouping capabilities as of today
596 unset diet curd ndefined
597 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
598 [ yes ]
599 echo 20.ok
600 else
601 echo 20.err
602 endif
603 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
604 echo 21.ok
605 else
606 echo 21.err
607 endif
608 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
609 echo 22.ok
610 else
611 echo 22.err
612 endif
613 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
614 echo 23.ok
615 else
616 echo 23.err
617 endif
618 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
619 echo 24.err
620 else
621 echo 24.ok
622 endif
623 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
624 && [ no ] || [ yes ]
625 echo 25.ok
626 else
627 echo 25.err
628 endif
629 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
630 echo 26.ok
631 else
632 echo 26.err
633 endif
634 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
635 echo 27.err
636 else
637 echo 27.ok
638 endif
639 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
640 echo 28.err
641 else
642 echo 28.ok
643 endif
644 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
645 echo 29.err
646 else
647 echo 29.ok
648 endif
649 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
650 echo 30.err
651 else
652 echo 30.ok
653 endif
654 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
655 echo 31.ok
656 else
657 echo 31.err
658 endif
659 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
660 echo 32.err
661 else
662 echo 32.ok
663 endif
664 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
665 echo 33.ok
666 else
667 echo 33.err
668 endif
669 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
670 echo 34.err
671 else
672 echo 34.ok
673 endif
674 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
675 echo 35.ok
676 else
677 echo 35.err
678 endif
679 set diet=yo curd=ho
680 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
681 echo 36.err
682 else
683 echo 36.ok
684 endif
685 set ndefined
686 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
687 echo 37.ok
688 else
689 echo 37.err
690 endif
691 # 2. Shitty grouping capabilities as of today
692 unset diet curd ndefined
693 if [ false || false || true ] && [ false || true ] && yes
694 echo 40.ok
695 else
696 echo 40.err
697 endif
698 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
699 echo 41.ok
700 else
701 echo 41.err
702 endif
703 if [ 1 || 0 || 0 || 0 ]
704 echo 42.ok
705 else
706 echo 42.err
707 endif
708 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
709 echo 43.ok
710 else
711 echo 43.err
712 endif
713 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
714 echo 44.err
715 else
716 echo 44.ok
717 endif
718 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
719 echo 45.ok
720 else
721 echo 45.err
722 endif
723 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
724 echo 46.ok
725 else
726 echo 46.err
727 endif
728 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
729 echo 47.err
730 else
731 echo 47.ok
732 endif
733 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
734 echo 48.err
735 else
736 echo 48.ok
737 endif
738 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
739 echo 49.err
740 else
741 echo 49.ok
742 endif
743 if 1 || 0 || 0 || 0 && 0
744 echo 50.err
745 else
746 echo 50.ok
747 endif
748 if 1 || 0 || 0 || 0 && 1
749 echo 51.ok
750 else
751 echo 51.err
752 endif
753 if 0 || 0 || 0 || 1 && 0
754 echo 52.err
755 else
756 echo 52.ok
757 endif
758 if 0 || 0 || 0 || 1 && 1
759 echo 53.ok
760 else
761 echo 53.err
762 endif
763 if 0 || 0 || 0 || 1 && 0 || 1 && 0
764 echo 54.err
765 else
766 echo 54.ok
767 endif
768 if 0 || 0 || 0 || 1 && 0 || 1 && 1
769 echo 55.ok
770 else
771 echo 55.err
772 endif
773 set diet=yo curd=ho
774 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
775 echo 56.err
776 else
777 echo 56.ok
778 endif
779 if $diet == 'yo' && $curd == 'ho' && $ndefined
780 echo 57.err
781 else
782 echo 57.ok
783 endif
784 set ndefined
785 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
786 echo 57.ok
787 else
788 echo 57.err
789 endif
790 if $diet == 'yo' && $curd == 'ho' && $ndefined
791 echo 58.ok
792 else
793 echo 58.err
794 endif
795 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
796 echo 59.ok
797 else
798 echo 59.err
799 endif
800 # Some more en-braced variables
801 set diet=yo curd=ho
802 if ${diet} == ${curd}
803 echo 70.err
804 else
805 echo 70.ok
806 endif
807 if ${diet} != ${curd}
808 echo 71.ok
809 else
810 echo 71.err
811 endif
812 if $diet == ${curd}
813 echo 72.err
814 else
815 echo 72.ok
816 endif
817 if ${diet} == $curd
818 echo 73.err
819 else
820 echo 73.ok
821 endif
822 # Unary !
823 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
824 echo 80.ok
825 else
826 echo 80.err
827 endif
828 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
829 echo 81.ok
830 else
831 echo 81.err
832 endif
833 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
834 echo 82.ok
835 else
836 echo 82.err
837 endif
838 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
839 echo 83.err
840 else
841 echo 83.ok
842 endif
843 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
844 echo 84.err
845 else
846 echo 84.ok
847 endif
848 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
849 echo 85.err
850 else
851 echo 85.ok
852 endif
853 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
854 echo 86.err
855 else
856 echo 86.ok
857 endif
858 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
859 echo 87.ok
860 else
861 echo 87.err
862 endif
863 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
864 echo 88.ok
865 else
866 echo 88.err
867 endif
868 # Unary !, odd
869 if ! 0 && ! ! 1 && ! ! ! 0 && 3
870 echo 90.ok
871 else
872 echo 90.err
873 endif
874 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
875 echo 91.ok
876 else
877 echo 91.err
878 endif
879 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
880 echo 92.ok
881 else
882 echo 92.err
883 endif
884 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
885 echo 93.err
886 else
887 echo 93.ok
888 endif
889 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
890 echo 94.ok
891 else
892 echo 94.err
893 endif
894 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
895 echo 95.err
896 else
897 echo 95.ok
898 endif
899 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
900 echo 96.err
901 else
902 echo 96.ok
903 endif
904 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
905 echo 97.ok
906 else
907 echo 97.err
908 endif
909 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
910 echo 98.ok
911 else
912 echo 98.err
913 endif
914 __EOT
915 cksum_test behave:if-normal "${MBOX}" '557629289 631'
917 if have_feat +regex; then
918 ${rm} -f "${MBOX}"
919 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
920 set dietcurd=yoho
921 if $dietcurd =~ '^yo.*'
922 echo 1.ok
923 else
924 echo 1.err
925 endif
926 if $dietcurd =~ '^yoho.+'
927 echo 2.err
928 else
929 echo 2.ok
930 endif
931 if $dietcurd !~ '.*ho$'
932 echo 3.err
933 else
934 echo 3.ok
935 endif
936 if $dietcurd !~ '.+yoho$'
937 echo 4.ok
938 else
939 echo 4.err
940 endif
941 if [ $dietcurd !~ '.+yoho$' ]
942 echo 5.ok
943 else
944 echo 5.err
945 endif
946 if ! [ $dietcurd =~ '.+yoho$' ]
947 echo 6.ok
948 else
949 echo 6.err
950 endif
951 if ! ! [ $dietcurd !~ '.+yoho$' ]
952 echo 7.ok
953 else
954 echo 7.err
955 endif
956 if ! [ ! [ $dietcurd !~ '.+yoho$' ] ]
957 echo 8.ok
958 else
959 echo 8.err
960 endif
961 if [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
962 echo 9.ok
963 else
964 echo 9.err
965 endif
966 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
967 echo 10.err
968 else
969 echo 10.ok
970 endif
971 if ! ! ! $dietcurd !~ '.+yoho$'
972 echo 11.err
973 else
974 echo 11.ok
975 endif
976 if ! ! ! $dietcurd =~ '.+yoho$'
977 echo 12.ok
978 else
979 echo 12.err
980 endif
981 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
982 echo 13.ok
983 else
984 echo 13.err
985 endif
986 set diet=abc curd='^abc$'
987 if $diet =~ $curd
988 echo 14.ok
989 else
990 echo 14.err
991 endif
992 set diet=abc curd='^abcd$'
993 if $diet !~ $curd
994 echo 15.ok
995 else
996 echo 15.err
997 endif
998 __EOT
999 cksum_test behave:if-regex "${MBOX}" '439960016 81'
1003 __behave_localopts() {
1004 # Nestable conditions test
1005 ${rm} -f "${MBOX}"
1006 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1007 define t2 {
1008 echo in: t2
1009 set t2=t2
1010 echo $t2
1012 define t1 {
1013 echo in: t1
1014 set gv1=gv1
1015 localopts on
1016 set lv1=lv1 lv2=lv2
1017 set lv3=lv3
1018 call t2
1019 localopts off
1020 set gv2=gv2
1021 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1023 define t0 {
1024 echo in: t0
1025 call t1
1026 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1027 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1029 account trouble {
1030 echo in: trouble
1031 call t0
1033 call t0
1034 unset gv1 gv2
1035 account trouble
1036 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1037 account null
1038 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1039 __EOT
1040 #in: t0
1041 #in: t1
1042 #in: t2
1044 #gv1 lv1 lv2 lv3 gv2, t2
1045 #gv1 gv2,
1046 #gv1 gv2,
1047 #in: trouble
1048 #in: t0
1049 #in: t1
1050 #in: t2
1052 #gv1 lv1 lv2 lv3 gv2, t2
1053 #gv1 gv2,
1054 #gv1 gv2,
1055 #/dev/null: 0 messages
1056 #active trouble: gv1 gv2,
1057 #/dev/null: 0 messages
1058 #active null: ,
1059 cksum_test behave:localopts "${MBOX}" '2679576177 236'
1062 __behave_smime() { # FIXME add test/ dir, unroll tests therein, regular enable!
1063 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1064 ${cat} <<-_EOT > ./t.conf
1065 [ req ]
1066 default_bits = 1024
1067 default_keyfile = keyfile.pem
1068 distinguished_name = req_distinguished_name
1069 attributes = req_attributes
1070 prompt = no
1071 output_password =
1073 [ req_distinguished_name ]
1074 C = GB
1075 ST = Over the
1076 L = rainbow
1077 O = S-nail
1078 OU = S-nail.smime
1079 CN = S-nail.test
1080 emailAddress = test@localhost
1082 [ req_attributes ]
1083 challengePassword =
1084 _EOT
1085 openssl req -x509 -nodes -days 3650 -config ./t.conf \
1086 -newkey rsa:1024 -keyout ./tkey.pem -out ./tcert.pem >/dev/null 2>&1
1087 ${rm} -f ./t.conf
1088 ${cat} ./tkey.pem ./tcert.pem > ./tpair.pem
1090 printf "behave:s/mime:sign/verify: "
1091 echo bla | "${SNAIL}" ${ARGS} \
1092 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1093 -Ssmime-sign -Sfrom=test@localhost \
1094 -s 'S/MIME test' ./VERIFY
1095 printf 'verify\nx\n' |
1096 "${SNAIL}" ${ARGS} \
1097 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1098 -Ssmime-sign -Sfrom=test@localhost \
1099 -Sbatch-exit-on-error -R \
1100 -f ./VERIFY >/dev/null 2>&1
1101 if [ $? -eq 0 ]; then
1102 printf 'ok\n'
1103 else
1104 ESTAT=1
1105 printf 'error: verification failed\n'
1106 ${rm} -f ./VERIFY ./tkey.pem ./tcert.pem ./tpair.pem
1107 return
1109 ${rm} -rf ./VERIFY
1111 # (signing +) encryption / decryption
1112 ${cat} <<-_EOT > ./tsendmail.sh
1113 #!/bin/sh -
1114 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./ENCRYPT
1115 _EOT
1116 chmod 0755 ./tsendmail.sh
1118 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1119 echo bla |
1120 "${SNAIL}" ${ARGS} \
1121 -Ssmime-force-encryption \
1122 -Ssmime-encrypt-recei@ver.com=./tpair.pem \
1123 -Smta=./tsendmail.sh \
1124 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1125 -Ssmime-sign -Sfrom=test@localhost \
1126 -s 'S/MIME test' recei@ver.com
1127 # TODO CHECK
1128 printf 'decrypt ./DECRYPT\nfi ./DECRYPT\nverify\nx\n' |
1129 "${SNAIL}" ${ARGS} \
1130 -Ssmime-force-encryption \
1131 -Ssmime-encrypt-recei@ver.com=./tpair.pem \
1132 -Smta=./tsendmail.sh \
1133 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1134 -Ssmime-sign -Sfrom=test@localhost \
1135 -Sbatch-exit-on-error -R \
1136 -f ./ENCRYPT >/dev/null 2>&1
1137 if [ $? -eq 0 ]; then
1138 printf 'ok\n'
1139 else
1140 ESTAT=1
1141 printf 'error: decryption+verification failed\n'
1143 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1144 -e \
1145 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1146 < ./DECRYPT > ./ENCRYPT
1147 cksum_test ".. checksum of decrypted content" "./ENCRYPT" '82649489 454'
1149 ${rm} -f ./DECRYPT
1150 printf "behave:s/mime:encrypt/decrypt: "
1151 echo bla | "${SNAIL}" ${ARGS} \
1152 -Ssmime-force-encryption \
1153 -Ssmime-encrypt-recei@ver.com=./tpair.pem \
1154 -Smta=./tsendmail.sh \
1155 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1156 -Sfrom=test@localhost \
1157 -s 'S/MIME test' recei@ver.com
1158 printf 'decrypt ./DECRYPT\nx\n' | "${SNAIL}" ${ARGS} \
1159 -Ssmime-force-encryption \
1160 -Ssmime-encrypt-recei@ver.com=./tpair.pem \
1161 -Smta=./tsendmail.sh \
1162 -Ssmime-ca-file=./tcert.pem -Ssmime-sign-cert=./tpair.pem \
1163 -Sfrom=test@localhost \
1164 -Sbatch-exit-on-error -R \
1165 -f ./ENCRYPT >/dev/null 2>&1
1166 if [ $? -eq 0 ]; then
1167 printf 'ok\n'
1168 else
1169 ESTAT=1
1170 printf 'error: decryption failed\n'
1171 # FALLTHRU
1173 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1174 < ./DECRYPT > ./ENCRYPT
1175 cksum_test ".. checksum of decrypted content" "./ENCRYPT" '2694938815 239'
1177 ${rm} -f ./tsendmail.sh ./ENCRYPT ./DECRYPT \
1178 ./tkey.pem ./tcert.pem ./tpair.pem
1181 # t_content()
1182 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1183 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1184 # Note we unfortunately need to place some statements without proper
1185 # indentation because of continuation problems
1186 t_content() {
1187 ${rm} -f "${BODY}" "${MBOX}"
1189 # MIME encoding (QP) stress message body
1190 printf \
1191 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1192 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1193 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
1194 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
1195 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
1196 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
1197 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
1198 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
1199 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
1200 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
1201 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
1202 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
1203 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
1204 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
1205 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
1206 "auf den zeilen vorher.\r\n"\
1207 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
1208 ".\r\n"\
1209 "Die letzte Zeile war nur ein Punkt.\r\n"\
1210 "..\r\n"\
1211 "Das waren deren zwei.\r\n"\
1212 " \r\n"\
1213 "Die letzte Zeile war ein Leerschritt.\n"\
1214 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
1215 "Prösterchen.\r\n"\
1216 ".\n"\
1217 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
1218 "..\n"\
1219 "Das waren deren zwei. ditto.\n"\
1220 "Prösterchen.\n"\
1221 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
1222 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
1223 "auf den zeilen vorher.\n"\
1224 "ditto.\n"\
1225 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
1226 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
1227 "\n"\
1228 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1229 "\n"\
1230 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1231 "3\n"\
1232 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1233 "34\n"\
1234 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1235 "345\n"\
1236 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1237 "3456\n"\
1238 "QP am Zeilenende über soft-nl hinweg\n"\
1239 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1240 "ö123\n"\
1241 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1242 "1ö23\n"\
1243 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1244 "12ö3\n"\
1245 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1246 "123ö\n"\
1247 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
1248 " \n"\
1249 "Die letzte Zeile war ein Leerschritt.\n"\
1250 ' '\
1251 > "${BODY}"
1253 # MIME encoding (QP) stress message subject
1254 SUB="Äbrä Kä?dä=brö Fü?di=bus? \
1255 adadaddsssssssddddddddddddddddddddd\
1256 ddddddddddddddddddddddddddddddddddd\
1257 ddddddddddddddddddddddddddddddddddd\
1258 dddddddddddddddddddd Hallelulja? Od\
1259 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1260 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1261 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1262 fffffffffffffffffffffffffffffffffff\
1263 fffffffffffffffffffff ggggggggggggg\
1264 ggggggggggggggggggggggggggggggggggg\
1265 ggggggggggggggggggggggggggggggggggg\
1266 ggggggggggggggggggggggggggggggggggg\
1267 gggggggggggggggg"
1269 # Three tests for MIME encodign and (a bit) content classification.
1270 # At the same time testing -q FILE, < FILE and -t FILE
1272 ${rm} -f "${MBOX}"
1273 < "${BODY}" "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1274 -a "${BODY}" -s "${SUB}" "${MBOX}"
1275 cksum_test content:001 "${MBOX}" '2886124440 6413'
1277 ${rm} -f "${MBOX}"
1278 < /dev/null "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1279 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
1280 cksum_test content:002 "${MBOX}" '2886124440 6413'
1282 ${rm} -f "${MBOX}"
1283 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
1284 ${cat} "${BODY}"
1285 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
1286 cksum_test content:003 "${MBOX}" '2886124440 6413'
1288 # Test for [260e19d] (Juergen Daubert)
1289 ${rm} -f "${MBOX}"
1290 echo body | "${SNAIL}" ${ARGS} "${MBOX}"
1291 cksum_test content:004 "${MBOX}" '4004005686 49'
1293 # Sending of multiple mails in a single invocation
1294 ${rm} -f "${MBOX}"
1295 ( printf "m ${MBOX}\n~s subject1\nE-Mail Körper 1\n~.\n" &&
1296 printf "m ${MBOX}\n~s subject2\nEmail body 2\n~.\n" &&
1297 echo x
1298 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI}
1299 cksum_test content:005 "${MBOX}" '2157252578 260'
1301 ## $BODY CHANGED
1303 # "Test for" [d6f316a] (Gavin Troy)
1304 ${rm} -f "${MBOX}"
1305 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
1306 "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="${cat}" > "${BODY}"
1307 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1308 cksum_test content:006 "${MBOX}" '2273863401 83'
1310 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
1311 ${rm} -f "${MBOX}"
1312 ${awk} 'BEGIN{
1313 for(i = 0; i < 10000; ++i)
1314 printf "\xC3\xBC"
1315 #printf "\xF0\x90\x87\x90"
1316 }' | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
1317 cksum_test content:007 "${MBOX}" '1754234717 61767'
1319 ## Test some more corner cases for header bodies (as good as we can today) ##
1322 ${rm} -f "${MBOX}"
1323 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1324 -s 'a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲a̲b̲c̲d̲e̲f̲h̲i̲k̲l̲m̲n̲o̲r̲s̲t̲u̲v̲w̲x̲z̲' \
1325 "${MBOX}"
1326 cksum_test content:008 "${MBOX}" '4279661351 326'
1328 # Single word (overlong line split -- bad standard! Requires injection of
1329 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
1330 ${rm} -f "${MBOX}"
1331 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
1332 echo | "${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
1333 cksum_test content:009 "${MBOX}" '223283022 1669'
1335 # Combination of encoded words, space and tabs of varying sort
1336 ${rm} -f "${MBOX}"
1337 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1338 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
1339 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
1340 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
1341 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
1342 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
1343 "${MBOX}"
1344 cksum_test content:010 "${MBOX}" '2637105063 542'
1346 # Overlong multibyte sequence that must be forcefully split
1347 # todo This works even before v15.0, but only by accident
1348 ${rm} -f "${MBOX}"
1349 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1350 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1351 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
1352 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
1353 "${MBOX}"
1354 cksum_test content:011 "${MBOX}" '979048840 610'
1356 # Trailing WS
1357 ${rm} -f "${MBOX}"
1358 echo | "${SNAIL}" ${ARGS} \
1359 -s "1-1 B2 B3 B4 B5 B6 B\
1360 1-2 B2 B3 B4 B5 B6 B\
1361 1-3 B2 B3 B4 B5 B6 B\
1362 1-4 B2 B3 B4 B5 B6 B\
1363 1-5 B2 B3 B4 B5 B6 B\
1364 1-6 B2 B3 B4 B5 B6 " \
1365 "${MBOX}"
1366 cksum_test content:012 "${MBOX}" '1497528261 248'
1368 # Leading and trailing WS
1369 ${rm} -f "${MBOX}"
1370 echo | "${SNAIL}" ${ARGS} \
1371 -s " 2-1 B2 B3 B4 B5 B6 B\
1372 1-2 B2 B3 B4 B5 B6 B\
1373 1-3 B2 B3 B4 B5 B6 B\
1374 1-4 B2 B3 B4 B5 B6 " \
1375 "${MBOX}"
1376 cksum_test content:013 "${MBOX}" '1588208111 187'
1378 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
1379 # have a (better) test framework materialize a quick shot
1380 ${rm} -f "${MBOX}"
1381 : > "ma'ger.txt"
1382 : > "mä'ger.txt"
1383 : > 'diet\ is \curd.txt'
1384 : > 'diet "is" curd.txt'
1385 : > höde-tröge.txt
1386 : > höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt
1387 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
1388 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
1389 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1390 echo bla | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1391 -a "ma'ger.txt" -a "mä'ger.txt" \
1392 -a 'diet\ is \curd.txt' -a 'diet "is" curd.txt' \
1393 -a höde-tröge.txt \
1394 -a höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt \
1395 -a höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1396 -a hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1397 -a ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
1398 "${MBOX}"
1399 ${rm} -f "ma'ger.txt" "mä'ger.txt" 'diet\ is \curd.txt' \
1400 'diet "is" curd.txt' höde-tröge.txt \
1401 höde__tröge__müde__dätte__hätte__vülle__gülle__äse__äße__säuerliche__kräuter__österliche__grüße__mäh.txt \
1402 höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
1403 hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
1404 ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
1405 cksum_test content:14 "${MBOX}" '589846634 2491'
1406 # `resend' test
1407 printf "Resend ${BODY}\nx\n" | "${SNAIL}" ${ARGS} -f "${MBOX}"
1408 cksum_test content:14-2 "${MBOX}" '589846634 2491'
1410 ${rm} -f "${BODY}" "${MBOX}"
1413 t_all() {
1414 if have_feat +devel; then
1415 ARGS="${ARGS} -Smemdebug"
1416 export ARGS
1418 t_behave
1419 t_content
1422 if [ -z "${CHECK_ONLY}" ]; then
1423 cc_all_configs
1424 else
1425 t_all
1428 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
1430 exit ${ESTAT}
1431 # s-sh-mode