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