Support `vput' for `cwd'
[s-mailx.git] / cc-test.sh
blobe101943ce1d76b20dc0c8a2a6d7c9bbf269e63e7
1 #!/bin/sh -
2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
4 SNAIL=./s-nail
5 ARGS='-:/ -# -Sencoding=quoted-printable -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 TRAP_EXIT_ADDONS=
81 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
82 trap "exit 1" HUP INT TERM
84 # cc_all_configs()
85 # Test all configs TODO doesn't cover all *combinations*, stupid!
86 cc_all_configs() {
87 < ${CONF} ${awk} '
88 BEGIN {
89 NOTME["OPT_AUTOCC"] = 1
90 NOTME["OPT_DEBUG"] = 1
91 NOTME["OPT_DEVEL"] = 1
92 NOTME["OPT_NOEXTMD5"] = 1
93 NOTME["OPT_NOMEMDBG"] = 1
94 NOTME["OPT_NYD2"] = 1
95 i = 0
97 /^[[:space:]]*OPT_/ {
98 sub(/^[[:space:]]*/, "")
99 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
100 # does not seem to be a compliant escape for =
101 #sub(/=.*$/, "")
102 $1 = substr($1, 1, index($1, "=") - 1)
103 if (NOTME[$1])
104 next
105 data[i++] = $1
107 END {
108 # Doing this completely sequentially and not doing make distclean in
109 # between runs should effectively result in lesser compilations.
110 # It is completely dumb nonetheless... TODO
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"
118 for (j = 1; j < i; ++j) {
119 for (k = 1; k < j; ++k)
120 printf data[k] "=0 "
121 for (k = j; k < i; ++k)
122 printf data[k] "=1 "
123 printf "OPT_AUTOCC=1\n"
125 # With debug
126 for (j = 1; j < i; ++j) {
127 for (k = 1; k < j; ++k)
128 printf data[k] "=1 "
129 for (k = j; k < i; ++k)
130 printf data[k] "=0 "
131 printf "OPT_AUTOCC=1\n"
132 printf "OPT_DEBUG=1\n"
134 for (j = 1; j < i; ++j) {
135 for (k = 1; k < j; ++k)
136 printf data[k] "=0 "
137 for (k = j; k < i; ++k)
138 printf data[k] "=1 "
139 printf "OPT_AUTOCC=1\n"
140 printf "OPT_DEBUG=1\n"
143 printf "CONFIG=NULL OPT_AUTOCC=0\n"
144 printf "CONFIG=NULL OPT_AUTOCC=1\n"
145 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
146 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
147 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
148 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
149 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
150 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
151 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
152 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
153 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
154 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
155 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
156 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
157 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
158 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
160 ' | while read c; do
161 printf "\n\n##########\n$c\n"
162 printf "\n\n##########\n$c\n" >&2
163 sh -c "${MAKE} ${c}"
164 t_all
165 done
166 ${MAKE} distclean
169 # cksum_test()
170 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
171 # cksum(1) of the resulting data and compare against the checksum $3
172 cksum_test() {
173 tid=${1} f=${2} s=${3}
174 printf "${tid}: "
175 csum="`${sed} -e '/^From /d' \
176 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
177 -e '/^\[-- Message/d' | ${cksum}`";
178 if [ "${csum}" = "${s}" ]; then
179 printf 'ok\n'
180 else
181 ESTAT=1
182 printf 'error: checksum mismatch (got %s)\n' "${csum}"
186 have_feat() {
187 ( "${SNAIL}" ${ARGS} -X'echo $features' -Xx | ${grep} +${1} ) >/dev/null 2>&1
190 # t_behave()
191 # Basic (easily testable) behaviour tests
192 t_behave() {
193 __behave_x_opt_input_command_stack
194 __behave_wysh
195 __behave_input_inject_semicolon_seq
196 __behave_ghost
197 __behave_ifelse
198 __behave_localopts
199 __behave_macro_param_shift
200 __behave_addrcodec
201 __behave_vexpr
203 # FIXME __behave_alias
205 # FIXME __behave_mlist
207 have_feat smime && __behave_smime
210 __behave_x_opt_input_command_stack() {
211 ${cat} <<- '__EOT' > "${BODY}"
212 echo 1
213 define mac0 {
214 echo mac0-1 via1 $0
216 call mac0
217 echo 2
218 wysh source '\
219 echo "define mac1 {";\
220 echo " echo mac1-1 via1 \$0";\
221 echo " call mac0";\
222 echo " echo mac1-2";\
223 echo " call mac2";\
224 echo " echo mac1-3";\
225 echo "}";\
226 echo "echo 1-1";\
227 echo "define mac2 {";\
228 echo " echo mac2-1 via1 \$0";\
229 echo " call mac0";\
230 echo " echo mac2-2";\
231 echo "}";\
232 echo "echo 1-2";\
233 echo "call mac1";\
234 echo "echo 1-3";\
235 echo "wysh source \"\
236 echo echo 1-1-1 via1 \$0;\
237 echo call mac0;\
238 echo echo 1-1-2;\
239 | \"";\
240 echo "echo 1-4";\
242 echo 3
243 call mac2
244 echo 4
245 undefine *
246 __EOT
248 # The -X option supports multiline arguments, and those can internally use
249 # reverse solidus newline escaping. And all -X options are joined...
250 APO=\'
251 < "${BODY}" "${SNAIL}" ${ARGS} \
252 -X 'e\' \
253 -X ' c\' \
254 -X ' h\' \
255 -X ' o \' \
256 -X 1 \
258 define mac0 {
259 echo mac0-1 via2 $0
261 call mac0
262 echo 2
265 wysh source '${APO}'\
266 echo "define mac1 {";\
267 echo " echo mac1-1 via2 \$0";\
268 echo " call mac0";\
269 echo " echo mac1-2";\
270 echo " call mac2";\
271 echo " echo mac1-3";\
272 echo "}";\
273 echo "echo 1-1";\
274 echo "define mac2 {";\
275 echo " echo mac2-1 via2 \$0";\
276 echo " call mac0";\
277 echo " echo mac2-2";\
278 echo "}";\
279 echo "echo 1-2";\
280 echo "call mac1";\
281 echo "echo 1-3";\
282 echo "wysh source \"\
283 echo echo 1-1-1 via2 \$0;\
284 echo call mac0;\
285 echo echo 1-1-2;\
286 | \"";\
287 echo "echo 1-4";\
288 | '${APO}'
289 echo 3
292 call mac2
293 echo 4
294 undefine *
295 ' > "${MBOX}" 2>/dev/null
297 #mac0-1 via2
299 #1-1
300 #1-2
301 #mac1-1 via2
302 #mac0-1 via2 mac1
303 #mac1-2
304 #mac2-1 via2 mac1
305 #mac0-1 via2 mac2
306 #mac2-2
307 #mac1-3
308 #1-3
309 #1-1-1 via2
310 #mac0-1 via2
311 #1-1-2
312 #1-4
314 #mac2-1 via2
315 #mac0-1 via2 mac2
316 #mac2-2
319 #mac0-1 via1
321 #1-1
322 #1-2
323 #mac1-1 via1
324 #mac0-1 via1 mac1
325 #mac1-2
326 #mac2-1 via1 mac1
327 #mac0-1 via1 mac2
328 #mac2-2
329 #mac1-3
330 #1-3
331 #1-1-1 via1
332 #mac0-1 via1
333 #1-1-2
334 #1-4
336 #mac2-1 via1
337 #mac0-1 via1 mac2
338 #mac2-2
340 cksum_test behave:x_opt_input_command_stack "${MBOX}" '1391275936 378'
343 __behave_wysh() {
344 ${cat} <<- '__EOT' > "${BODY}"
346 echo abcd
347 echo a'b'c'd'
348 echo a"b"c"d"
349 echo a$'b'c$'d'
350 echo 'abcd'
351 echo "abcd"
352 echo $'abcd'
353 echo a\ b\ c\ d
354 echo a 'b c' d
355 echo a "b c" d
356 echo a $'b c' d
358 echo 'a$`"\'
359 echo "a\$\`'\"\\"
360 echo $'a\$`\'\"\\'
361 echo $'a\$`\'"\\'
362 # DIET=CURD TIED=
363 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
364 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
365 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
367 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
368 echo a$'\u0041\u41\u0C1\U00000041\U41'c
369 echo a$'\377'c
370 echo a$'\0377'c
371 echo a$'\400'c
372 echo a$'\0400'c
373 echo a$'\U1100001'c
375 echo a$'b\0c'd
376 echo a$'b\00c'de
377 echo a$'b\000c'df
378 echo a$'b\0000c'dg
379 echo a$'b\x0c'dh
380 echo a$'b\x00c'di
381 echo a$'b\u0'dj
382 echo a$'b\u00'dk
383 echo a$'b\u000'dl
384 echo a$'b\u0000'dm
385 echo a$'b\U0'dn
386 echo a$'b\U00'do
387 echo a$'b\U000'dp
388 echo a$'b\U0000'dq
389 echo a$'b\U00000'dr
390 echo a$'b\U000000'ds
391 echo a$'b\U0000000'dt
392 echo a$'b\U00000000'du
394 echo a$'\cI'b
395 echo a$'\011'b
396 echo a$'\x9'b
397 echo a$'\u9'b
398 echo a$'\U9'b
399 echo a$'\c@'b c d
400 __EOT
402 if [ -z "${UTF8_LOCALE}" ]; then
403 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
404 else
405 < "${BODY}" DIET=CURD TIED= \
406 LC_ALL=${UTF8_LOCALE} "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
407 #abcd
408 #abcd
409 #abcd
410 #abcd
411 #abcd
412 #abcd
413 #abcd
414 #a b c d
415 #a b c d
416 #a b c d
417 #a b c d
418 #a$`"\
419 #a$`'"\
420 #a$`'"\
421 #a$`'"\
422 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
423 #aCURDbc${DIET}d${TIED}e
424 #a${DIET}b${TIED}cCURDde
425 #aAAAAAAAc
426 #aAAÁAAc
427 #aÿc
428 #aÿc
429 #abd
430 #abde
431 #abdf
432 #abdg
433 #ab\fdh
434 #abdi
435 #abdj
436 #abdk
437 #abdl
438 #abdm
439 #abdn
440 #abdo
441 #abdp
442 #abdq
443 #abdr
444 #abds
445 #abdt
446 #abdu
447 #a b
448 #a b
449 #a b
450 #a b
451 #a b
453 cksum_test behave:wysh_unicode "${MBOX}" '475805847 317'
456 < "${BODY}" DIET=CURD TIED= "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
457 #abcd
458 #abcd
459 #abcd
460 #abcd
461 #abcd
462 #abcd
463 #abcd
464 #a b c d
465 #a b c d
466 #a b c d
467 #a b c d
468 #a$`"\
469 #a$`'"\
470 #a$`'"\
471 #a$`'"\
472 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
473 #aCURDbc${DIET}d${TIED}e
474 #a${DIET}b${TIED}cCURDde
475 #aAAAAAAAc
476 #aAA\u0C1AAc
477 #aÿc
478 #aÿc
479 #abd
480 #abde
481 #abdf
482 #abdg
483 #ab\fdh
484 #abdi
485 #abdj
486 #abdk
487 #abdl
488 #abdm
489 #abdn
490 #abdo
491 #abdp
492 #abdq
493 #abdr
494 #abds
495 #abdt
496 #abdu
497 #a b
498 #a b
499 #a b
500 #a b
501 #a b
503 cksum_test behave:wysh_c "${MBOX}" '1473887148 321'
506 __behave_input_inject_semicolon_seq() {
507 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
508 define mydeepmac {
509 echon '(mydeepmac)';
511 define mymac {
512 echon this_is_mymac;call mydeepmac;echon ';';
514 echon one';';~mymac;echon two";";call mymac;echo three$';';
515 define mymac {
516 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
518 echon one';';~mymac;echon two";";call mymac;echo three$';';
519 __EOT
520 #one;this_is_mymac(mydeepmac);two;this_is_mymac(mydeepmac);three;
521 #one;this_is_mymac(mydeepmac),TOO!;two;this_is_mymac(mydeepmac),TOO!;three;
522 cksum_test behave:input_inject_semicolon_seq "${MBOX}" '512117110 140'
525 __behave_ghost() {
526 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
527 ghost echo echo hoho
528 echo stop.
529 ghost X Xx
530 ghost Xx XxX
531 ghost XxX XxXx
532 ghost XxXx XxXxX
533 ghost XxXxX XxXxXx
534 ghost XxXxXx echo huhu
535 ghost XxXxXxX echo huhu
537 ghost XxXxXx XxXxXxX
539 __EOT
540 #hoho stop.
541 #hoho huhu
542 #huhu
543 cksum_test behave:ghost "${MBOX}" '776950759 26'
547 __behave_ifelse() {
548 # Nestable conditions test
549 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
550 if 0
551 echo 1.err
552 else
553 echo 1.ok
554 endif
555 if 1
556 echo 2.ok
557 else
558 echo 2.err
559 endif
560 if $dietcurd
561 echo 3.err
562 else
563 echo 3.ok
564 endif
565 set dietcurd=yoho
566 if $dietcurd
567 echo 4.ok
568 else
569 echo 4.err
570 endif
571 if $dietcurd == 'yoho'
572 echo 5.ok
573 else
574 echo 5.err
575 endif
576 if $dietcurd != 'yoho'
577 echo 6.err
578 else
579 echo 6.ok
580 endif
581 # Nesting
582 if faLse
583 echo 7.err1
584 if tRue
585 echo 7.err2
586 if yEs
587 echo 7.err3
588 else
589 echo 7.err4
590 endif
591 echo 7.err5
592 endif
593 echo 7.err6
594 else
595 echo 7.ok7
596 if YeS
597 echo 7.ok8
598 if No
599 echo 7.err9
600 else
601 echo 7.ok9
602 endif
603 echo 7.ok10
604 else
605 echo 7.err11
606 if yeS
607 echo 7.err12
608 else
609 echo 7.err13
610 endif
611 endif
612 echo 7.ok14
613 endif
614 if r
615 echo 8.ok1
616 if R
617 echo 8.ok2
618 else
619 echo 8.err2
620 endif
621 echo 8.ok3
622 else
623 echo 8.err1
624 endif
625 if s
626 echo 9.err1
627 else
628 echo 9.ok1
629 if S
630 echo 9.err2
631 else
632 echo 9.ok2
633 endif
634 echo 9.ok3
635 endif
636 # `elif'
637 if $dietcurd == 'yohu'
638 echo 10.err1
639 elif $dietcurd == 'yoha'
640 echo 10.err2
641 elif $dietcurd == 'yohe'
642 echo 10.err3
643 elif $dietcurd == 'yoho'
644 echo 10.ok1
645 if $dietcurd == 'yohu'
646 echo 10.err4
647 elif $dietcurd == 'yoha'
648 echo 10.err5
649 elif $dietcurd == 'yohe'
650 echo 10.err6
651 elif $dietcurd == 'yoho'
652 echo 10.ok2
653 if $dietcurd == 'yohu'
654 echo 10.err7
655 elif $dietcurd == 'yoha'
656 echo 10.err8
657 elif $dietcurd == 'yohe'
658 echo 10.err9
659 elif $dietcurd == 'yoho'
660 echo 10.ok3
661 else
662 echo 10.err10
663 endif
664 else
665 echo 10.err11
666 endif
667 else
668 echo 10.err12
669 endif
670 # integer conversion, <..>..
671 set dietcurd=10
672 if $dietcurd < 11
673 echo 11.ok1
674 if $dietcurd > 9
675 echo 11.ok2
676 else
677 echo 11.err2
678 endif
679 if $dietcurd == 10
680 echo 11.ok3
681 else
682 echo 11.err3
683 endif
684 if $dietcurd >= 10
685 echo 11.ok4
686 else
687 echo 11.err4
688 endif
689 if $dietcurd <= 10
690 echo 11.ok5
691 else
692 echo 11.err5
693 endif
694 if $dietcurd >= 11
695 echo 11.err6
696 else
697 echo 11.ok6
698 endif
699 if $dietcurd <= 9
700 echo 11.err7
701 else
702 echo 11.ok7
703 endif
704 else
705 echo 11.err1
706 endif
707 set dietcurd=Abc
708 if $dietcurd < aBd
709 echo 12.ok1
710 if $dietcurd > abB
711 echo 12.ok2
712 else
713 echo 12.err2
714 endif
715 if $dietcurd == aBC
716 echo 12.ok3
717 else
718 echo 12.err3
719 endif
720 if $dietcurd >= AbC
721 echo 12.ok4
722 else
723 echo 12.err4
724 endif
725 if $dietcurd <= ABc
726 echo 12.ok5
727 else
728 echo 12.err5
729 endif
730 if $dietcurd >= abd
731 echo 12.err6
732 else
733 echo 12.ok6
734 endif
735 if $dietcurd <= abb
736 echo 12.err7
737 else
738 echo 12.ok7
739 endif
740 else
741 echo 12.err1
742 endif
743 if $dietcurd =@ aB
744 echo 13.ok
745 else
746 echo 13.err
747 endif
748 if $dietcurd =@ bC
749 echo 14.ok
750 else
751 echo 14.err
752 endif
753 if $dietcurd !@ aB
754 echo 15.err
755 else
756 echo 15.ok
757 endif
758 if $dietcurd !@ bC
759 echo 15.err
760 else
761 echo 15.ok
762 endif
763 if $dietcurd =@ Cd
764 echo 16.err
765 else
766 echo 16.ok
767 endif
768 if $dietcurd !@ Cd
769 echo 17.ok
770 else
771 echo 17.err
772 endif
773 set diet=abc curd=abc
774 if $diet == $curd
775 echo 18.ok
776 else
777 echo 18.err
778 endif
779 set diet=abc curd=abcd
780 if $diet != $curd
781 echo 19.ok
782 else
783 echo 19.err
784 endif
785 # 1. Shitty grouping capabilities as of today
786 unset diet curd ndefined
787 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
788 [ yes ]
789 echo 20.ok
790 else
791 echo 20.err
792 endif
793 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
794 echo 21.ok
795 else
796 echo 21.err
797 endif
798 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
799 echo 22.ok
800 else
801 echo 22.err
802 endif
803 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
804 echo 23.ok
805 else
806 echo 23.err
807 endif
808 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
809 echo 24.err
810 else
811 echo 24.ok
812 endif
813 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
814 && [ no ] || [ yes ]
815 echo 25.ok
816 else
817 echo 25.err
818 endif
819 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
820 echo 26.ok
821 else
822 echo 26.err
823 endif
824 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
825 echo 27.err
826 else
827 echo 27.ok
828 endif
829 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
830 echo 28.err
831 else
832 echo 28.ok
833 endif
834 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
835 echo 29.err
836 else
837 echo 29.ok
838 endif
839 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
840 echo 30.err
841 else
842 echo 30.ok
843 endif
844 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
845 echo 31.ok
846 else
847 echo 31.err
848 endif
849 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
850 echo 32.err
851 else
852 echo 32.ok
853 endif
854 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
855 echo 33.ok
856 else
857 echo 33.err
858 endif
859 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
860 echo 34.err
861 else
862 echo 34.ok
863 endif
864 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
865 echo 35.ok
866 else
867 echo 35.err
868 endif
869 set diet=yo curd=ho
870 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
871 echo 36.err
872 else
873 echo 36.ok
874 endif
875 set ndefined
876 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
877 echo 37.ok
878 else
879 echo 37.err
880 endif
881 # 2. Shitty grouping capabilities as of today
882 unset diet curd ndefined
883 if [ false || false || true ] && [ false || true ] && yes
884 echo 40.ok
885 else
886 echo 40.err
887 endif
888 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
889 echo 41.ok
890 else
891 echo 41.err
892 endif
893 if [ 1 || 0 || 0 || 0 ]
894 echo 42.ok
895 else
896 echo 42.err
897 endif
898 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
899 echo 43.ok
900 else
901 echo 43.err
902 endif
903 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
904 echo 44.err
905 else
906 echo 44.ok
907 endif
908 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
909 echo 45.ok
910 else
911 echo 45.err
912 endif
913 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
914 echo 46.ok
915 else
916 echo 46.err
917 endif
918 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
919 echo 47.err
920 else
921 echo 47.ok
922 endif
923 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
924 echo 48.err
925 else
926 echo 48.ok
927 endif
928 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
929 echo 49.err
930 else
931 echo 49.ok
932 endif
933 if 1 || 0 || 0 || 0 && 0
934 echo 50.err
935 else
936 echo 50.ok
937 endif
938 if 1 || 0 || 0 || 0 && 1
939 echo 51.ok
940 else
941 echo 51.err
942 endif
943 if 0 || 0 || 0 || 1 && 0
944 echo 52.err
945 else
946 echo 52.ok
947 endif
948 if 0 || 0 || 0 || 1 && 1
949 echo 53.ok
950 else
951 echo 53.err
952 endif
953 if 0 || 0 || 0 || 1 && 0 || 1 && 0
954 echo 54.err
955 else
956 echo 54.ok
957 endif
958 if 0 || 0 || 0 || 1 && 0 || 1 && 1
959 echo 55.ok
960 else
961 echo 55.err
962 endif
963 set diet=yo curd=ho
964 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
965 echo 56.err
966 else
967 echo 56.ok
968 endif
969 if $diet == 'yo' && $curd == 'ho' && $ndefined
970 echo 57.err
971 else
972 echo 57.ok
973 endif
974 set ndefined
975 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
976 echo 57.ok
977 else
978 echo 57.err
979 endif
980 if $diet == 'yo' && $curd == 'ho' && $ndefined
981 echo 58.ok
982 else
983 echo 58.err
984 endif
985 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
986 echo 59.ok
987 else
988 echo 59.err
989 endif
990 # Some more en-braced variables
991 set diet=yo curd=ho
992 if ${diet} == ${curd}
993 echo 70.err
994 else
995 echo 70.ok
996 endif
997 if ${diet} != ${curd}
998 echo 71.ok
999 else
1000 echo 71.err
1001 endif
1002 if $diet == ${curd}
1003 echo 72.err
1004 else
1005 echo 72.ok
1006 endif
1007 if ${diet} == $curd
1008 echo 73.err
1009 else
1010 echo 73.ok
1011 endif
1012 # Unary !
1013 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1014 echo 80.ok
1015 else
1016 echo 80.err
1017 endif
1018 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1019 echo 81.ok
1020 else
1021 echo 81.err
1022 endif
1023 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1024 echo 82.ok
1025 else
1026 echo 82.err
1027 endif
1028 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1029 echo 83.err
1030 else
1031 echo 83.ok
1032 endif
1033 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1034 echo 84.err
1035 else
1036 echo 84.ok
1037 endif
1038 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1039 echo 85.err
1040 else
1041 echo 85.ok
1042 endif
1043 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1044 echo 86.err
1045 else
1046 echo 86.ok
1047 endif
1048 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1049 echo 87.ok
1050 else
1051 echo 87.err
1052 endif
1053 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1054 echo 88.ok
1055 else
1056 echo 88.err
1057 endif
1058 # Unary !, odd
1059 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1060 echo 90.ok
1061 else
1062 echo 90.err
1063 endif
1064 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1065 echo 91.ok
1066 else
1067 echo 91.err
1068 endif
1069 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1070 echo 92.ok
1071 else
1072 echo 92.err
1073 endif
1074 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1075 echo 93.err
1076 else
1077 echo 93.ok
1078 endif
1079 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1080 echo 94.ok
1081 else
1082 echo 94.err
1083 endif
1084 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1085 echo 95.err
1086 else
1087 echo 95.ok
1088 endif
1089 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1090 echo 96.err
1091 else
1092 echo 96.ok
1093 endif
1094 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1095 echo 97.ok
1096 else
1097 echo 97.err
1098 endif
1099 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1100 echo 98.ok
1101 else
1102 echo 98.err
1103 endif
1104 __EOT
1105 cksum_test behave:if-normal "${MBOX}" '557629289 631'
1107 if have_feat regex; then
1108 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1109 set dietcurd=yoho
1110 if $dietcurd =~ '^yo.*'
1111 echo 1.ok
1112 else
1113 echo 1.err
1114 endif
1115 if $dietcurd =~ '^yoho.+'
1116 echo 2.err
1117 else
1118 echo 2.ok
1119 endif
1120 if $dietcurd !~ '.*ho$'
1121 echo 3.err
1122 else
1123 echo 3.ok
1124 endif
1125 if $dietcurd !~ '.+yoho$'
1126 echo 4.ok
1127 else
1128 echo 4.err
1129 endif
1130 if [ $dietcurd !~ '.+yoho$' ]
1131 echo 5.ok
1132 else
1133 echo 5.err
1134 endif
1135 if ! [ $dietcurd =~ '.+yoho$' ]
1136 echo 6.ok
1137 else
1138 echo 6.err
1139 endif
1140 if ! ! [ $dietcurd !~ '.+yoho$' ]
1141 echo 7.ok
1142 else
1143 echo 7.err
1144 endif
1145 if ! [ ! [ $dietcurd !~ '.+yoho$' ] ]
1146 echo 8.ok
1147 else
1148 echo 8.err
1149 endif
1150 if [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1151 echo 9.ok
1152 else
1153 echo 9.err
1154 endif
1155 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1156 echo 10.err
1157 else
1158 echo 10.ok
1159 endif
1160 if ! ! ! $dietcurd !~ '.+yoho$'
1161 echo 11.err
1162 else
1163 echo 11.ok
1164 endif
1165 if ! ! ! $dietcurd =~ '.+yoho$'
1166 echo 12.ok
1167 else
1168 echo 12.err
1169 endif
1170 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1171 echo 13.ok
1172 else
1173 echo 13.err
1174 endif
1175 set diet=abc curd='^abc$'
1176 if $diet =~ $curd
1177 echo 14.ok
1178 else
1179 echo 14.err
1180 endif
1181 set diet=abc curd='^abcd$'
1182 if $diet !~ $curd
1183 echo 15.ok
1184 else
1185 echo 15.err
1186 endif
1187 __EOT
1188 cksum_test behave:if-regex "${MBOX}" '439960016 81'
1192 __behave_localopts() {
1193 # Nestable conditions test
1194 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1195 define t2 {
1196 echo in: t2
1197 set t2=t2
1198 echo $t2
1200 define t1 {
1201 echo in: t1
1202 set gv1=gv1
1203 localopts on
1204 set lv1=lv1 lv2=lv2
1205 set lv3=lv3
1206 call t2
1207 localopts off
1208 set gv2=gv2
1209 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1211 define t0 {
1212 echo in: t0
1213 call t1
1214 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1215 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1217 account trouble {
1218 echo in: trouble
1219 call t0
1221 call t0
1222 unset gv1 gv2
1223 account trouble
1224 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1225 account null
1226 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1227 __EOT
1228 #in: t0
1229 #in: t1
1230 #in: t2
1232 #gv1 lv1 lv2 lv3 gv2, t2
1233 #gv1 gv2,
1234 #gv1 gv2,
1235 #in: trouble
1236 #in: t0
1237 #in: t1
1238 #in: t2
1240 #gv1 lv1 lv2 lv3 gv2, t2
1241 #gv1 gv2,
1242 #gv1 gv2,
1243 #active trouble: gv1 gv2,
1244 #active null: ,
1245 cksum_test behave:localopts "${MBOX}" '1936527193 192'
1248 __behave_macro_param_shift() {
1249 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
1250 define t2 {
1251 echo in: t2
1252 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1253 localopts on
1254 wysh set ignerr=$1
1255 shift
1256 localopts off
1257 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1258 if [ $# > 1 ] || [ $ignerr == '' ]
1259 shift 2
1260 else
1261 ignerr shift 2
1262 endif
1263 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1264 shift 0
1265 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1266 if [ $# > 0 ]
1267 shift
1268 endif
1269 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1271 define t1 {
1272 echo in: t1
1273 call t2 1 you get four args
1274 echo t1.1: $?';' ignerr ($ignerr) should not exist
1275 call t2 1 you get 'three args'
1276 echo t1.2: $?';' ignerr ($ignerr) should not exist
1277 call t2 1 you 'get two args'
1278 echo t1.3: $?';' ignerr ($ignerr) should not exist
1279 call t2 1 'you get one arg'
1280 echo t1.4: $?';' ignerr ($ignerr) should not exist
1281 ignerr call t2 '' 'you get one arg'
1282 echo t1.5: $?';' ignerr ($ignerr) should not exist
1284 call t1
1285 __EOT
1286 #in: t1
1287 #in: t2
1288 #t2.0 has 5/5 parameters: 1,you,get (1 you get four args) [1 you get four args]
1289 #t2.1 has 4/4 parameters: you,get,four (you get four args) [you get four args]
1290 #t2.2:0 has 2/2 parameters: four,args, (four args) [four args]
1291 #t2.3:0 has 2/2 parameters: four,args, (four args) [four args]
1292 #t2.4:0 has 1/1 parameters: args,, (args) [args]
1293 #t1.1: 0; ignerr () should not exist
1294 #in: t2
1295 #t2.0 has 4/4 parameters: 1,you,get (1 you get three args) [1 you get three args]
1296 #t2.1 has 3/3 parameters: you,get,three args (you get three args) [you get three args]
1297 #t2.2:0 has 1/1 parameters: three args,, (three args) [three args]
1298 #t2.3:0 has 1/1 parameters: three args,, (three args) [three args]
1299 #t2.4:0 has 0/0 parameters: ,, () []
1300 #t1.2: 0; ignerr () should not exist
1301 #in: t2
1302 #t2.0 has 3/3 parameters: 1,you,get two args (1 you get two args) [1 you get two args]
1303 #t2.1 has 2/2 parameters: you,get two args, (you get two args) [you get two args]
1304 #t2.2:0 has 0/0 parameters: ,, () []
1305 #t2.3:0 has 0/0 parameters: ,, () []
1306 #t2.4:0 has 0/0 parameters: ,, () []
1307 #t1.3: 0; ignerr () should not exist
1308 #in: t2
1309 #t2.0 has 2/2 parameters: 1,you get one arg, (1 you get one arg) [1 you get one arg]
1310 #t2.1 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1311 #t2.2:0 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1312 #t2.3:0 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1313 #t2.4:0 has 0/0 parameters: ,, () []
1314 #t1.4: 0; ignerr () should not exist
1315 #in: t2
1316 #t2.0 has 2/2 parameters: ,you get one arg, ( you get one arg) [ you get one arg]
1317 #t2.1 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1318 #t1.5: 1; ignerr () should not exist
1319 cksum_test behave:macro_param_shift "${MBOX}" '1402489146 1682'
1322 __behave_addrcodec() {
1323 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
1324 vput addrcodec res 1 <doog@def>
1325 echo $! $res
1326 vput addrcodec res 2 . <doog@def>
1327 echo $! $res
1328 vput addrcodec res 3 Sauer Dr. <doog@def>
1329 echo $! $res
1330 vput addrcodec res 4 Sauer (Ma) Dr. <doog@def>
1331 echo $! $res
1332 vput addrcodec res 5 Sauer (Ma) Braten Dr. <doog@def>
1333 echo $! $res
1334 vput addrcodec res 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1335 echo $! $res
1336 vput addrcodec res 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1337 echo $! $res
1338 vput addrcodec res 8 \
1339 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1340 echo $! $res
1341 vput addrcodec res 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1342 echo $! $res
1343 vput addrcodec res 10 (Ma)Braten Dr. (Heu) <doog@def>
1344 echo $! $res
1345 vput addrcodec res 11 (Ma)Braten Dr'"."' (Heu) <doog@def>
1346 echo $! $res
1347 vput addrcodec res 12 \
1348 ' Dr. ' ' Sauer ' (Ma) ' Braten ' ' Dr. ' (u) <doog@def>
1349 echo $! $res
1350 vput addrcodec res 13(Ma)Braten Dr. (Heu) <doog@def>
1351 echo $! $res
1352 vput addrcodec res 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1353 echo $! $res
1354 vput addrcodec res 15 \
1355 Hey, Du <doog@def> Wie() findet '""' Dr. '""' das? ()
1356 echo $! $res
1357 vput addrcodec res 16 \
1358 \"Hey,\" \"Du\" <doog@def> \"Wie()\" findet \"\" Dr. \"\" das? ()
1359 echo $! $res
1360 vput addrcodec res 17 \
1361 \"Hey\" Du <doog@def> \"Wie() findet \" \" Dr. \"\"\" das? ()
1362 echo $! $res
1363 vput addrcodec res 18 \
1364 <doog@def> \"Hey\" Du \"Wie() findet \" \" Dr. \"\"\" das? ()
1365 echo $! $res
1366 vput addrcodec res 19 \
1367 'Hey\,\" ' <doog@def> '"Wie()" findet \" Dr. \"' das? ()
1368 echo $! $res
1369 __EOT
1370 #0 1 <doog@def>
1371 #0 "2 ." <doog@def>
1372 #0 "3 Sauer Dr." <doog@def>
1373 #0 4 Sauer (Ma) "Dr." <doog@def>
1374 #0 5 Sauer (Ma) "Braten Dr." <doog@def>
1375 #0 6 Sauer (Ma) "Braten Dr." (Heu) <doog@def>
1376 #0 7 Sauer (Ma) "Braten Dr." (Heu bu) <doog@def>
1377 #0 "8 Dr. Sauer" (Ma) "Braten Dr." (Heu bu) "Boom. Boom" <doog@def>
1378 #0 "9 Dr.Sauer" (Ma) "Braten Dr." (Heu) <doog@def>
1379 #0 10 (Ma) "Braten Dr." (Heu) <doog@def>
1380 #0 11 (Ma) "Braten Dr\".\"" (Heu) <doog@def>
1381 #0 "12 Dr. Sauer" (Ma) "Braten Dr." (u) <doog@def>
1382 #0 13 (Ma) "Braten Dr." (Heu) <doog@def>
1383 #0 "14 Hey, Du Wie" () "findet Dr. das?" () <doog@def>
1384 #0 "15 Hey, Du Wie" () "findet \"\" Dr. \"\" das?" () <doog@def>
1385 #0 "16 \"Hey,\" \"Du\" \"Wie" () "\" findet \"\" Dr. \"\" das?" () <doog@def>
1386 #0 "17 \"Hey\" Du \"Wie" () "findet \" \" Dr. \"\"\" das?" () <doog@def>
1387 #0 "18 \"Hey\" Du \"Wie" () "findet \" \" Dr. \"\"\" das?" () <doog@def>
1388 #0 "19 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" () <doog@def>
1389 cksum_test behave:addrcodec "${MBOX}" '1997352922 927'
1392 __behave_vexpr() {
1393 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
1394 vput vexpr res = 9223372036854775807
1395 echo $! $res
1396 vput vexpr res = 9223372036854775808
1397 echo $! $res
1398 vput vexpr res =@ 9223372036854775808
1399 echo $! $res
1400 vput vexpr res = -9223372036854775808
1401 echo $! $res
1402 vput vexpr res = -9223372036854775809
1403 echo $! $res
1404 vput vexpr res =@ -9223372036854775809
1405 echo $! $res
1406 echo ' #1'
1407 vput vexpr res ~ 0
1408 echo $! $res
1409 vput vexpr res ~ 1
1410 echo $! $res
1411 vput vexpr res ~ -1
1412 echo $! $res
1413 echo ' #2'
1414 vput vexpr res + 0 0
1415 echo $! $res
1416 vput vexpr res + 0 1
1417 echo $! $res
1418 vput vexpr res + 1 1
1419 echo $! $res
1420 echo ' #3'
1421 vput vexpr res + 9223372036854775807 0
1422 echo $! $res
1423 vput vexpr res + 9223372036854775807 1
1424 echo $! $res
1425 vput vexpr res +@ 9223372036854775807 1
1426 echo $! $res
1427 vput vexpr res + 0 9223372036854775807
1428 echo $! $res
1429 vput vexpr res + 1 9223372036854775807
1430 echo $! $res
1431 vput vexpr res +@ 1 9223372036854775807
1432 echo $! $res
1433 echo ' #4'
1434 vput vexpr res + -9223372036854775808 0
1435 echo $! $res
1436 vput vexpr res + -9223372036854775808 -1
1437 echo $! $res
1438 vput vexpr res +@ -9223372036854775808 -1
1439 echo $! $res
1440 vput vexpr res + 0 -9223372036854775808
1441 echo $! $res
1442 vput vexpr res + -1 -9223372036854775808
1443 echo $! $res
1444 vput vexpr res +@ -1 -9223372036854775808
1445 echo $! $res
1446 echo ' #5'
1447 vput vexpr res - 0 0
1448 echo $! $res
1449 vput vexpr res - 0 1
1450 echo $! $res
1451 vput vexpr res - 1 1
1452 echo $! $res
1453 echo ' #6'
1454 vput vexpr res - 9223372036854775807 0
1455 echo $! $res
1456 vput vexpr res - 9223372036854775807 -1
1457 echo $! $res
1458 vput vexpr res -@ 9223372036854775807 -1
1459 echo $! $res
1460 vput vexpr res - 0 9223372036854775807
1461 echo $! $res
1462 vput vexpr res - -1 9223372036854775807
1463 echo $! $res
1464 vput vexpr res - -2 9223372036854775807
1465 echo $! $res
1466 vput vexpr res -@ -2 9223372036854775807
1467 echo $! $res
1468 echo ' #7'
1469 vput vexpr res - -9223372036854775808 +0
1470 echo $! $res
1471 vput vexpr res - -9223372036854775808 +1
1472 echo $! $res
1473 vput vexpr res -@ -9223372036854775808 +1
1474 echo $! $res
1475 vput vexpr res - 0 -9223372036854775808
1476 echo $! $res
1477 vput vexpr res - +1 -9223372036854775808
1478 echo $! $res
1479 vput vexpr res -@ +1 -9223372036854775808
1480 echo $! $res
1481 echo ' #8'
1482 vput vexpr res + -13 -2
1483 echo $! $res
1484 vput vexpr res - 0 0
1485 echo $! $res
1486 vput vexpr res - 0 1
1487 echo $! $res
1488 vput vexpr res - 1 1
1489 echo $! $res
1490 vput vexpr res - -13 -2
1491 echo $! $res
1492 echo ' #9'
1493 vput vexpr res * 0 0
1494 echo $! $res
1495 vput vexpr res * 0 1
1496 echo $! $res
1497 vput vexpr res * 1 1
1498 echo $! $res
1499 vput vexpr res * -13 -2
1500 echo $! $res
1501 echo ' #10'
1502 vput vexpr res / 0 0
1503 echo $! $res
1504 vput vexpr res / 0 1
1505 echo $! $res
1506 vput vexpr res / 1 1
1507 echo $! $res
1508 vput vexpr res / -13 -2
1509 echo $! $res
1510 echo ' #11'
1511 vput vexpr res % 0 0
1512 echo $! $res
1513 vput vexpr res % 0 1
1514 echo $! $res
1515 vput vexpr res % 1 1
1516 echo $! $res
1517 vput vexpr res % -13 -2
1518 echo $! $res
1519 __EOT
1520 #0 9223372036854775807
1521 #1 -1
1522 #1 9223372036854775807
1523 #0 -9223372036854775808
1524 #1 -1
1525 #1 -9223372036854775808
1526 # #1
1527 #0 -1
1528 #0 -2
1529 #0 0
1530 # #2
1531 #0 0
1532 #0 1
1533 #0 2
1534 # #3
1535 #0 9223372036854775807
1536 #1 -1
1537 #1 9223372036854775807
1538 #0 9223372036854775807
1539 #1 -1
1540 #1 9223372036854775807
1541 # #4
1542 #0 -9223372036854775808
1543 #1 -1
1544 #1 -9223372036854775808
1545 #0 -9223372036854775808
1546 #1 -1
1547 #1 -9223372036854775808
1548 # #5
1549 #0 0
1550 #0 -1
1551 #0 0
1552 # #6
1553 #0 9223372036854775807
1554 #1 -1
1555 #1 9223372036854775807
1556 #0 -9223372036854775807
1557 #0 -9223372036854775808
1558 #1 -1
1559 #1 -9223372036854775808
1560 # #7
1561 #0 -9223372036854775808
1562 #1 -1
1563 #1 -9223372036854775808
1564 #0 -9223372036854775808
1565 #1 -1
1566 #1 -9223372036854775808
1567 # #8
1568 #0 -15
1569 #0 0
1570 #0 -1
1571 #0 0
1572 #0 -11
1573 # #9
1574 #0 0
1575 #0 0
1576 #0 1
1577 #0 26
1578 # #10
1579 #1 -1
1580 #0 0
1581 #0 1
1582 #0 6
1583 # #11
1584 #1 -1
1585 #0 0
1586 #0 0
1587 #0 -1
1588 cksum_test behave:vexpr-numeric "${MBOX}" '2147139513 687'
1590 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" #2>/dev/null
1591 vput vexpr res find 'bananarama' 'nana'
1592 echo $! $res
1593 vput vexpr res find 'bananarama' 'bana'
1594 echo $! $res
1595 vput vexpr res find 'bananarama' 'Bana'
1596 echo $! $res
1597 vput vexpr res find 'bananarama' 'rama'
1598 echo $! $res
1599 echo ' #1'
1600 vput vexpr res ifind 'bananarama' 'nana'
1601 echo $! $res
1602 vput vexpr res ifind 'bananarama' 'bana'
1603 echo $! $res
1604 vput vexpr res ifind 'bananarama' 'Bana'
1605 echo $! $res
1606 vput vexpr res ifind 'bananarama' 'rama'
1607 echo $! $res
1608 echo ' #2'
1609 vput vexpr res substring 'bananarama' 1
1610 echo $! $res
1611 vput vexpr res substring 'bananarama' 3
1612 echo $! $res
1613 vput vexpr res substring 'bananarama' 5
1614 echo $! $res
1615 vput vexpr res substring 'bananarama' 7
1616 echo $! $res
1617 vput vexpr res substring 'bananarama' 9
1618 echo $! $res
1619 vput vexpr res substring 'bananarama' 10
1620 echo $! $res
1621 vput vexpr res substring 'bananarama' 1 3
1622 echo $! $res
1623 vput vexpr res substring 'bananarama' 3 3
1624 echo $! $res
1625 vput vexpr res substring 'bananarama' 5 3
1626 echo $! $res
1627 vput vexpr res substring 'bananarama' 7 3
1628 echo $! $res
1629 vput vexpr res substring 'bananarama' 9 3
1630 echo $! $res
1631 vput vexpr res substring 'bananarama' 10 3
1632 echo $! $res
1633 echo ' #3'
1634 __EOT
1635 #0 2
1636 #0 0
1637 #1 -1
1638 #0 6
1639 # #1
1640 #0 2
1641 #0 0
1642 #0 0
1643 #0 6
1644 # #2
1645 #0 ananarama
1646 #0 anarama
1647 #0 arama
1648 #0 ama
1649 #0 a
1651 #0 ana
1652 #0 ana
1653 #0 ara
1654 #0 ama
1655 #1 a
1657 # #3
1658 cksum_test behave:vexpr-string "${MBOX}" '2171181036 119'
1660 if have_feat regex; then
1661 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" #2>/dev/null
1662 vput vexpr res regex 'bananarama' 'nana'
1663 echo $! $res
1664 vput vexpr res regex 'bananarama' 'bana'
1665 echo $! $res
1666 vput vexpr res regex 'bananarama' 'Bana'
1667 echo $! $res
1668 vput vexpr res regex 'bananarama' 'rama'
1669 echo $! $res
1670 echo ' #1'
1671 vput vexpr res iregex 'bananarama' 'nana'
1672 echo $! $res
1673 vput vexpr res iregex 'bananarama' 'bana'
1674 echo $! $res
1675 vput vexpr res iregex 'bananarama' 'Bana'
1676 echo $! $res
1677 vput vexpr res iregex 'bananarama' 'rama'
1678 echo $! $res
1679 echo ' #2'
1680 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1681 echo $! $res
1682 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1683 echo $! $res
1684 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
1685 echo $! $res
1686 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
1687 echo $! $res
1688 echo ' #3'
1689 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1690 echo $! $res
1691 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1692 echo $! $res
1693 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
1694 echo $! $res
1695 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
1696 echo $! $res
1697 echo ' #4'
1698 __EOT
1699 #0 2
1700 #0 0
1701 #1 -1
1702 #0 6
1703 # #1
1704 #0 2
1705 #0 0
1706 #0 0
1707 #0 6
1708 # #2
1709 #0 baabananaramau{rama}
1710 #0 abananaramaunarama
1711 #1 -1
1712 #0 bananabananarama
1713 # #3
1714 #0 baabananaramau{rama}
1715 #0 abananaramaunarama
1716 #0 naramabananarama
1717 #0 bananabananarama
1718 # #4
1719 cksum_test behave:vexpr-regex "${MBOX}" '3419299180 199'
1723 __behave_smime() { # FIXME add test/ dir, unroll tests therein
1724 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
1725 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
1726 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
1728 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1729 ${cat} <<-_EOT > ./.t.conf
1730 [ req ]
1731 default_bits = 1024
1732 default_keyfile = keyfile.pem
1733 distinguished_name = req_distinguished_name
1734 attributes = req_attributes
1735 prompt = no
1736 output_password =
1738 [ req_distinguished_name ]
1739 C = GB
1740 ST = Over the
1741 L = rainbow
1742 O = S-nail
1743 OU = S-nail.smime
1744 CN = S-nail.test
1745 emailAddress = test@localhost
1747 [ req_attributes ]
1748 challengePassword =
1749 _EOT
1750 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
1751 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >/dev/null 2>&1
1752 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
1754 printf "behave:s/mime:sign/verify: "
1755 echo bla | "${SNAIL}" ${ARGS} \
1756 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1757 -Ssmime-sign -Sfrom=test@localhost \
1758 -s 'S/MIME test' ./.VERIFY
1759 printf 'verify\nx\n' |
1760 "${SNAIL}" ${ARGS} \
1761 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1762 -Ssmime-sign -Sfrom=test@localhost \
1763 -Sbatch-exit-on-error -R \
1764 -f ./.VERIFY >/dev/null 2>&1
1765 if [ $? -eq 0 ]; then
1766 printf 'ok\n'
1767 else
1768 printf 'error: verification failed\n'
1769 ESTAT=1
1770 ${rm} -f ${TRAP_EXIT_ADDONS}
1771 TRAP_EXIT_ADDONS=
1772 return
1774 printf ' .. disproof via openssl smime(1): '
1775 if openssl smime -verify -CAfile ./.tcert.pem \
1776 -in ./.VERIFY >/dev/null 2>&1; then
1777 printf 'ok\n'
1778 else
1779 printf 'failed\n'
1780 ESTAT=1
1781 ${rm} -f ${TRAP_EXIT_ADDONS}
1782 TRAP_EXIT_ADDONS=
1783 return
1786 # (signing +) encryption / decryption
1787 ${cat} <<-_EOT > ./.tsendmail.sh
1788 #!/bin/sh -
1789 ${rm} -f ./.ENCRYPT
1790 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./.ENCRYPT
1791 _EOT
1792 chmod 0755 ./.tsendmail.sh
1794 printf "behave:s/mime:encrypt+sign/decrypt+verify: "
1795 echo bla |
1796 "${SNAIL}" ${ARGS} \
1797 -Ssmime-force-encryption \
1798 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1799 -Smta=./.tsendmail.sh \
1800 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1801 -Ssmime-sign -Sfrom=test@localhost \
1802 -s 'S/MIME test' recei@ver.com
1803 # TODO CHECK
1804 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
1805 "${SNAIL}" ${ARGS} \
1806 -Ssmime-force-encryption \
1807 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1808 -Smta=./.tsendmail.sh \
1809 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1810 -Ssmime-sign -Sfrom=test@localhost \
1811 -Sbatch-exit-on-error -R \
1812 -f ./.ENCRYPT >/dev/null 2>&1
1813 if [ $? -eq 0 ]; then
1814 printf 'ok\n'
1815 else
1816 ESTAT=1
1817 printf 'error: decryption+verification failed\n'
1819 printf ' ..disproof via openssl smime(1): '
1820 if (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
1821 openssl smime -verify -CAfile ./.tcert.pem) >/dev/null 2>&1; then
1822 printf 'ok\n'
1823 else
1824 printf 'failed\n'
1825 ESTAT=1
1827 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1828 -e \
1829 '/^Content-Disposition: attachment; filename="smime.p7s"/,/^-- /d' \
1830 < ./.DECRYPT > ./.ENCRYPT
1831 cksum_test ".. checksum of decrypted content" "./.ENCRYPT" '3090916509 510'
1833 printf "behave:s/mime:encrypt/decrypt: "
1834 ${rm} -f ./.DECRYPT
1835 echo bla | "${SNAIL}" ${ARGS} \
1836 -Ssmime-force-encryption \
1837 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1838 -Smta=./.tsendmail.sh \
1839 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1840 -Sfrom=test@localhost \
1841 -s 'S/MIME test' recei@ver.com
1842 printf 'decrypt ./.DECRYPT\nx\n' | "${SNAIL}" ${ARGS} \
1843 -Ssmime-force-encryption \
1844 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1845 -Smta=./.tsendmail.sh \
1846 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1847 -Sfrom=test@localhost \
1848 -Sbatch-exit-on-error -R \
1849 -f ./.ENCRYPT >/dev/null 2>&1
1850 if [ $? -eq 0 ]; then
1851 printf 'ok\n'
1852 else
1853 ESTAT=1
1854 printf 'error: decryption failed\n'
1856 printf '.. disproof via openssl smime(1): '
1857 if openssl smime -decrypt -inkey ./.tkey.pem \
1858 -in ./.ENCRYPT >/dev/null 2>&1; then
1859 printf 'ok\n'
1860 else
1861 printf 'failed\n'
1862 ESTAT=1
1864 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1865 < ./.DECRYPT > ./.ENCRYPT
1866 cksum_test ".. checksum of decrypted content" ./.ENCRYPT '999887248 295'
1868 ${rm} -f ${TRAP_EXIT_ADDONS}
1869 TRAP_EXIT_ADDONS=
1872 # t_content()
1873 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1874 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1875 # Note we unfortunately need to place some statements without proper
1876 # indentation because of continuation problems
1877 t_content() {
1878 # MIME encoding (QP) stress message body
1879 printf \
1880 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1881 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1882 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
1883 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
1884 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
1885 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
1886 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
1887 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
1888 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
1889 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
1890 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
1891 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
1892 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
1893 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
1894 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
1895 "auf den zeilen vorher.\r\n"\
1896 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
1897 ".\r\n"\
1898 "Die letzte Zeile war nur ein Punkt.\r\n"\
1899 "..\r\n"\
1900 "Das waren deren zwei.\r\n"\
1901 " \r\n"\
1902 "Die letzte Zeile war ein Leerschritt.\n"\
1903 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
1904 "Prösterchen.\r\n"\
1905 ".\n"\
1906 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
1907 "..\n"\
1908 "Das waren deren zwei. ditto.\n"\
1909 "Prösterchen.\n"\
1910 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
1911 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
1912 "auf den zeilen vorher.\n"\
1913 "ditto.\n"\
1914 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
1915 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
1916 "\n"\
1917 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1918 "\n"\
1919 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1920 "3\n"\
1921 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1922 "34\n"\
1923 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1924 "345\n"\
1925 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
1926 "3456\n"\
1927 "QP am Zeilenende über soft-nl hinweg\n"\
1928 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1929 "ö123\n"\
1930 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1931 "1ö23\n"\
1932 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1933 "12ö3\n"\
1934 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
1935 "123ö\n"\
1936 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
1937 " \n"\
1938 "Die letzte Zeile war ein Leerschritt.\n"\
1939 ' '\
1940 > "${BODY}"
1942 # MIME encoding (QP) stress message subject
1943 SUB="Äbrä Kä?dä=brö Fü?di=bus? \
1944 adadaddsssssssddddddddddddddddddddd\
1945 ddddddddddddddddddddddddddddddddddd\
1946 ddddddddddddddddddddddddddddddddddd\
1947 dddddddddddddddddddd Hallelulja? Od\
1948 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1949 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
1950 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
1951 fffffffffffffffffffffffffffffffffff\
1952 fffffffffffffffffffff ggggggggggggg\
1953 ggggggggggggggggggggggggggggggggggg\
1954 ggggggggggggggggggggggggggggggggggg\
1955 ggggggggggggggggggggggggggggggggggg\
1956 gggggggggggggggg"
1958 # Three tests for MIME encodign and (a bit) content classification.
1959 # At the same time testing -q FILE, < FILE and -t FILE
1961 ${rm} -f "${MBOX}"
1962 < "${BODY}" "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1963 -a "${BODY}" -s "${SUB}" "${MBOX}"
1964 cksum_test content:001 "${MBOX}" '2356108758 6413'
1966 ${rm} -f "${MBOX}"
1967 < /dev/null "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
1968 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
1969 cksum_test content:002 "${MBOX}" '2356108758 6413'
1971 ${rm} -f "${MBOX}"
1972 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
1973 ${cat} "${BODY}"
1974 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
1975 cksum_test content:003 "${MBOX}" '2356108758 6413'
1977 # Test for [260e19d] (Juergen Daubert)
1978 ${rm} -f "${MBOX}"
1979 echo body | "${SNAIL}" ${ARGS} "${MBOX}"
1980 cksum_test content:004 "${MBOX}" '4004005686 49'
1982 # Sending of multiple mails in a single invocation
1983 ${rm} -f "${MBOX}"
1984 ( printf "m ${MBOX}\n~s subject1\nE-Mail Körper 1\n~.\n" &&
1985 printf "m ${MBOX}\n~s subject2\nEmail body 2\n~.\n" &&
1986 echo x
1987 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI}
1988 cksum_test content:005 "${MBOX}" '2157252578 260'
1990 ## $BODY CHANGED
1992 # "Test for" [d6f316a] (Gavin Troy)
1993 ${rm} -f "${MBOX}"
1994 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
1995 "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="${cat}" > "${BODY}"
1996 ${sed} -e 1d < "${BODY}" > "${MBOX}"
1997 cksum_test content:006 "${MBOX}" '2273863401 83'
1999 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
2000 ${rm} -f "${MBOX}"
2001 ${awk} 'BEGIN{
2002 for(i = 0; i < 10000; ++i)
2003 printf "\xC3\xBC"
2004 #printf "\xF0\x90\x87\x90"
2005 }' | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
2006 cksum_test content:007 "${MBOX}" '1754234717 61767'
2008 ## Test some more corner cases for header bodies (as good as we can today) ##
2011 ${rm} -f "${MBOX}"
2012 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2013 -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̲' \
2014 "${MBOX}"
2015 cksum_test content:008 "${MBOX}" '1563381297 326'
2017 # Single word (overlong line split -- bad standard! Requires injection of
2018 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
2019 ${rm} -f "${MBOX}"
2020 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
2021 echo | "${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
2022 cksum_test content:009 "${MBOX}" '1996714851 1669'
2024 # Combination of encoded words, space and tabs of varying sort
2025 ${rm} -f "${MBOX}"
2026 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2027 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
2028 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
2029 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
2030 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
2031 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
2032 "${MBOX}"
2033 cksum_test content:010 "${MBOX}" '2956039469 542'
2035 # Overlong multibyte sequence that must be forcefully split
2036 # todo This works even before v15.0, but only by accident
2037 ${rm} -f "${MBOX}"
2038 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2039 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
2040 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
2041 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
2042 "${MBOX}"
2043 cksum_test content:011 "${MBOX}" '454973928 610'
2045 # Trailing WS
2046 ${rm} -f "${MBOX}"
2047 echo | "${SNAIL}" ${ARGS} \
2048 -s "1-1 B2 B3 B4 B5 B6 B\
2049 1-2 B2 B3 B4 B5 B6 B\
2050 1-3 B2 B3 B4 B5 B6 B\
2051 1-4 B2 B3 B4 B5 B6 B\
2052 1-5 B2 B3 B4 B5 B6 B\
2053 1-6 B2 B3 B4 B5 B6 " \
2054 "${MBOX}"
2055 cksum_test content:012 "${MBOX}" '1014122962 248'
2057 # Leading and trailing WS
2058 ${rm} -f "${MBOX}"
2059 echo | "${SNAIL}" ${ARGS} \
2060 -s " 2-1 B2 B3 B4 B5 B6 B\
2061 1-2 B2 B3 B4 B5 B6 B\
2062 1-3 B2 B3 B4 B5 B6 B\
2063 1-4 B2 B3 B4 B5 B6 " \
2064 "${MBOX}"
2065 cksum_test content:013 "${MBOX}" '3212167908 187'
2067 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
2068 # have a (better) test framework materialize a quick shot
2069 ${rm} -f "${MBOX}"
2070 TRAP_EXIT_ADDONS=./.ttt
2072 mkdir ./.ttt || exit 1
2073 cd ./.ttt || exit 2
2074 : > "ma'ger.txt"
2075 : > "mä'ger.txt"
2076 : > 'diet\ is \curd.txt'
2077 : > 'diet "is" curd.txt'
2078 : > höde-tröge.txt
2079 : > 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
2080 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
2081 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
2082 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
2084 echo bla | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2085 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
2086 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
2087 -a ./.ttt/höde-tröge.txt \
2088 -a ./.ttt/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 \
2089 -a ./.ttt/höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt \
2090 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
2091 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
2092 "${MBOX}"
2093 ${rm} -rf ./.ttt
2094 cksum_test content:14 "${MBOX}" '589846634 2491'
2095 # `resend' test
2096 printf "Resend ${BODY}\nx\n" | "${SNAIL}" ${ARGS} -f "${MBOX}"
2097 cksum_test content:14-2 "${MBOX}" '589846634 2491'
2100 t_all() {
2101 if have_feat devel; then
2102 ARGS="${ARGS} -Smemdebug"
2103 export ARGS
2105 t_behave
2106 t_content
2109 if [ -z "${CHECK_ONLY}" ]; then
2110 cc_all_configs
2111 else
2112 t_all
2115 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
2117 exit ${ESTAT}
2118 # s-sh-mode