fakedate(): implement ourselfs (Joseph Bisch)..
[s-mailx.git] / cc-test.sh
bloba4a453e56870a66c6ce6bf64469e3d948291af3f
1 #!/bin/sh -
2 #@ Synopsis: ./cc-test.sh [--check-only s-mailx-binary]
3 #@ ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]
4 #@ The latter generates output files.
5 #@ TODO _All_ the tests should happen in a temporary subdir.
6 # Public Domain
8 # Instead of figuring out the environment in here, require a configured build
9 # system and include that! Our makefile and configure ensure that this test
10 # does not run in the configured, but the user environment nonetheless!
11 if [ -f ./mk-config.ev ]; then
12 . ./mk-config.ev
13 if [ -z "${MAILX__CC_TEST_RUNNING}" ]; then
14 MAILX__CC_TEST_RUNNING=1
15 export MAILX__CC_TEST_RUNNING
16 exec "${SHELL}" "${0}" "${@}"
18 else
19 echo >&2 'S-nail/S-mailx is not configured.'
20 echo >&2 'This test script requires the shell environment that only the'
21 echo >&2 'configuration script can figure out, even if it will be used to'
22 echo >&2 'test a different binary than the one that would be produced!'
23 exit 41
26 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
27 # such is a compile-time variable
28 ARGS='-:/ -# -Sdotlock-ignore-error -Sexpandaddr=restrict'
29 ARGS="${ARGS}"' -Smime-encoding=quoted-printable -Snosave -Sstealthmua'
30 ADDARG_UNI=-Sttycharset=UTF-8
31 CONF=./make.rc
32 BODY=./.cc-body.txt
33 MBOX=./.cc-test.mbox
34 MAIL=/dev/null
35 #UTF8_LOCALE= autodetected unless set
37 # Note valgrind has problems with FDs in forked childs, which causes some tests
38 # to fail (the FD is rewound and thus will be dumped twice)
39 MEMTESTER=
40 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
42 ## -- (>8 -- 8<) -- ##
44 ( set -o noglob ) >/dev/null 2>&1 && noglob_shell=1 || unset noglob_shell
46 msg() {
47 fmt=${1}
48 shift
49 printf >&2 -- "${fmt}\\n" "${@}"
52 ## -- >8 -- 8< -- ##
54 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE awk cat cksum rm sed grep
56 LC_ALL=C LANG=C
57 TZ=UTC
58 # Wed Oct 2 01:50:07 UTC 1996
59 SOURCE_DATE_EPOCH=844221007
61 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
62 unset POSIXLY_CORRECT LOGNAME USER
64 usage() {
65 echo >&2 "Synopsis: ./cc-test.sh [--check-only s-mailx-binary]"
66 echo >&2 "Synopsis: ./cc-test.sh --mae-test s-mailx-binary [:TESTNAME:]"
67 exit 1
70 CHECK_ONLY= MAE_TEST= MAILX=
71 if [ "${1}" = --check-only ]; then
72 CHECK_ONLY=1
73 MAILX=${2}
74 [ -x "${MAILX}" ] || usage
75 shift 2
76 elif [ "${1}" = --mae-test ]; then
77 MAE_TEST=1
78 MAILX=${2}
79 [ -x "${MAILX}" ] || usage
80 shift 2
82 RAWMAILX=${MAILX}
83 MAILX="${MEMTESTER}${MAILX}"
84 export RAWMAILX MAILX
86 if [ -n "${CHECK_ONLY}${MAE_TEST}" ] && [ -z "${UTF8_LOCALE}" ]; then
87 # Try ourselfs for nl_langinfo(CODESET) output first (requires a new version)
88 i=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
89 \define cset_test {
90 \if [ "${ttycharset}" @i=% utf ]
91 \echo $LC_ALL
92 \xit 0
93 \end
94 \if [ "${#}" -gt 0 ]
95 \wysh set LC_ALL=${1}
96 \shift
97 \eval xcall cset_test "${@}"
98 \end
99 \xit 1
101 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 en_EN.utf8 en_EN.UTF-8 \
102 en_US.utf8 en_US.UTF-8
104 [ $? -eq 0 ] && UTF8_LOCALE=$i
106 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr) >/dev/null 2>&1; then
107 UTF8_LOCALE=`locale -a | { m=
108 while read n; do
109 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
110 m=${n}
111 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
112 exit 0
115 m=${n}
116 done
117 echo ${m}
122 ESTAT=0
124 TRAP_EXIT_ADDONS=
125 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
126 trap "exit 1" HUP INT TERM
128 # cc_all_configs()
129 # Test all configs TODO doesn't cover all *combinations*, stupid!
130 cc_all_configs() {
131 < ${CONF} ${awk} '
132 BEGIN {
133 NOTME["OPT_AUTOCC"] = 1
134 NOTME["OPT_DEBUG"] = 1
135 NOTME["OPT_DEVEL"] = 1
136 NOTME["OPT_NOEXTMD5"] = 1
137 NOTME["OPT_ASAN_ADDRESS"] = 1
138 NOTME["OPT_ASAN_MEMORY"] = 1
139 NOTME["OPT_FORCED_STACKPROT"] = 1
140 NOTME["OPT_NOMEMDBG"] = 1
141 NOTME["OPT_NYD2"] = 1
142 i = 0
144 /^[[:space:]]*OPT_/ {
145 sub(/^[[:space:]]*/, "")
146 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
147 # does not seem to be a compliant escape for =
148 #sub(/=.*$/, "")
149 $1 = substr($1, 1, index($1, "=") - 1)
150 if (NOTME[$1])
151 next
152 data[i++] = $1
154 END {
155 # Doing this completely sequentially and not doing make distclean in
156 # between runs should effectively result in lesser compilations.
157 # It is completely dumb nonetheless... TODO
158 for (j = 1; j < i; ++j) {
159 for (k = 1; k < j; ++k)
160 printf data[k] "=1 "
161 for (k = j; k < i; ++k)
162 printf data[k] "=0 "
163 printf "OPT_AUTOCC=1\n"
165 for (j = 1; j < i; ++j) {
166 for (k = 1; k < j; ++k)
167 printf data[k] "=0 "
168 for (k = j; k < i; ++k)
169 printf data[k] "=1 "
170 printf "OPT_AUTOCC=1\n"
172 # With debug
173 for (j = 1; j < i; ++j) {
174 for (k = 1; k < j; ++k)
175 printf data[k] "=1 "
176 for (k = j; k < i; ++k)
177 printf data[k] "=0 "
178 printf "OPT_AUTOCC=1\n"
179 printf "OPT_DEBUG=1\n"
181 for (j = 1; j < i; ++j) {
182 for (k = 1; k < j; ++k)
183 printf data[k] "=0 "
184 for (k = j; k < i; ++k)
185 printf data[k] "=1 "
186 printf "OPT_AUTOCC=1\n"
187 printf "OPT_DEBUG=1\n"
190 printf "CONFIG=NULL OPT_AUTOCC=0\n"
191 printf "CONFIG=NULL OPT_AUTOCC=1\n"
192 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
193 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
194 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
195 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
196 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
197 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
198 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
199 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
200 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
201 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
202 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
203 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
205 ' | while read c; do
206 printf "\n\n##########\n$c\n"
207 printf "\n\n##########\n$c\n" >&2
208 sh -c "${MAKE} ${c} all test"
209 done
210 ${MAKE} distclean
213 have_feat() {
214 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
215 ${grep} +${1} ) >/dev/null 2>&1
218 t_prolog() {
219 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
220 TRAP_EXIT_ADDONS=
221 [ ${#} -gt 0 ] && printf '[%s]\n' "${1}"
223 t_epilog() {
224 t_prolog
227 check() {
228 restat=${?} tid=${1} eestat=${2} f=${3} s=${4}
229 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
230 err "${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
231 csum="`${cksum} < ${f}`"
232 if [ "${csum}" = "${s}" ]; then
233 printf '%s: ok\n' "${tid}"
234 else
235 ESTAT=1
236 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
238 if [ -n "${MAE_TEST}" ]; then
239 x=`echo ${tid} | ${tr} "/:=" "__-"`
240 ${cp} -f "${f}" ./mae-test-"${x}"
244 err() {
245 ESTAT=1
246 printf '%s: error: %s\n' ${1} "${2}"
249 ex0_test() {
250 # $1=test name [$2=status]
251 __qm__=${?}
252 [ ${#} -gt 1 ] && __qm__=${2}
253 if [ ${__qm__} -ne 0 ]; then
254 err $1 'unexpected non-0 exit status'
255 else
256 printf '%s: ok\n' "${1}"
260 exn0_test() {
261 # $1=test name [$2=status]
262 __qm__=${?}
263 [ ${#} -gt 1 ] && __qm__=${2}
264 if [ ${__qm__} -eq 0 ]; then
265 err $1 'unexpected 0 exit status'
266 else
267 printf '%s: ok\n' "${1}"
271 if ( [ "$((1 + 1))" = 2 ] ) >/dev/null 2>&1; then
272 add() {
273 echo "$((${1} + ${2}))"
275 else
276 add() {
277 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
281 if ( [ "$((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
282 modulo() {
283 echo "$((${1} % ${2}))"
285 else
286 modulo() {
287 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
291 # t_behave()
292 # Basic (easily testable) behaviour tests
293 t_behave() {
294 t_behave_X_opt_input_command_stack
295 t_behave_X_errexit
296 t_behave_S_freeze
297 t_behave_wysh
298 t_behave_input_inject_semicolon_seq
299 t_behave_commandalias
300 t_behave_ifelse
301 t_behave_localopts
302 t_behave_local
303 t_behave_macro_param_shift
304 t_behave_addrcodec
305 t_behave_vexpr
306 t_behave_call_ret
307 t_behave_xcall
308 t_behave_vpospar
309 t_behave_atxplode
310 t_behave_read
312 t_behave_mbox
313 t_behave_maildir
314 t_behave_record_a_resend
315 t_behave_e_H_L_opts
317 t_behave_alternates
318 t_behave_alias
319 # FIXME t_behave_mlist
320 t_behave_filetype
322 t_behave_message_injections
323 t_behave_compose_hooks
324 t_behave_mass_recipients
325 t_behave_mime_types_load_control
326 t_behave_lreply_futh_rth_etc
328 t_behave_xxxheads_rfc2047
329 t_behave_rfc2231
330 t_behave_iconv_mbyte_base64
331 t_behave_iconv_mainbody
332 t_behave_q_t_etc_opts
334 t_behave_s_mime
337 t_behave_X_opt_input_command_stack() {
338 t_prolog t_behave_X_opt_input_command_stack
340 ${cat} <<- '__EOT' > "${BODY}"
341 echo 1
342 define mac0 {
343 echo mac0-1 via1 $0
345 call mac0
346 echo 2
347 source '\
348 echo "define mac1 {";\
349 echo " echo mac1-1 via1 \$0";\
350 echo " call mac0";\
351 echo " echo mac1-2";\
352 echo " call mac2";\
353 echo " echo mac1-3";\
354 echo "}";\
355 echo "echo 1-1";\
356 echo "define mac2 {";\
357 echo " echo mac2-1 via1 \$0";\
358 echo " call mac0";\
359 echo " echo mac2-2";\
360 echo "}";\
361 echo "echo 1-2";\
362 echo "call mac1";\
363 echo "echo 1-3";\
364 echo "source \"\
365 echo echo 1-1-1 via1 \$0;\
366 echo call mac0;\
367 echo echo 1-1-2;\
368 | \"";\
369 echo "echo 1-4";\
371 echo 3
372 call mac2
373 echo 4
374 undefine *
375 __EOT
377 # The -X option supports multiline arguments, and those can internally use
378 # reverse solidus newline escaping. And all -X options are joined...
379 APO=\'
380 < "${BODY}" ${MAILX} ${ARGS} \
381 -X 'e\' \
382 -X ' c\' \
383 -X ' h\' \
384 -X ' o \' \
385 -X 1 \
387 define mac0 {
388 echo mac0-1 via2 $0
390 call mac0
391 echo 2
394 source '${APO}'\
395 echo "define mac1 {";\
396 echo " echo mac1-1 via2 \$0";\
397 echo " call mac0";\
398 echo " echo mac1-2";\
399 echo " call mac2";\
400 echo " echo mac1-3";\
401 echo "}";\
402 echo "echo 1-1";\
403 echo "define mac2 {";\
404 echo " echo mac2-1 via2 \$0";\
405 echo " call mac0";\
406 echo " echo mac2-2";\
407 echo "}";\
408 echo "echo 1-2";\
409 echo "call mac1";\
410 echo "echo 1-3";\
411 echo "source \"\
412 echo echo 1-1-1 via2 \$0;\
413 echo call mac0;\
414 echo echo 1-1-2;\
415 | \"";\
416 echo "echo 1-4";\
417 | '${APO}'
418 echo 3
421 call mac2
422 echo 4
423 undefine *
424 ' > "${MBOX}"
426 check behave:x_opt_input_command_stack 0 "${MBOX}" '1786542668 416'
428 t_epilog
431 t_behave_X_errexit() {
432 t_prolog t_behave_X_errexit
434 ${cat} <<- '__EOT' > "${BODY}"
435 echo one
436 echos nono
437 echo two
438 __EOT
440 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
441 -X'echo one' -X' echos nono ' -X'echo two' \
442 > "${MBOX}" 2>&1
443 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
445 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
446 > "${MBOX}" 2>&1
447 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
449 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Snomemdebug \
450 > "${MBOX}" 2>&1
451 check behave:x_errexit-3 0 "${MBOX}" '916157812 53'
455 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
456 -X'echo one' -X' echos nono ' -X'echo two' \
457 > "${MBOX}" 2>&1
458 check behave:x_errexit-4 1 "${MBOX}" '2118430867 49'
460 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
461 > "${MBOX}" 2>&1
462 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
464 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
465 > "${MBOX}" 2>&1
466 check behave:x_errexit-6 1 "${MBOX}" '12955965 172'
468 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
469 > "${MBOX}" 2>&1
470 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
472 ## Repeat 4-7 with ignerr set
474 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
476 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
477 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
478 > "${BODY}" 2>&1
479 check behave:x_errexit-8 0 "${BODY}" '916157812 53'
481 </dev/null ${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
482 > "${BODY}" 2>&1
483 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
485 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
486 > "${BODY}" 2>&1
487 check behave:x_errexit-10 0 "${BODY}" '916157812 53'
489 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
490 > "${BODY}" 2>&1
491 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
493 t_epilog
496 t_behave_S_freeze() {
497 t_prolog t_behave_S_freeze
498 oterm=$TERM
499 unset TERM
501 # Test basic assumption
502 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
503 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
504 -Xx > "${MBOX}" 2>&1
505 check behave:s_freeze-1 0 "${MBOX}" '270686329 21'
508 ${cat} <<- '__EOT' > "${BODY}"
509 echo asksub<$asksub>
510 set asksub
511 echo asksub<$asksub>
512 __EOT
513 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
514 -Snoasksub -Sasksub -Snoasksub \
515 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
516 -Xx > "${MBOX}" 2>&1
517 check behave:s_freeze-2 0 "${MBOX}" '3182942628 37'
519 ${cat} <<- '__EOT' > "${BODY}"
520 echo asksub<$asksub>
521 unset asksub
522 echo asksub<$asksub>
523 __EOT
524 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
525 -Snoasksub -Sasksub \
526 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
527 -Xx > "${MBOX}" 2>&1
528 check behave:s_freeze-3 0 "${MBOX}" '2006554293 39'
531 ${cat} <<- '__EOT' > "${BODY}"
532 echo dietcurd<$dietcurd>
533 set dietcurd=cherry
534 echo dietcurd<$dietcurd>
535 __EOT
536 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
537 -Sdietcurd=strawberry -Snodietcurd -Sdietcurd=vanilla \
538 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
539 -X'echo dietcurd<$dietcurd>' \
540 -Xx > "${MBOX}" 2>&1
541 check behave:s_freeze-4 0 "${MBOX}" '1985768109 65'
543 ${cat} <<- '__EOT' > "${BODY}"
544 echo dietcurd<$dietcurd>
545 unset dietcurd
546 echo dietcurd<$dietcurd>
547 __EOT
548 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
549 -Sdietcurd=strawberry -Snodietcurd \
550 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
551 -X'echo dietcurd<$dietcurd>' \
552 -Xx > "${MBOX}" 2>&1
553 check behave:s_freeze-5 0 "${MBOX}" '151574279 51'
555 # TODO once we have a detached one with env=1..
556 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
557 echo 'behave:s_freeze-{6,7}: shell sets $TERM, skipped'
558 else
559 ${cat} <<- '__EOT' > "${BODY}"
560 !echo "shell says TERM<$TERM>"
561 echo TERM<$TERM>
562 !echo "shell says TERM<$TERM>"
563 set TERM=cherry
564 !echo "shell says TERM<$TERM>"
565 echo TERM<$TERM>
566 !echo "shell says TERM<$TERM>"
567 __EOT
568 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
569 -STERM=strawberry -SnoTERM -STERM=vanilla \
570 -X'echo mail<$TERM>' -X'unset TERM' \
571 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
572 -Xx > "${MBOX}" 2>&1
573 check behave:s_freeze-6 0 "${MBOX}" '1211476036 167'
575 ${cat} <<- '__EOT' > "${BODY}"
576 !echo "shell says TERM<$TERM>"
577 echo TERM<$TERM>
578 !echo "shell says TERM<$TERM>"
579 set TERM=cherry
580 !echo "shell says TERM<$TERM>"
581 echo TERM<$TERM>
582 !echo "shell says TERM<$TERM>"
583 __EOT
584 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
585 -STERM=strawberry -SnoTERM \
586 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
587 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
588 -Xx > "${MBOX}" 2>&1
589 check behave:s_freeze-7 0 "${MBOX}" '3365080441 132'
592 TERM=$oterm
593 t_epilog
596 t_behave_wysh() {
597 t_prolog t_behave_wysh
599 ${cat} <<- '__EOT' > "${BODY}"
601 echo abcd
602 echo a'b'c'd'
603 echo a"b"c"d"
604 echo a$'b'c$'d'
605 echo 'abcd'
606 echo "abcd"
607 echo $'abcd'
608 echo a\ b\ c\ d
609 echo a 'b c' d
610 echo a "b c" d
611 echo a $'b c' d
613 echo 'a$`"\'
614 echo "a\$\`'\"\\"
615 echo $'a\$`\'\"\\'
616 echo $'a\$`\'"\\'
617 # DIET=CURD TIED=
618 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
619 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
620 echo $'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
622 echo a$'\101\0101\x41\u0041\u41\U00000041\U41'c
623 echo a$'\u0041\u41\u0C1\U00000041\U41'c
624 echo a$'\377'c
625 echo a$'\0377'c
626 echo a$'\400'c
627 echo a$'\0400'c
628 echo a$'\U1100001'c
630 echo a$'b\0c'd
631 echo a$'b\00c'de
632 echo a$'b\000c'df
633 echo a$'b\0000c'dg
634 echo a$'b\x0c'dh
635 echo a$'b\x00c'di
636 echo a$'b\u0'dj
637 echo a$'b\u00'dk
638 echo a$'b\u000'dl
639 echo a$'b\u0000'dm
640 echo a$'b\U0'dn
641 echo a$'b\U00'do
642 echo a$'b\U000'dp
643 echo a$'b\U0000'dq
644 echo a$'b\U00000'dr
645 echo a$'b\U000000'ds
646 echo a$'b\U0000000'dt
647 echo a$'b\U00000000'du
649 echo a$'\cI'b
650 echo a$'\011'b
651 echo a$'\x9'b
652 echo a$'\u9'b
653 echo a$'\U9'b
654 echo a$'\c@'b c d
655 __EOT
657 if [ -z "${UTF8_LOCALE}" ]; then
658 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
659 else
660 < "${BODY}" DIET=CURD TIED= \
661 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} 2>/dev/null > "${MBOX}"
662 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
665 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
666 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
668 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
669 wysh set mager='\hey\'
670 varshow mager
671 wysh set mager="\hey\\"
672 varshow mager
673 wysh set mager=$'\hey\\'
674 varshow mager
675 __EOT
676 check behave:wysh-3 0 "${MBOX}" '1289698238 69'
678 t_epilog
681 t_behave_input_inject_semicolon_seq() {
682 t_prolog t_behave_input_inject_semicolon_seq
684 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
685 define mydeepmac {
686 echon '(mydeepmac)';
688 define mymac {
689 echon this_is_mymac;call mydeepmac;echon ';';
691 echon one';';call mymac;echon two";";call mymac;echo three$';';
692 define mymac {
693 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
695 echon one';';call mymac;echon two";";call mymac;echo three$';';
696 __EOT
698 check behave:input_inject_semicolon_seq 0 "${MBOX}" '512117110 140'
700 t_epilog
703 t_behave_commandalias() {
704 t_prolog t_behave_commandalias
706 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
707 commandalias echo echo hoho
708 echo stop.
709 commandalias X Xx
710 commandalias Xx XxX
711 commandalias XxX XxXx
712 commandalias XxXx XxXxX
713 commandalias XxXxX XxXxXx
714 commandalias XxXxXx echo huhu
715 commandalias XxXxXxX echo huhu
717 commandalias XxXxXx XxXxXxX
719 uncommandalias echo
720 commandalias XxXxXx echo huhu
722 __EOT
724 check behave:commandalias 0 "${MBOX}" '3694143612 31'
726 t_epilog
729 t_behave_ifelse() {
730 t_prolog t_behave_ifelse
732 # Nestable conditions test
733 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
734 if 0
735 echo 1.err
736 else
737 echo 1.ok
738 endif
739 if 1
740 echo 2.ok
741 else
742 echo 2.err
743 endif
744 if $dietcurd
745 echo 3.err
746 else
747 echo 3.ok
748 endif
749 set dietcurd=yoho
750 if $dietcurd
751 echo 4.ok
752 else
753 echo 4.err
754 endif
755 if $dietcurd == 'yoho'
756 echo 5.ok
757 else
758 echo 5.err
759 endif
760 if $dietcurd @== 'Yoho'
761 echo 5-1.ok
762 else
763 echo 5-1.err
764 endif
765 if $dietcurd == 'Yoho'
766 echo 5-2.err
767 else
768 echo 5-2.ok
769 endif
770 if $dietcurd != 'yoho'
771 echo 6.err
772 else
773 echo 6.ok
774 endif
775 if $dietcurd @!= 'Yoho'
776 echo 6-1.err
777 else
778 echo 6-1.ok
779 endif
780 if $dietcurd != 'Yoho'
781 echo 6-2.ok
782 else
783 echo 6-2.err
784 endif
785 # Nesting
786 if faLse
787 echo 7.err1
788 if tRue
789 echo 7.err2
790 if yEs
791 echo 7.err3
792 else
793 echo 7.err4
794 endif
795 echo 7.err5
796 endif
797 echo 7.err6
798 else
799 echo 7.ok7
800 if YeS
801 echo 7.ok8
802 if No
803 echo 7.err9
804 else
805 echo 7.ok9
806 endif
807 echo 7.ok10
808 else
809 echo 7.err11
810 if yeS
811 echo 7.err12
812 else
813 echo 7.err13
814 endif
815 endif
816 echo 7.ok14
817 endif
818 if r
819 echo 8.ok1
820 if R
821 echo 8.ok2
822 else
823 echo 8.err2
824 endif
825 echo 8.ok3
826 else
827 echo 8.err1
828 endif
829 if s
830 echo 9.err1
831 else
832 echo 9.ok1
833 if S
834 echo 9.err2
835 else
836 echo 9.ok2
837 endif
838 echo 9.ok3
839 endif
840 # `elif'
841 if $dietcurd == 'yohu'
842 echo 10.err1
843 elif $dietcurd == 'yoha'
844 echo 10.err2
845 elif $dietcurd == 'yohe'
846 echo 10.err3
847 elif $dietcurd == 'yoho'
848 echo 10.ok1
849 if $dietcurd == 'yohu'
850 echo 10.err4
851 elif $dietcurd == 'yoha'
852 echo 10.err5
853 elif $dietcurd == 'yohe'
854 echo 10.err6
855 elif $dietcurd == 'yoho'
856 echo 10.ok2
857 if $dietcurd == 'yohu'
858 echo 10.err7
859 elif $dietcurd == 'yoha'
860 echo 10.err8
861 elif $dietcurd == 'yohe'
862 echo 10.err9
863 elif $dietcurd == 'yoho'
864 echo 10.ok3
865 else
866 echo 10.err10
867 endif
868 else
869 echo 10.err11
870 endif
871 else
872 echo 10.err12
873 endif
874 # integer
875 set dietcurd=10
876 if $dietcurd -lt 11
877 echo 11.ok1
878 if $dietcurd -gt 9
879 echo 11.ok2
880 else
881 echo 11.err2
882 endif
883 if $dietcurd -eq 10
884 echo 11.ok3
885 else
886 echo 11.err3
887 endif
888 if $dietcurd -ge 10
889 echo 11.ok4
890 else
891 echo 11.err4
892 endif
893 if $dietcurd -le 10
894 echo 11.ok5
895 else
896 echo 11.err5
897 endif
898 if $dietcurd -ge 11
899 echo 11.err6
900 else
901 echo 11.ok6
902 endif
903 if $dietcurd -le 9
904 echo 11.err7
905 else
906 echo 11.ok7
907 endif
908 else
909 echo 11.err1
910 endif
911 set dietcurd=Abc
912 if $dietcurd < aBd
913 echo 12.ok1
914 if $dietcurd @> abB
915 echo 12.ok2
916 else
917 echo 12.err2
918 endif
919 if $dietcurd @== aBC
920 echo 12.ok3
921 else
922 echo 12.err3
923 endif
924 if $dietcurd @>= AbC
925 echo 12.ok4
926 else
927 echo 12.err4
928 endif
929 if $dietcurd @<= ABc
930 echo 12.ok5
931 else
932 echo 12.err5
933 endif
934 if $dietcurd @>= abd
935 echo 12.err6
936 else
937 echo 12.ok6
938 endif
939 if $dietcurd @<= abb
940 echo 12.err7
941 else
942 echo 12.ok7
943 endif
944 else
945 echo 12.err1
946 endif
947 if $dietcurd < aBc
948 echo 12-1.ok
949 else
950 echo 12-1.err
951 endif
952 if $dietcurd @< aBc
953 echo 12-2.err
954 else
955 echo 12-2.ok
956 endif
957 if $dietcurd > ABc
958 echo 12-3.ok
959 else
960 echo 12-3.err
961 endif
962 if $dietcurd @> ABc
963 echo 12-3.err
964 else
965 echo 12-3.ok
966 endif
967 if $dietcurd @i=% aB
968 echo 13.ok
969 else
970 echo 13.err
971 endif
972 if $dietcurd =% aB
973 echo 13-1.err
974 else
975 echo 13-1.ok
976 endif
977 if $dietcurd @=% bC
978 echo 14.ok
979 else
980 echo 14.err
981 endif
982 if $dietcurd !% aB
983 echo 15-1.ok
984 else
985 echo 15-1.err
986 endif
987 if $dietcurd @!% aB
988 echo 15-2.err
989 else
990 echo 15-2.ok
991 endif
992 if $dietcurd !% bC
993 echo 15-3.ok
994 else
995 echo 15-3.err
996 endif
997 if $dietcurd @!% bC
998 echo 15-4.err
999 else
1000 echo 15-4.ok
1001 endif
1002 if $dietcurd =% Cd
1003 echo 16.err
1004 else
1005 echo 16.ok
1006 endif
1007 if $dietcurd !% Cd
1008 echo 17.ok
1009 else
1010 echo 17.err
1011 endif
1012 set diet=abc curd=abc
1013 if $diet == $curd
1014 echo 18.ok
1015 else
1016 echo 18.err
1017 endif
1018 set diet=abc curd=abcd
1019 if $diet != $curd
1020 echo 19.ok
1021 else
1022 echo 19.err
1023 endif
1024 # 1. Shitty grouping capabilities as of today
1025 unset diet curd ndefined
1026 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
1027 [ yes ]
1028 echo 20.ok
1029 else
1030 echo 20.err
1031 endif
1032 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
1033 echo 21.ok
1034 else
1035 echo 21.err
1036 endif
1037 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
1038 echo 22.ok
1039 else
1040 echo 22.err
1041 endif
1042 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
1043 echo 23.ok
1044 else
1045 echo 23.err
1046 endif
1047 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
1048 echo 24.err
1049 else
1050 echo 24.ok
1051 endif
1052 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
1053 && [ no ] || [ yes ]
1054 echo 25.ok
1055 else
1056 echo 25.err
1057 endif
1058 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1059 echo 26.ok
1060 else
1061 echo 26.err
1062 endif
1063 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
1064 echo 27.err
1065 else
1066 echo 27.ok
1067 endif
1068 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
1069 echo 28.err
1070 else
1071 echo 28.ok
1072 endif
1073 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1074 echo 29.err
1075 else
1076 echo 29.ok
1077 endif
1078 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
1079 echo 30.err
1080 else
1081 echo 30.ok
1082 endif
1083 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
1084 echo 31.ok
1085 else
1086 echo 31.err
1087 endif
1088 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
1089 echo 32.err
1090 else
1091 echo 32.ok
1092 endif
1093 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
1094 echo 33.ok
1095 else
1096 echo 33.err
1097 endif
1098 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
1099 echo 34.err
1100 else
1101 echo 34.ok
1102 endif
1103 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
1104 echo 35.ok
1105 else
1106 echo 35.err
1107 endif
1108 set diet=yo curd=ho
1109 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1110 echo 36.err
1111 else
1112 echo 36.ok
1113 endif
1114 set ndefined
1115 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1116 echo 37.ok
1117 else
1118 echo 37.err
1119 endif
1120 # 2. Shitty grouping capabilities as of today
1121 unset diet curd ndefined
1122 if [ false || false || true ] && [ false || true ] && yes
1123 echo 40.ok
1124 else
1125 echo 40.err
1126 endif
1127 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
1128 echo 41.ok
1129 else
1130 echo 41.err
1131 endif
1132 if [ 1 || 0 || 0 || 0 ]
1133 echo 42.ok
1134 else
1135 echo 42.err
1136 endif
1137 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
1138 echo 43.ok
1139 else
1140 echo 43.err
1141 endif
1142 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
1143 echo 44.err
1144 else
1145 echo 44.ok
1146 endif
1147 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
1148 echo 45.ok
1149 else
1150 echo 45.err
1151 endif
1152 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1153 echo 46.ok
1154 else
1155 echo 46.err
1156 endif
1157 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1158 echo 47.err
1159 else
1160 echo 47.ok
1161 endif
1162 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1163 echo 48.err
1164 else
1165 echo 48.ok
1166 endif
1167 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1168 echo 49.err
1169 else
1170 echo 49.ok
1171 endif
1172 if 1 || 0 || 0 || 0 && 0
1173 echo 50.err
1174 else
1175 echo 50.ok
1176 endif
1177 if 1 || 0 || 0 || 0 && 1
1178 echo 51.ok
1179 else
1180 echo 51.err
1181 endif
1182 if 0 || 0 || 0 || 1 && 0
1183 echo 52.err
1184 else
1185 echo 52.ok
1186 endif
1187 if 0 || 0 || 0 || 1 && 1
1188 echo 53.ok
1189 else
1190 echo 53.err
1191 endif
1192 if 0 || 0 || 0 || 1 && 0 || 1 && 0
1193 echo 54.err
1194 else
1195 echo 54.ok
1196 endif
1197 if 0 || 0 || 0 || 1 && 0 || 1 && 1
1198 echo 55.ok
1199 else
1200 echo 55.err
1201 endif
1202 set diet=yo curd=ho
1203 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1204 echo 56.err
1205 else
1206 echo 56.ok
1207 endif
1208 if $diet == 'yo' && $curd == 'ho' && $ndefined
1209 echo 57.err
1210 else
1211 echo 57.ok
1212 endif
1213 set ndefined
1214 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1215 echo 57.ok
1216 else
1217 echo 57.err
1218 endif
1219 if $diet == 'yo' && $curd == 'ho' && $ndefined
1220 echo 58.ok
1221 else
1222 echo 58.err
1223 endif
1224 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1225 echo 59.ok
1226 else
1227 echo 59.err
1228 endif
1229 # Some more en-braced variables
1230 set diet=yo curd=ho
1231 if ${diet} == ${curd}
1232 echo 70.err
1233 else
1234 echo 70.ok
1235 endif
1236 if ${diet} != ${curd}
1237 echo 71.ok
1238 else
1239 echo 71.err
1240 endif
1241 if $diet == ${curd}
1242 echo 72.err
1243 else
1244 echo 72.ok
1245 endif
1246 if ${diet} == $curd
1247 echo 73.err
1248 else
1249 echo 73.ok
1250 endif
1251 # Unary !
1252 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1253 echo 80.ok
1254 else
1255 echo 80.err
1256 endif
1257 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1258 echo 81.ok
1259 else
1260 echo 81.err
1261 endif
1262 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1263 echo 82.ok
1264 else
1265 echo 82.err
1266 endif
1267 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1268 echo 83.err
1269 else
1270 echo 83.ok
1271 endif
1272 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1273 echo 84.err
1274 else
1275 echo 84.ok
1276 endif
1277 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1278 echo 85.err
1279 else
1280 echo 85.ok
1281 endif
1282 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1283 echo 86.err
1284 else
1285 echo 86.ok
1286 endif
1287 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1288 echo 87.ok
1289 else
1290 echo 87.err
1291 endif
1292 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1293 echo 88.ok
1294 else
1295 echo 88.err
1296 endif
1297 # Unary !, odd
1298 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1299 echo 90.ok
1300 else
1301 echo 90.err
1302 endif
1303 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1304 echo 91.ok
1305 else
1306 echo 91.err
1307 endif
1308 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1309 echo 92.ok
1310 else
1311 echo 92.err
1312 endif
1313 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1314 echo 93.err
1315 else
1316 echo 93.ok
1317 endif
1318 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1319 echo 94.ok
1320 else
1321 echo 94.err
1322 endif
1323 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1324 echo 95.err
1325 else
1326 echo 95.ok
1327 endif
1328 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1329 echo 96.err
1330 else
1331 echo 96.ok
1332 endif
1333 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1334 echo 97.ok
1335 else
1336 echo 97.err
1337 endif
1338 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1339 echo 98.ok
1340 else
1341 echo 98.err
1342 endif
1343 __EOT
1345 check behave:if-normal 0 "${MBOX}" '1688759742 719'
1347 if have_feat regex; then
1348 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1349 set dietcurd=yoho
1350 if $dietcurd =~ '^yo.*'
1351 echo 1.ok
1352 else
1353 echo 1.err
1354 endif
1355 if $dietcurd =~ '^Yo.*'
1356 echo 1-1.err
1357 else
1358 echo 1-1.ok
1359 endif
1360 if $dietcurd @=~ '^Yo.*'
1361 echo 1-2.ok
1362 else
1363 echo 1-2.err
1364 endif
1365 if $dietcurd =~ '^yOho.+'
1366 echo 2.err
1367 else
1368 echo 2.ok
1369 endif
1370 if $dietcurd @!~ '.*Ho$'
1371 echo 3.err
1372 else
1373 echo 3.ok
1374 endif
1375 if $dietcurd !~ '.+yohO$'
1376 echo 4.ok
1377 else
1378 echo 4.err
1379 endif
1380 if [ $dietcurd @i!~ '.+yoho$' ]
1381 echo 5.ok
1382 else
1383 echo 5.err
1384 endif
1385 if ! [ $dietcurd @i=~ '.+yoho$' ]
1386 echo 6.ok
1387 else
1388 echo 6.err
1389 endif
1390 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1391 echo 7.ok
1392 else
1393 echo 7.err
1394 endif
1395 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1396 echo 8.ok
1397 else
1398 echo 8.err
1399 endif
1400 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1401 echo 9.ok
1402 else
1403 echo 9.err
1404 endif
1405 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1406 echo 10.err
1407 else
1408 echo 10.ok
1409 endif
1410 if ! ! ! $dietcurd !~ '.+yoho$'
1411 echo 11.err
1412 else
1413 echo 11.ok
1414 endif
1415 if ! ! ! $dietcurd =~ '.+yoho$'
1416 echo 12.ok
1417 else
1418 echo 12.err
1419 endif
1420 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1421 echo 13.ok
1422 else
1423 echo 13.err
1424 endif
1425 set diet=abc curd='^abc$'
1426 if $diet =~ $curd
1427 echo 14.ok
1428 else
1429 echo 14.err
1430 endif
1431 set diet=abc curd='^abcd$'
1432 if $diet !~ $curd
1433 echo 15.ok
1434 else
1435 echo 15.err
1436 endif
1437 __EOT
1439 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1440 else
1441 printf 'behave:if-regex: unsupported, skipped\n'
1444 t_epilog
1447 t_behave_localopts() {
1448 t_prolog t_behave_localopts
1450 # Nestable conditions test
1451 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1452 define t2 {
1453 echo in: t2
1454 set t2=t2
1455 echo $t2
1457 define t1 {
1458 echo in: t1
1459 set gv1=gv1
1460 localopts on
1461 set lv1=lv1 lv2=lv2
1462 set lv3=lv3
1463 call t2
1464 localopts off
1465 set gv2=gv2
1466 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1468 define t0 {
1469 echo in: t0
1470 call t1
1471 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1472 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1474 account trouble {
1475 echo in: trouble
1476 call t0
1478 call t0
1479 unset gv1 gv2
1480 account trouble
1481 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1482 account null
1483 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1486 define ll2 {
1487 localopts $1
1488 set x=2
1489 echo ll2=$x
1491 define ll1 {
1492 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1493 set x=1
1494 echo ll1.1=$x
1495 call ll2 $1
1496 echo ll1.2=$x
1498 define ll0 {
1499 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1500 set x=0
1501 echo ll0.1=$x
1502 call ll1 $y "$@"
1503 echo ll0.2=$x
1505 define llx {
1506 echo ----- $1: $2 -> $3 -> $4
1507 echo ll-1.1=$x
1508 eval localopts $1
1509 call ll0 "$@"
1510 echo ll-1.2=$x
1511 unset x
1513 define lly {
1514 call llx 'call off' on on on
1515 call llx 'call off' off on on
1516 call llx 'call off' on off on
1517 call llx 'call off' on off off
1518 localopts call-fixate on
1519 call llx 'call-fixate on' on on on
1520 call llx 'call-fixate on' off on on
1521 call llx 'call-fixate on' on off on
1522 call llx 'call-fixate on' on off off
1523 unset x;localopts call on
1524 call llx 'call on' on on on
1525 call llx 'call on' off on on
1526 call llx 'call on' on off on
1527 call llx 'call on' on off off
1529 call lly
1530 __EOT
1532 check behave:localopts 0 "${MBOX}" '4016155249 1246'
1534 t_epilog
1537 t_behave_local() {
1538 t_prolog t_behave_local
1540 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1541 define du2 {
1542 echo du2-1 du=$du
1543 local set du=$1
1544 echo du2-2 du=$du
1545 local unset du
1546 echo du2-3 du=$du
1548 define du {
1549 local set du=dudu
1550 echo du-1 du=$du
1551 call du2 du2du2
1552 echo du-2 du=$du
1553 local set nodu
1554 echo du-3 du=$du
1556 define ich {
1557 echo ich-1 du=$du
1558 call du
1559 echo ich-2 du=$du
1561 define wir {
1562 localopts $1
1563 set du=wirwir
1564 echo wir-1 du=$du
1565 call ich
1566 echo wir-2 du=$du
1568 echo ------- global-1 du=$du
1569 call ich
1570 echo ------- global-2 du=$du
1571 set du=global
1572 call ich
1573 echo ------- global-3 du=$du
1574 call wir on
1575 echo ------- global-4 du=$du
1576 call wir off
1577 echo ------- global-5 du=$du
1578 __EOT
1580 check behave:local-1 0 "${MBOX}" '2411598140 641'
1582 t_epilog
1585 t_behave_macro_param_shift() {
1586 t_prolog t_behave_macro_param_shift
1588 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1589 define t2 {
1590 echo in: t2
1591 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1592 localopts on
1593 wysh set ignerr=$1
1594 shift
1595 localopts off
1596 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1597 if [ $# > 1 ] || [ $ignerr == '' ]
1598 shift 2
1599 else
1600 ignerr shift 2
1601 endif
1602 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1603 shift 0
1604 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1605 if [ $# > 0 ]
1606 shift
1607 endif
1608 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1610 define t1 {
1611 set errexit
1612 echo in: t1
1613 call t2 1 you get four args
1614 echo t1.1: $?';' ignerr ($ignerr) should not exist
1615 call t2 1 you get 'three args'
1616 echo t1.2: $?';' ignerr ($ignerr) should not exist
1617 call t2 1 you 'get two args'
1618 echo t1.3: $?';' ignerr ($ignerr) should not exist
1619 call t2 1 'you get one arg'
1620 echo t1.4: $?';' ignerr ($ignerr) should not exist
1621 ignerr call t2 '' 'you get one arg'
1622 echo t1.5: $?';' ignerr ($ignerr) should not exist
1624 call t1
1625 __EOT
1627 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1629 t_epilog
1632 t_behave_addrcodec() {
1633 t_prolog t_behave_addrcodec
1635 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1636 vput addrcodec res e 1 <doog@def>
1637 echo $?/$^ERRNAME $res
1638 eval vput addrcodec res d $res
1639 echo $?/$^ERRNAME $res
1640 vput addrcodec res e 2 . <doog@def>
1641 echo $?/$^ERRNAME $res
1642 eval vput addrcodec res d $res
1643 echo $?/$^ERRNAME $res
1644 vput addrcodec res e 3 Sauer Dr. <doog@def>
1645 echo $?/$^ERRNAME $res
1646 eval vput addrcodec res d $res
1647 echo $?/$^ERRNAME $res
1648 vput addrcodec res e 3.50 Sauer (Ma) Dr. <doog@def>
1649 echo $?/$^ERRNAME $res
1650 eval vput addrcodec res d $res
1651 echo $?/$^ERRNAME $res
1652 vput addrcodec res e 3.51 Sauer (Ma) "Dr." <doog@def>
1653 echo $?/$^ERRNAME $res
1654 eval vput addrcodec res d $res
1655 echo $?/$^ERRNAME $res
1657 vput addrcodec res +e 4 Sauer (Ma) Dr. <doog@def>
1658 echo $?/$^ERRNAME $res
1659 eval vput addrcodec res d $res
1660 echo $?/$^ERRNAME $res
1661 vput addrcodec res +e 5 Sauer (Ma) Braten Dr. <doog@def>
1662 echo $?/$^ERRNAME $res
1663 eval vput addrcodec res d $res
1664 echo $?/$^ERRNAME $res
1665 vput addrcodec res +e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1666 echo $?/$^ERRNAME $res
1667 eval vput addrcodec res d $res
1668 echo $?/$^ERRNAME $res
1669 vput addrcodec res +e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1670 echo $?/$^ERRNAME $res
1671 eval vput addrcodec res d $res
1672 echo $?/$^ERRNAME $res
1673 vput addrcodec res +e 8 \
1674 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1675 echo $?/$^ERRNAME $res
1676 eval vput addrcodec res d $res
1677 echo $?/$^ERRNAME $res
1678 vput addrcodec res +e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1679 echo $?/$^ERRNAME $res
1680 eval vput addrcodec res d $res
1681 echo $?/$^ERRNAME $res
1682 vput addrcodec res +e 10 (Ma)Braten Dr. (Heu) <doog@def>
1683 echo $?/$^ERRNAME $res
1684 eval vput addrcodec res d $res
1685 echo $?/$^ERRNAME $res
1686 vput addrcodec res +e 11 (Ma)Braten Dr"." (Heu) <doog@def>
1687 echo $?/$^ERRNAME $res
1688 eval vput addrcodec res d $res
1689 echo $?/$^ERRNAME $res
1690 vput addrcodec res +e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1691 echo $?/$^ERRNAME $res
1692 eval vput addrcodec res d $res
1693 echo $?/$^ERRNAME $res
1694 vput addrcodec res +e 13(Ma)Braten Dr. (Heu) <doog@def>
1695 echo $?/$^ERRNAME $res
1696 eval vput addrcodec res d $res
1697 echo $?/$^ERRNAME $res
1698 vput addrcodec res +e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1699 echo $?/$^ERRNAME $res
1700 eval vput addrcodec res d $res
1701 echo $?/$^ERRNAME $res
1702 vput addrcodec res +e 15 \
1703 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1704 echo $?/$^ERRNAME $res
1705 eval vput addrcodec res d $res
1706 echo $?/$^ERRNAME $res
1707 vput addrcodec res +e 16 \
1708 "Hey," "Du" <doog@def> "Wie()" findet "" Dr. "" das? ()
1709 echo $?/$^ERRNAME $res
1710 eval vput addrcodec res d $res
1711 echo $?/$^ERRNAME $res
1712 vput addrcodec res +e 17 \
1713 "Hey" Du <doog@def> "Wie() findet " " Dr. """ das? ()
1714 echo $?/$^ERRNAME $res
1715 eval vput addrcodec res d $res
1716 echo $?/$^ERRNAME $res
1717 vput addrcodec res +e 18 \
1718 <doog@def> "Hey" Du "Wie() findet " " Dr. """ das? ()
1719 echo $?/$^ERRNAME $res
1720 eval vput addrcodec res d $res
1721 echo $?/$^ERRNAME $res
1722 vput addrcodec res +e 19 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1723 echo $?/$^ERRNAME $res
1724 eval vput addrcodec res d $res
1725 echo $?/$^ERRNAME $res
1727 vput addrcodec res ++e 20 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1728 echo $?/$^ERRNAME $res
1729 vput addrcodec res ++e 21 Hey\,\"" <doog@def> "Wie()" findet \" Dr. \" das?
1730 echo $?/$^ERRNAME $res
1731 eval vput addrcodec res d $res
1732 echo $?/$^ERRNAME $res
1734 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1735 echo $?/$^ERRNAME $res
1736 eval vput addrcodec res d $res
1737 echo $?/$^ERRNAME $res
1739 vput addrcodec res s \
1740 "23 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1741 echo $?/$^ERRNAME $res
1743 # Fix for [f3852f88]
1744 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot(e)d"
1745 echo $?/$^ERRNAME $res
1746 eval vput addrcodec res d $res
1747 echo $?/$^ERRNAME $res
1748 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot(e)d"
1749 echo $?/$^ERRNAME $res
1750 eval vput addrcodec res d $res
1751 echo $?/$^ERRNAME $res
1752 __EOT
1754 check behave:addrcodec-1 0 "${MBOX}" '1047317989 2612'
1756 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1757 mlist isa1@list
1758 mlsubscribe isa2@list
1760 vput addrcodec res skin Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1761 echo $?/$^ERRNAME $res
1762 vput addrcodec res skinlist Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1763 echo $?/$^ERRNAME $res
1764 vput addrcodec res skin Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1765 echo $?/$^ERRNAME $res
1766 vput addrcodec res skinlist Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1767 echo $?/$^ERRNAME $res
1768 vput addrcodec res skin Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1769 echo $?/$^ERRNAME $res
1770 vput addrcodec res skinlist Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1771 echo $?/$^ERRNAME $res
1772 __EOT
1774 check behave:addrcodec-2 0 "${MBOX}" '1391779299 104'
1776 if have_feat idna; then
1777 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
1778 vput addrcodec res e (heu) <du@blödiän> "stroh" du
1779 echo $?/$^ERRNAME $res
1780 eval vput addrcodec res d $res
1781 echo $?/$^ERRNAME $res
1782 vput addrcodec res e <du@blödiän> du
1783 echo $?/$^ERRNAME $res
1784 eval vput addrcodec res d $res
1785 echo $?/$^ERRNAME $res
1786 vput addrcodec res e du <du@blödiän>
1787 echo $?/$^ERRNAME $res
1788 eval vput addrcodec res d $res
1789 echo $?/$^ERRNAME $res
1790 vput addrcodec res e <du@blödiän>
1791 echo $?/$^ERRNAME $res
1792 eval vput addrcodec res d $res
1793 echo $?/$^ERRNAME $res
1794 vput addrcodec res e du@blödiän
1795 echo $?/$^ERRNAME $res
1796 eval vput addrcodec res d $res
1797 echo $?/$^ERRNAME $res
1798 __EOT
1800 check behave:addrcodec-idna 0 "${MBOX}" '498775983 326'
1801 else
1802 printf 'behave:addrcodec-idna: unsupported, skipped\n'
1805 t_epilog
1808 t_behave_vexpr() {
1809 t_prolog t_behave_vexpr
1811 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1812 vput vexpr res = 9223372036854775807
1813 echo $?/$^ERRNAME $res
1814 vput vexpr res = 9223372036854775808
1815 echo $?/$^ERRNAME $res
1816 vput vexpr res =@ 9223372036854775808
1817 echo $?/$^ERRNAME $res
1818 vput vexpr res = -9223372036854775808
1819 echo $?/$^ERRNAME $res
1820 vput vexpr res = -9223372036854775809
1821 echo $?/$^ERRNAME $res
1822 vput vexpr res =@ -9223372036854775809
1823 echo $?/$^ERRNAME $res
1824 echo ' #1'
1825 vput vexpr res ~ 0
1826 echo $?/$^ERRNAME $res
1827 vput vexpr res ~ 1
1828 echo $?/$^ERRNAME $res
1829 vput vexpr res ~ -1
1830 echo $?/$^ERRNAME $res
1831 echo ' #2'
1832 vput vexpr res + 0 0
1833 echo $?/$^ERRNAME $res
1834 vput vexpr res + 0 1
1835 echo $?/$^ERRNAME $res
1836 vput vexpr res + 1 1
1837 echo $?/$^ERRNAME $res
1838 echo ' #3'
1839 vput vexpr res + 9223372036854775807 0
1840 echo $?/$^ERRNAME $res
1841 vput vexpr res + 9223372036854775807 1
1842 echo $?/$^ERRNAME $res
1843 vput vexpr res +@ 9223372036854775807 1
1844 echo $?/$^ERRNAME $res
1845 vput vexpr res + 0 9223372036854775807
1846 echo $?/$^ERRNAME $res
1847 vput vexpr res + 1 9223372036854775807
1848 echo $?/$^ERRNAME $res
1849 vput vexpr res +@ 1 9223372036854775807
1850 echo $?/$^ERRNAME $res
1851 echo ' #4'
1852 vput vexpr res + -9223372036854775808 0
1853 echo $?/$^ERRNAME $res
1854 vput vexpr res + -9223372036854775808 -1
1855 echo $?/$^ERRNAME $res
1856 vput vexpr res +@ -9223372036854775808 -1
1857 echo $?/$^ERRNAME $res
1858 vput vexpr res + 0 -9223372036854775808
1859 echo $?/$^ERRNAME $res
1860 vput vexpr res + -1 -9223372036854775808
1861 echo $?/$^ERRNAME $res
1862 vput vexpr res +@ -1 -9223372036854775808
1863 echo $?/$^ERRNAME $res
1864 echo ' #5'
1865 vput vexpr res - 0 0
1866 echo $?/$^ERRNAME $res
1867 vput vexpr res - 0 1
1868 echo $?/$^ERRNAME $res
1869 vput vexpr res - 1 1
1870 echo $?/$^ERRNAME $res
1871 echo ' #6'
1872 vput vexpr res - 9223372036854775807 0
1873 echo $?/$^ERRNAME $res
1874 vput vexpr res - 9223372036854775807 -1
1875 echo $?/$^ERRNAME $res
1876 vput vexpr res -@ 9223372036854775807 -1
1877 echo $?/$^ERRNAME $res
1878 vput vexpr res - 0 9223372036854775807
1879 echo $?/$^ERRNAME $res
1880 vput vexpr res - -1 9223372036854775807
1881 echo $?/$^ERRNAME $res
1882 vput vexpr res - -2 9223372036854775807
1883 echo $?/$^ERRNAME $res
1884 vput vexpr res -@ -2 9223372036854775807
1885 echo $?/$^ERRNAME $res
1886 echo ' #7'
1887 vput vexpr res - -9223372036854775808 +0
1888 echo $?/$^ERRNAME $res
1889 vput vexpr res - -9223372036854775808 +1
1890 echo $?/$^ERRNAME $res
1891 vput vexpr res -@ -9223372036854775808 +1
1892 echo $?/$^ERRNAME $res
1893 vput vexpr res - 0 -9223372036854775808
1894 echo $?/$^ERRNAME $res
1895 vput vexpr res - +1 -9223372036854775808
1896 echo $?/$^ERRNAME $res
1897 vput vexpr res -@ +1 -9223372036854775808
1898 echo $?/$^ERRNAME $res
1899 echo ' #8'
1900 vput vexpr res + -13 -2
1901 echo $?/$^ERRNAME $res
1902 vput vexpr res - 0 0
1903 echo $?/$^ERRNAME $res
1904 vput vexpr res - 0 1
1905 echo $?/$^ERRNAME $res
1906 vput vexpr res - 1 1
1907 echo $?/$^ERRNAME $res
1908 vput vexpr res - -13 -2
1909 echo $?/$^ERRNAME $res
1910 echo ' #9'
1911 vput vexpr res * 0 0
1912 echo $?/$^ERRNAME $res
1913 vput vexpr res * 0 1
1914 echo $?/$^ERRNAME $res
1915 vput vexpr res * 1 1
1916 echo $?/$^ERRNAME $res
1917 vput vexpr res * -13 -2
1918 echo $?/$^ERRNAME $res
1919 echo ' #10'
1920 vput vexpr res / 0 0
1921 echo $?/$^ERRNAME $res
1922 vput vexpr res / 0 1
1923 echo $?/$^ERRNAME $res
1924 vput vexpr res / 1 1
1925 echo $?/$^ERRNAME $res
1926 vput vexpr res / -13 -2
1927 echo $?/$^ERRNAME $res
1928 echo ' #11'
1929 vput vexpr res % 0 0
1930 echo $?/$^ERRNAME $res
1931 vput vexpr res % 0 1
1932 echo $?/$^ERRNAME $res
1933 vput vexpr res % 1 1
1934 echo $?/$^ERRNAME $res
1935 vput vexpr res % -13 -2
1936 echo $?/$^ERRNAME $res
1937 __EOT
1939 check behave:vexpr-numeric 0 "${MBOX}" '1723609217 1048'
1941 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1942 vput vexpr res find 'bananarama' 'nana'
1943 echo $?/$^ERRNAME :$res:
1944 vput vexpr res find 'bananarama' 'bana'
1945 echo $?/$^ERRNAME :$res:
1946 vput vexpr res find 'bananarama' 'Bana'
1947 echo $?/$^ERRNAME :$res:
1948 vput vexpr res find 'bananarama' 'rama'
1949 echo $?/$^ERRNAME :$res:
1950 echo ' #1'
1951 vput vexpr res ifind 'bananarama' 'nana'
1952 echo $?/$^ERRNAME :$res:
1953 vput vexpr res ifind 'bananarama' 'bana'
1954 echo $?/$^ERRNAME :$res:
1955 vput vexpr res ifind 'bananarama' 'Bana'
1956 echo $?/$^ERRNAME :$res:
1957 vput vexpr res ifind 'bananarama' 'rama'
1958 echo $?/$^ERRNAME :$res:
1959 echo ' #2'
1960 vput vexpr res substring 'bananarama' 1
1961 echo $?/$^ERRNAME :$res:
1962 vput vexpr res substring 'bananarama' 3
1963 echo $?/$^ERRNAME :$res:
1964 vput vexpr res substring 'bananarama' 5
1965 echo $?/$^ERRNAME :$res:
1966 vput vexpr res substring 'bananarama' 7
1967 echo $?/$^ERRNAME :$res:
1968 vput vexpr res substring 'bananarama' 9
1969 echo $?/$^ERRNAME :$res:
1970 vput vexpr res substring 'bananarama' 10
1971 echo $?/$^ERRNAME :$res:
1972 vput vexpr res substring 'bananarama' 1 3
1973 echo $?/$^ERRNAME :$res:
1974 vput vexpr res substring 'bananarama' 3 3
1975 echo $?/$^ERRNAME :$res:
1976 vput vexpr res substring 'bananarama' 5 3
1977 echo $?/$^ERRNAME :$res:
1978 vput vexpr res substring 'bananarama' 7 3
1979 echo $?/$^ERRNAME :$res:
1980 vput vexpr res substring 'bananarama' 9 3
1981 echo $?/$^ERRNAME :$res:
1982 vput vexpr res substring 'bananarama' 10 3
1983 echo $?/$^ERRNAME :$res:
1984 echo ' #3'
1985 vput vexpr res substring 'bananarama' -1
1986 echo $?/$^ERRNAME :$res:
1987 vput vexpr res substring 'bananarama' -3
1988 echo $?/$^ERRNAME :$res:
1989 vput vexpr res substring 'bananarama' -5
1990 echo $?/$^ERRNAME :$res:
1991 vput vexpr res substring 'bananarama' -7
1992 echo $?/$^ERRNAME :$res:
1993 vput vexpr res substring 'bananarama' -9
1994 echo $?/$^ERRNAME :$res:
1995 vput vexpr res substring 'bananarama' -10
1996 echo $?/$^ERRNAME :$res:
1997 vput vexpr res substring 'bananarama' 1 -3
1998 echo $?/$^ERRNAME :$res:
1999 vput vexpr res substring 'bananarama' 3 -3
2000 echo $?/$^ERRNAME :$res:
2001 vput vexpr res substring 'bananarama' 5 -3
2002 echo $?/$^ERRNAME :$res:
2003 vput vexpr res substring 'bananarama' 7 -3
2004 echo $?/$^ERRNAME :$res:
2005 vput vexpr res substring 'bananarama' 9 -3
2006 echo $?/$^ERRNAME :$res:
2007 vput vexpr res substring 'bananarama' 10 -3
2008 echo $?/$^ERRNAME :$res:
2009 echo ' #4'
2010 vput vexpr res trim 'Cocoon Cocoon'
2011 echo $?/$^ERRNAME :$res:
2012 vput vexpr res trim ' Cocoon Cocoon '
2013 echo $?/$^ERRNAME :$res:
2014 vput vexpr res trim-front 'Cocoon Cocoon'
2015 echo $?/$^ERRNAME :$res:
2016 vput vexpr res trim-front ' Cocoon Cocoon '
2017 echo $?/$^ERRNAME :$res:
2018 vput vexpr res trim-end 'Cocoon Cocoon'
2019 echo $?/$^ERRNAME :$res:
2020 vput vexpr res trim-end ' Cocoon Cocoon '
2021 echo $?/$^ERRNAME :$res:
2022 __EOT
2024 check behave:vexpr-string 0 "${MBOX}" '3182004322 601'
2026 if have_feat regex; then
2027 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2028 vput vexpr res regex 'bananarama' 'nana'
2029 echo $?/$^ERRNAME :$res:
2030 vput vexpr res regex 'bananarama' 'bana'
2031 echo $?/$^ERRNAME :$res:
2032 vput vexpr res regex 'bananarama' 'Bana'
2033 echo $?/$^ERRNAME :$res:
2034 vput vexpr res regex 'bananarama' 'rama'
2035 echo $?/$^ERRNAME :$res:
2036 echo ' #1'
2037 vput vexpr res iregex 'bananarama' 'nana'
2038 echo $?/$^ERRNAME :$res:
2039 vput vexpr res iregex 'bananarama' 'bana'
2040 echo $?/$^ERRNAME :$res:
2041 vput vexpr res iregex 'bananarama' 'Bana'
2042 echo $?/$^ERRNAME :$res:
2043 vput vexpr res iregex 'bananarama' 'rama'
2044 echo $?/$^ERRNAME :$res:
2045 echo ' #2'
2046 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2047 echo $?/$^ERRNAME :$res:
2048 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2049 echo $?/$^ERRNAME :$res:
2050 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
2051 echo $?/$^ERRNAME :$res:
2052 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
2053 echo $?/$^ERRNAME :$res:
2054 echo ' #3'
2055 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2056 echo $?/$^ERRNAME :$res:
2057 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2058 echo $?/$^ERRNAME :$res:
2059 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
2060 echo $?/$^ERRNAME :$res:
2061 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
2062 echo $?/$^ERRNAME :$res:
2063 echo ' #4'
2064 __EOT
2066 check behave:vexpr-regex 0 "${MBOX}" '3270360157 311'
2067 else
2068 printf 'behave:vexpr-regex: unsupported, skipped\n'
2071 t_epilog
2074 t_behave_call_ret() {
2075 t_prolog t_behave_call_ret
2077 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2078 define w1 {
2079 echon ">$1 "
2080 vput vexpr i + $1 1
2081 if [ $i -le 42 ]
2082 vput vexpr j '&' $i 7
2083 if [ $j -eq 7 ]
2084 echo .
2086 call w1 $i
2087 wysh set i=$? k=$!
2088 vput vexpr j '&' $i 7
2089 echon "<$1/$i/$k "
2090 if [ $j -eq 7 ]
2091 echo .
2093 else
2094 echo ! The end for $1
2096 return $1
2098 # Transport $?/$! up the call chain
2099 define w2 {
2100 echon ">$1 "
2101 vput vexpr i + $1 1
2102 if [ $1 -lt 42 ]
2103 call w2 $i
2104 wysh set i=$? j=$! k=$^ERRNAME
2105 echon "<$1/$i/$k "
2106 return $i $j
2107 else
2108 echo ! The end for $1
2109 return $i $^ERR-BUSY
2111 echoerr au
2113 # Up and down it goes
2114 define w3 {
2115 echon ">$1/$2 "
2116 vput vexpr i + $1 1
2117 if [ $1 -lt 42 ]
2118 call w3 $i $2
2119 wysh set i=$? j=$!
2120 vput vexpr k - $1 $2
2121 if [ $k -eq 21 ]
2122 vput vexpr i + $1 1
2123 vput vexpr j + $2 1
2124 echo "# <$i/$j> .. "
2125 call w3 $i $j
2126 wysh set i=$? j=$!
2128 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2129 return $i $j
2130 else
2131 echo ! The end for $1=$i/$2
2132 if [ "$2" != "" ]
2133 return $i $^ERR-DOM
2134 else
2135 return $i $^ERR-BUSY
2138 echoerr au
2141 call w1 0; echo ?=$? !=$!; echo -----;
2142 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2143 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2144 __EOT
2146 check behave:call_ret 0 "${MBOX}" '1572045517 5922'
2148 t_epilog
2151 t_behave_xcall() {
2152 t_prolog t_behave_xcall
2154 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2155 define work {
2156 echon "$1 "
2157 vput vexpr i + $1 1
2158 if [ $i -le 1111 ]
2159 vput vexpr j '&' $i 7
2160 if [ $j -eq 7 ]
2161 echo .
2163 \xcall work $i $2
2165 echo ! The end for $1/$2
2166 if [ "$2" != "" ]
2167 return $i $^ERR-BUSY
2170 define xwork {
2171 \xcall work 0 $2
2173 call work 0
2174 echo ?=$? !=$!
2175 call xwork
2176 echo ?=$? !=$!
2177 xcall xwork
2178 echo ?=$? !=$^ERRNAME
2180 call work 0 yes
2181 echo ?=$? !=$^ERRNAME
2182 call xwork 0 yes
2183 echo ?=$? !=$^ERRNAME
2184 __EOT
2186 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
2190 ${cat} <<- '__EOT' > "${BODY}"
2191 define __w {
2192 echon "$1 "
2193 vput vexpr i + $1 1
2194 if [ $i -le 111 ]
2195 vput vexpr j '&' $i 7
2196 if [ $j -eq 7 ]
2197 echo .
2199 \xcall __w $i $2
2201 echo ! The end for $1
2202 if [ $2 -eq 0 ]
2203 nonexistingcommand
2204 echo would be err with errexit
2205 return
2207 echo calling exit
2208 exit
2210 define work {
2211 echo eins
2212 call __w 0 0
2213 echo zwei, ?=$? !=$!
2214 localopts yes; set errexit
2215 ignerr call __w 0 0
2216 echo drei, ?=$? !=$^ERRNAME
2217 call __w 0 $1
2218 echo vier, ?=$? !=$^ERRNAME, this is an error
2220 ignerr call work 0
2221 echo outer 1, ?=$? !=$^ERRNAME
2222 xxxign call work 0
2223 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2224 call work 1
2225 echo outer 3, ?=$? !=$^ERRNAME
2226 echo this is definitely an error
2227 __EOT
2229 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
2230 > "${MBOX}" 2>&1
2231 check behave:xcall-2 0 "${MBOX}" '3900716531 4200'
2233 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
2234 > "${MBOX}" 2>&1
2235 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
2237 t_epilog
2240 t_behave_vpospar() {
2241 t_prolog t_behave_vpospar
2243 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2244 vpospar set hey, "'you ", world!
2245 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2246 vput vpospar x quote; echo x<$x>
2247 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2248 vput vpospar y quote;echo y<$y>
2249 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2250 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2251 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2253 define infun2 {
2254 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2255 vput vpospar z quote;echo infun2:z<$z>
2258 define infun {
2259 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2260 vput vpospar y quote;echo infun:y<$y>
2261 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2262 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2263 eval call infun2 $x
2264 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2265 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2268 call infun This "in a" fun
2269 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2270 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2271 __EOT
2272 check behave:vpospar-1 0 "${MBOX}" '155175639 866'
2275 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2276 set ifs=\'
2277 echo ifs<$ifs> ifs-ws<$ifs-ws>
2278 vpospar set hey, "'you ", world!
2279 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2280 vput vpospar x quote; echo x<$x>
2281 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2282 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2284 set ifs=,
2285 echo ifs<$ifs> ifs-ws<$ifs-ws>
2286 vpospar set hey, "'you ", world!
2287 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2288 set ifs=,
2289 vput vpospar x quote; echo x<$x>
2290 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2291 eval vpospar set ${x};\
2292 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2294 wysh set ifs=$',\t'
2295 echo ifs<$ifs> ifs-ws<$ifs-ws>
2296 vpospar set hey, "'you ", world!
2297 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2298 wysh set ifs=$',\t'
2299 vput vpospar x quote; echo x<$x>
2300 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2301 eval vpospar set ${x};\
2302 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2303 __EOT
2304 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
2306 t_epilog
2309 t_behave_atxplode() {
2310 t_prolog t_behave_atxplode
2311 TRAP_EXIT_ADDONS="./.t*"
2313 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2314 x() { echo $#; }
2315 xxx() {
2316 printf " (1/$#: <$1>)"
2317 shift
2318 if [ $# -gt 0 ]; then
2319 xxx "$@"
2320 else
2321 echo
2324 yyy() {
2325 eval "$@ ' ball"
2327 set --
2328 x "$@"
2329 x "$@"''
2330 x " $@"
2331 x "$@ "
2332 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2333 printf xxx;xxx arg ,b u.
2334 printf xxx;xxx arg , .
2335 printf xxx;xxx arg ,ball.
2337 define x {
2338 echo $#
2340 define xxx {
2341 echon " (1/$#: <$1>)"
2342 shift
2343 if [ $# -gt 0 ]
2344 \xcall xxx "$@"
2345 endif
2346 echo
2348 define yyy {
2349 eval "$@ ' ball"
2351 vpospar set
2352 call x "$@"
2353 call x "$@"''
2354 call x " $@"
2355 call x "$@ "
2356 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2357 echon xxx;call xxx arg ,b u.
2358 echon xxx;call xxx arg , .
2359 echon xxx;call xxx arg ,ball.
2362 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2363 check behave:atxplode-1 0 "${MBOX}" '41566293 164'
2365 #${SHELL} ./.t.sh > ./.tshout 2>&1
2366 #check behave:atxplode:disproof-1 0 ./.tshout '41566293 164'
2368 t_epilog
2371 t_behave_read() {
2372 t_prolog t_behave_read
2373 TRAP_EXIT_ADDONS="./.t*"
2375 ${cat} <<- '__EOT' > .tin
2376 hey1, "'you ", world!
2377 hey2, "'you ", bugs bunny!
2378 hey3, "'you ",
2379 hey4, "'you "
2380 __EOT
2382 ${cat} <<- '__EOT' |\
2383 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2384 read a b c
2385 echo $?/$^ERRNAME / <$a><$b><$c>
2386 read a b c
2387 echo $?/$^ERRNAME / <$a><$b><$c>
2388 read a b c
2389 echo $?/$^ERRNAME / <$a><$b><$c>
2390 read a b c
2391 echo $?/$^ERRNAME / <$a><$b><$c>
2392 unset a b c;read a b c
2393 echo $?/$^ERRNAME / <$a><$b><$c>
2394 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2395 __EOT
2396 check behave:read-1 0 "${MBOX}" '1527910147 173'
2398 ${cat} <<- '__EOT' > .tin2
2399 hey2.0,:"'you ",:world!:mars.:
2400 hey2.1,:"'you ",:world!
2401 hey2.2,:"'you ",:bugs bunny!
2402 hey2.3,:"'you ",:
2403 hey2.4,:"'you ":
2405 __EOT
2407 ${cat} <<- '__EOT' |\
2408 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2409 set ifs=:
2410 read a b c
2411 echo $?/$^ERRNAME / <$a><$b><$c>
2412 read a b c
2413 echo $?/$^ERRNAME / <$a><$b><$c>
2414 read a b c
2415 echo $?/$^ERRNAME / <$a><$b><$c>
2416 read a b c
2417 echo $?/$^ERRNAME / <$a><$b><$c>
2418 read a b c
2419 echo $?/$^ERRNAME / <$a><$b><$c>
2420 read a b c
2421 echo $?/$^ERRNAME / <$a><$b><$c>
2422 unset a b c;read a b c
2423 echo $?/$^ERRNAME / <$a><$b><$c>
2424 read a b c
2425 echo $?/$^ERRNAME / <$a><$b><$c>
2426 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2427 __EOT
2428 check behave:read-ifs 0 "${MBOX}" '890153490 298'
2430 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2431 readctl create .tin
2432 readall d; echo $?/$^ERRNAME / <$d>
2433 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2434 readctl create .tin2
2435 readall d; echo $?/$^ERRNAME / <$d>
2436 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2437 readctl remove .tin;echo $?/$^ERRNAME;\
2438 readctl remove .tin2;echo $?/$^ERRNAME
2439 __EOT
2440 check behave:readall 0 "${MBOX}" '860434889 333'
2442 t_epilog
2445 t_behave_mbox() {
2446 t_prolog t_behave_mbox
2447 TRAP_EXIT_ADDONS="./.t*"
2451 while [ ${i} -lt 112 ]; do
2452 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2453 "${MBOX}" "${i}" "${i}"
2454 i=`add ${i} 1`
2455 done
2456 ) | ${MAILX} ${ARGS}
2457 check behave:mbox-1 0 "${MBOX}" '1140119864 13780'
2459 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2460 ${MAILX} ${ARGS} > .tlst
2461 check behave:mbox-2 0 .tlst '2739893312 9103'
2463 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2464 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} > .tlst
2465 check behave:mbox-3 0 .tlst '1702194178 9110'
2467 # only the odd (even)
2469 printf 'File "file://%s"\ncopy ' .tmbox2
2471 while [ ${i} -lt 112 ]; do
2472 j=`modulo ${i} 2`
2473 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2474 i=`add ${i} 1`
2475 done
2476 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2477 ) | ${MAILX} ${ARGS} > .tlst
2478 check behave:mbox-4 0 .tmbox3 '631132924 6890'
2479 check behave:mbox-5 - .tlst '2960975049 4573'
2480 # ...
2482 printf 'file "file://%s"\nmove ' .tmbox2
2484 while [ ${i} -lt 112 ]; do
2485 j=`modulo ${i} 2`
2486 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2487 i=`add ${i} 1`
2488 done
2489 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2490 .tmbox3 .tmbox3 .tmbox2
2491 ) | ${MAILX} ${ARGS} > .tlst
2492 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2493 ${sed} 2d < .tlst > .tlstx
2494 check behave:mbox-7 - .tlstx '2729940494 13645'
2496 t_epilog
2499 t_behave_maildir() {
2500 t_prolog t_behave_maildir
2501 TRAP_EXIT_ADDONS="./.t*"
2505 while [ ${i} -lt 112 ]; do
2506 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2507 "${MBOX}" "${i}" "${i}"
2508 i=`add ${i} 1`
2509 done
2510 ) | ${MAILX} ${ARGS}
2511 check behave:maildir-1 0 "${MBOX}" '1140119864 13780'
2513 printf 'File "%s"
2514 copy * "%s"
2515 File "%s"
2516 from*
2517 ' "${MBOX}" .tmdir1 .tmdir1 |
2518 ${MAILX} ${ARGS} -Snewfolders=maildir > .tlst
2519 check behave:maildir-2 0 .tlst '1797938753 9103'
2521 printf 'File "%s"
2522 copy * "maildir://%s"
2523 File "maildir://%s"
2524 from*
2525 ' "${MBOX}" .tmdir2 .tmdir2 |
2526 ${MAILX} ${ARGS} > .tlst
2527 check behave:maildir-3 0 .tlst '1155631089 9113'
2529 printf 'File "maildir://%s"
2530 copy * "file://%s"
2531 File "file://%s"
2532 from*
2533 ' .tmdir2 .tmbox1 .tmbox1 |
2534 ${MAILX} ${ARGS} > .tlst
2535 check behave:maildir-4 0 .tmbox1 '2646131190 13220'
2536 check behave:maildir-5 - .tlst '3701297796 9110'
2538 # only the odd (even)
2540 printf 'File "maildir://%s"
2541 copy ' .tmdir2
2543 while [ ${i} -lt 112 ]; do
2544 j=`modulo ${i} 2`
2545 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2546 i=`add ${i} 1`
2547 done
2548 printf ' file://%s
2549 File "file://%s"
2550 from*
2551 ' .tmbox2 .tmbox2
2552 ) | ${MAILX} ${ARGS} > .tlst
2553 check behave:maildir-6 0 .tmbox2 '142890131 6610'
2554 check behave:maildir-7 - .tlst '960096773 4573'
2555 # ...
2557 printf 'file "maildir://%s"
2558 move ' .tmdir2
2560 while [ ${i} -lt 112 ]; do
2561 j=`modulo ${i} 2`
2562 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2563 i=`add ${i} 1`
2564 done
2565 printf ' file://%s
2566 File "file://%s"
2567 from*
2568 File "maildir://%s"
2569 from*
2570 ' .tmbox2 .tmbox2 .tmdir2
2571 ) | ${MAILX} ${ARGS} > .tlst
2572 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
2573 ${sed} 2d < .tlst > .tlstx
2574 check behave:maildir-9 - .tlstx '4216815295 13645'
2576 t_epilog
2579 t_behave_record_a_resend() {
2580 t_prolog t_behave_record_a_resend
2581 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
2583 printf '
2584 set record=%s
2585 m %s\n~s Subject 1.\nHello.\n~.
2586 set record-files add-file-recipients
2587 m %s\n~s Subject 2.\nHello.\n~.
2588 File %s
2589 resend 2 ./.t.resent
2590 Resend 1 ./.t.resent
2591 set record-resent
2592 resend 2 ./.t.resent
2593 Resend 1 ./.t.resent
2594 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2595 ${MAILX} ${ARGS}
2597 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2598 check behave:record_a_resend-2 - .t.record '391356429 460'
2599 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2601 t_epilog
2604 t_behave_e_H_L_opts() {
2605 t_prolog t_behave_e_H_L_opts
2606 TRAP_EXIT_ADDONS="./.tsendmail.sh ./.t.mbox"
2608 touch ./.t.mbox
2609 ${MAILX} ${ARGS} -ef ./.t.mbox
2610 echo ${?} > "${MBOX}"
2612 ${cat} <<-_EOT > ./.tsendmail.sh
2613 #!${SHELL} -
2614 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2615 ) >> "./.t.mbox"
2616 _EOT
2617 chmod 0755 ./.tsendmail.sh
2618 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2619 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2620 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2621 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2623 ${MAILX} ${ARGS} -ef ./.t.mbox
2624 echo ${?} >> "${MBOX}"
2625 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2626 echo ${?} >> "${MBOX}"
2627 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2628 echo ${?} >> "${MBOX}"
2629 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2630 echo ${?} >> "${MBOX}"
2631 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2632 echo ${?} >> "${MBOX}"
2633 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2634 echo ${?} >> "${MBOX}"
2635 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2636 echo ${?} >> "${MBOX}"
2638 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2639 echo ${?} >> "${MBOX}"
2640 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2641 echo ${?} >> "${MBOX}"
2642 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2643 echo ${?} >> "${MBOX}"
2644 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2645 echo ${?} >> "${MBOX}"
2646 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2647 echo ${?} >> "${MBOX}"
2648 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2649 echo ${?} >> "${MBOX}"
2650 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev/null
2651 echo ${?} >> "${MBOX}"
2653 check behave:e_H_L_opts - "${MBOX}" '1708955574 678'
2655 t_epilog
2658 t_behave_alternates() {
2659 t_prolog t_behave_alternates
2660 TRAP_EXIT_ADDONS="./.t*"
2662 ${cat} <<-_EOT > ./.tsendmail.sh
2663 #!${SHELL} -
2664 (echo 'From Valeriana Sat Jul 08 15:54:03 2017' && ${cat} && echo
2665 ) >> "${MBOX}"
2666 _EOT
2667 chmod 0755 ./.tsendmail.sh
2669 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2670 echo --0
2671 alternates
2672 echo $?/$^ERRNAME
2673 alternates a1@b1 a2@b2 a3@b3
2674 echo $?/$^ERRNAME
2675 alternates
2676 echo $?/$^ERRNAME
2677 vput alternates rv
2678 echo $?/$^ERRNAME <$rv>
2680 echo --1
2681 unalternates a2@b2
2682 vput alternates rv
2683 echo $?/$^ERRNAME <$rv>
2684 unalternates a3@b3
2685 vput alternates rv
2686 echo $?/$^ERRNAME <$rv>
2687 unalternates a1@b1
2688 vput alternates rv
2689 echo $?/$^ERRNAME <$rv>
2691 echo --2
2692 unalternates *
2693 alternates a1@b1 a2@b2 a3@b3
2694 unalternates a3@b3
2695 vput alternates rv
2696 echo $?/$^ERRNAME <$rv>
2697 unalternates a2@b2
2698 vput alternates rv
2699 echo $?/$^ERRNAME <$rv>
2700 unalternates a1@b1
2701 vput alternates rv
2702 echo $?/$^ERRNAME <$rv>
2704 echo --3
2705 alternates a1@b1 a2@b2 a3@b3
2706 unalternates a1@b1
2707 vput alternates rv
2708 echo $?/$^ERRNAME <$rv>
2709 unalternates a2@b2
2710 vput alternates rv
2711 echo $?/$^ERRNAME <$rv>
2712 unalternates a3@b3
2713 vput alternates rv
2714 echo $?/$^ERRNAME <$rv>
2716 echo --4
2717 unalternates *
2718 alternates a1@b1 a2@b2 a3@b3
2719 unalternates *
2720 vput alternates rv
2721 echo $?/$^ERRNAME <$rv>
2723 echo --5
2724 unalternates *
2725 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2726 m a1@b1 a1@c1 a1@d1
2727 ~s all alternates, only a1@b1 remains
2728 ~c a2@b2
2729 ~b a3@b3 a3@c3 a3@d3
2730 ~r - '_EOT'
2731 This body is!
2732 This also body is!!
2733 _EOT
2736 echo --6
2737 unalternates *
2738 alternates a1@b1 a1@c1 a2@b2 a3@b3
2739 m a1@b1 a1@c1 a1@d1
2740 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2741 ~c a2@b2
2742 ~b a3@b3 a3@c3 a3@d3
2743 ~r - '_EOT'
2744 This body2 is!
2745 _EOT
2748 echo --7
2749 alternates a1@b1 a2@b2 a3; set allnet
2750 m a1@b1 a1@c1 a1@d1
2751 ~s all alternates via allnet, only a1@b1 remains
2752 ~c a2@b2
2753 ~b a3@b3 a3@c3 a3@d3
2754 ~r - '_EOT'
2755 This body3 is!
2756 _EOT
2759 echo --10
2760 unalternates *
2761 alternates a1@b1
2762 echo $?/$^ERRNAME
2763 vput alternates rv
2764 echo $?/$^ERRNAME <$rv>
2765 alternates a2@b2
2766 echo $?/$^ERRNAME
2767 vput alternates rv
2768 echo $?/$^ERRNAME <$rv>
2769 alternates a3@b3
2770 echo $?/$^ERRNAME
2771 vput alternates rv
2772 echo $?/$^ERRNAME <$rv>
2773 alternates a4@b4
2774 echo $?/$^ERRNAME
2775 vput alternates rv
2776 echo $?/$^ERRNAME <$rv>
2778 unalternates *
2779 vput alternates rv
2780 echo $?/$^ERRNAME <$rv>
2782 echo --11
2783 set posix
2784 alternates a1@b1 a2@b2
2785 echo $?/$^ERRNAME
2786 vput alternates rv
2787 echo $?/$^ERRNAME <$rv>
2788 alternates a3@b3 a4@b4
2789 echo $?/$^ERRNAME
2790 vput alternates rv
2791 echo $?/$^ERRNAME <$rv>
2792 __EOT
2793 check behave:alternates-1 0 "${MBOX}" '142184864 515'
2794 check behave:alternates-2 - .tall '1878598364 505'
2796 t_epilog
2799 t_behave_alias() {
2800 t_prolog t_behave_alias
2801 TRAP_EXIT_ADDONS="./.t*"
2803 ${cat} <<-_EOT > ./.tsendmail.sh
2804 #!${SHELL} -
2805 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2806 ) >> "${MBOX}"
2807 _EOT
2808 chmod 0755 ./.tsendmail.sh
2810 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2811 alias a1 ex1@a1.ple
2812 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
2813 alias a1 ex4@a1.ple
2814 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2815 alias a3 a4
2816 alias a4 a5 ex1@a4.ple
2817 alias a5 a6
2818 alias a6 a7 ex1@a6.ple
2819 alias a7 a8
2820 alias a8 ex1@a8.ple
2821 alias a1
2822 alias a2
2823 alias a3
2824 m a1
2825 ~c a2
2826 ~b a3
2827 ~r - '_EOT'
2828 This body is!
2829 This also body is!!
2830 _EOT
2831 __EOT
2832 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2833 check behave:alias-2 - .tall '3548953204 152'
2835 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2836 # TODO need to somehow provide its contents to the test, then test
2838 t_epilog
2841 t_behave_filetype() {
2842 t_prolog t_behave_filetype
2843 TRAP_EXIT_ADDONS="./.t*"
2845 ${cat} <<-_EOT > ./.tsendmail.sh
2846 #!${SHELL} -
2847 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2848 ) >> "${MBOX}"
2849 _EOT
2850 chmod 0755 ./.tsendmail.sh
2852 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
2853 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2854 check behave:filetype-1 0 "${MBOX}" '1594682963 13520'
2856 if (echo | gzip -c) >/dev/null 2>&1; then
2857 ${rm} -f ./.t.mbox*
2859 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
2860 "${MBOX}" | ${MAILX} ${ARGS} \
2861 -X'filetype gz gzip\ -dc gzip\ -c'
2862 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2863 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
2864 } > ./.t.out 2>&1
2865 check behave:filetype-2 - "./.t.mbox" '1594682963 13520'
2866 check behave:filetype-3 - "./.t.out" '2392348396 102'
2867 else
2868 echo 'behave:filetype-2: unsupported, skipped'
2869 echo 'behave:filetype-3: unsupported, skipped'
2873 ${rm} -f ./.t.mbox*
2874 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
2875 copy 2 ./.t.mbox.gz
2876 copy 1 ./.t.mbox.gz
2877 copy 2 ./.t.mbox.gz
2878 ' "${MBOX}" |
2879 ${MAILX} ${ARGS} \
2880 -X'filetype gz gzip\ -dc gzip\ -c' \
2881 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
2882 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
2883 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2884 ${MAILX} ${ARGS} \
2885 -X'filetype gz gzip\ -dc gzip\ -c' \
2886 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
2887 } > ./.t.out 2>&1
2888 check behave:filetype-4 - "./.t.mbox" '2886541147 27060'
2889 check behave:filetype-5 - "./.t.out" '852335377 172'
2891 t_epilog
2894 t_behave_message_injections() {
2895 t_prolog t_behave_message_injections
2896 TRAP_EXIT_ADDONS="./.t*"
2898 ${cat} <<-_EOT > ./.tsendmail.sh
2899 #!${SHELL} -
2900 (echo 'From Echinacea Tue Jun 20 15:54:02 2017' && ${cat} && echo
2901 ) > "${MBOX}"
2902 _EOT
2903 chmod 0755 ./.tsendmail.sh
2905 echo mysig > ./.tmysig
2907 echo some-body | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh \
2908 -Smessage-inject-head=head-inject \
2909 -Smessage-inject-tail=tail-inject \
2910 -Ssignature=./.tmysig \
2911 ex@am.ple > ./.tall 2>&1
2912 check behave:message_injections-1 0 "${MBOX}" '2434746382 134'
2913 check behave:message_injections-2 - .tall '4294967295 0' # empty file
2915 ${cat} <<-_EOT > ./.template
2916 From: me
2917 To: ex1@am.ple
2918 Cc: ex2@am.ple
2919 Subject: This subject is
2921 Body, body, body me.
2922 _EOT
2923 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tsendmail.sh \
2924 -Smessage-inject-head=head-inject \
2925 -Smessage-inject-tail=tail-inject \
2926 -Ssignature=./.tmysig \
2927 > ./.tall 2>&1
2928 check behave:message_injections-3 0 "${MBOX}" '3114203412 198'
2929 check behave:message_injections-4 - .tall '4294967295 0' # empty file
2931 t_epilog
2934 t_behave_compose_hooks() { # TODO monster
2935 t_prolog t_behave_compose_hooks
2936 TRAP_EXIT_ADDONS="./.t*"
2938 (echo line one&&echo line two&&echo line three) > ./.treadctl
2939 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
2941 ${cat} <<-_EOT > ./.tsendmail.sh
2942 #!${SHELL} -
2943 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat} && echo
2944 ) >> "${MBOX}"
2945 _EOT
2946 chmod 0755 ./.tsendmail.sh
2948 ${cat} <<'__EOT__' > ./.trc
2949 define bail {
2950 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
2952 define xerr {
2953 vput vexpr es substr "$1" 0 1
2954 if [ "$es" != 2 ]
2955 xcall bail "$2"
2958 define read_mline_res {
2959 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2960 echo $len/$es/$^ERRNAME: $hl
2961 if [ $es -ne $^ERR-NONE ]
2962 xcall bail read_mline_res
2963 elif [ $len -ne 0 ]
2964 \xcall read_mline_res
2967 define ins_addr {
2968 wysh set xh=$1
2969 echo "~^header list"; read hl; echo $hl;\
2970 call xerr "$hl" "in_addr ($xh) 0-1"
2972 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2973 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
2974 echo "~^header insert $xh <${xh}2@exam.ple>";\
2975 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
2976 echo "~^header insert $xh ${xh}3@exam.ple";\
2977 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
2978 echo "~^header list $xh"; read hl; echo $hl;\
2979 call xerr "$hl" "ins_addr $xh 1-4"
2980 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
2981 call read_mline_res
2983 if [ "$t_remove" == "" ]
2984 return
2987 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
2988 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
2989 if [ $es != 501 ]
2990 xcall bail "ins_addr $xh 2-2"
2992 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
2993 if [ $es != 501 ]
2994 xcall bail "ins_addr $xh 2-3"
2996 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
2997 if [ $es != 501 ]
2998 xcall bail "ins_addr $xh 2-4"
3002 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3003 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
3004 echo "~^header insert $xh <${xh}2@exam.ple>";\
3005 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
3006 echo "~^header insert $xh ${xh}3@exam.ple";\
3007 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
3008 echo "~^header list $xh"; read hl; echo $hl;\
3009 call xerr "$hl" "ins_addr $xh 3-4"
3010 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
3011 call read_mline_res
3013 echo "~^header remove-at $xh 1"; read es;\
3014 call xerr $es "ins_addr $xh 3-6"
3015 echo "~^header remove-at $xh 1"; read es;\
3016 call xerr $es "ins_addr $xh 3-7"
3017 echo "~^header remove-at $xh 1"; read es;\
3018 call xerr $es "ins_addr $xh 3-8"
3019 echo "~^header remove-at $xh 1"; read es;\
3020 vput vexpr es substr $es 0 3
3021 if [ $es != 501 ]
3022 xcall bail "ins_addr $xh 3-9"
3024 echo "~^header remove-at $xh T"; read es;\
3025 vput vexpr es substr $es 0 3
3026 if [ $es != 505 ]
3027 xcall bail "ins_addr $xh 3-10"
3029 echo "~^header list $xh"; read es;\
3030 vput vexpr es substr $es 0 3
3031 if [ $es != 501 ]
3032 xcall bail "ins_addr $xh 3-11"
3034 echo "~^header show $xh"; read es;\
3035 vput vexpr es substr $es 0 3
3036 if [ $es != 501 ]
3037 xcall bail "ins_addr $xh 3-12"
3041 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3042 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
3043 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
3044 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
3045 echo "~^header insert $xh ${xh}3@exam.ple";\
3046 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
3047 echo "~^header list $xh"; read hl; echo $hl;\
3048 call xerr "$hl" "header list $xh 3-4"
3049 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
3050 call read_mline_res
3052 echo "~^header remove-at $xh 3"; read es;\
3053 call xerr $es "ins_addr $xh 4-6"
3054 echo "~^header remove-at $xh 2"; read es;\
3055 call xerr $es "ins_addr $xh 4-7"
3056 echo "~^header remove-at $xh 1"; read es;\
3057 call xerr $es "ins_addr $xh 4-8"
3058 echo "~^header remove-at $xh 1"; read es;\
3059 vput vexpr es substr $es 0 3
3060 if [ $es != 501 ]
3061 xcall bail "ins_addr $xh 4-9"
3063 echo "~^header remove-at $xh T"; read es;\
3064 vput vexpr es substr $es 0 3
3065 if [ $es != 505 ]
3066 xcall bail "ins_addr $xh 4-10"
3068 echo "~^header list $xh"; read es;\
3069 vput vexpr es substr $es 0 3
3070 if [ $es != 501 ]
3071 xcall bail "ins_addr $xh 4-11"
3073 echo "~^header show $xh"; read es;\
3074 vput vexpr es substr $es 0 3
3075 if [ $es != 501 ]
3076 xcall bail "ins_addr $xh 4-12"
3079 define ins_ref {
3080 wysh set xh=$1 mult=$2
3081 echo "~^header list"; read hl; echo $hl;\
3082 call xerr "$hl" "ins_ref ($xh) 0-1"
3084 echo "~^header insert $xh <$xh@exam.ple>";\
3085 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
3086 if [ $mult -ne 0 ]
3087 echo "~^header insert $xh <${xh}2@exam.ple>";\
3088 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
3089 echo "~^header insert $xh ${xh}3@exam.ple";\
3090 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
3091 else
3092 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
3093 vput vexpr es substr $es 0 3
3094 if [ $es != 506 ]
3095 xcall bail "ins_ref $xh 1-4"
3099 echo "~^header list $xh"; read hl; echo $hl;\
3100 call xerr "$hl" "ins_ref $xh 1-5"
3101 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
3102 call read_mline_res
3104 if [ "$t_remove" == "" ]
3105 return
3108 echo "~^header remove $xh"; read es;\
3109 call xerr $es "ins_ref $xh 2-1"
3110 echo "~^header remove $xh"; read es;\
3111 vput vexpr es substr $es 0 3
3112 if [ $es != 501 ]
3113 xcall bail "ins_ref $xh 2-2"
3115 echo "~^header list $xh"; read es;\
3116 vput vexpr es substr $es 0 3
3117 if [ $es != 501 ]
3118 xcall bail "$es ins_ref $xh 2-3"
3120 echo "~^header show $xh"; read es;\
3121 vput vexpr es substr $es 0 3
3122 if [ $es != 501 ]
3123 xcall bail "ins_ref $xh 2-4"
3127 echo "~^header insert $xh <$xh@exam.ple>";\
3128 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
3129 if [ $mult -ne 0 ]
3130 echo "~^header insert $xh <${xh}2@exam.ple>";\
3131 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
3132 echo "~^header insert $xh ${xh}3@exam.ple";\
3133 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
3135 echo "~^header list $xh";\
3136 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
3137 echo "~^header show $xh";\
3138 read es; call xerr $es "ins_ref $xh 3-5"
3139 call read_mline_res
3141 echo "~^header remove-at $xh 1"; read es;\
3142 call xerr $es "ins_ref $xh 3-6"
3143 if [ $mult -ne 0 ] && [ $xh != subject ]
3144 echo "~^header remove-at $xh 1"; read es;\
3145 call xerr $es "ins_ref $xh 3-7"
3146 echo "~^header remove-at $xh 1"; read es;\
3147 call xerr $es "ins_ref $xh 3-8"
3149 echo "~^header remove-at $xh 1"; read es;\
3150 vput vexpr es substr $es 0 3
3151 if [ $es != 501 ]
3152 xcall bail "ins_ref $xh 3-9"
3154 echo "~^header remove-at $xh T"; read es;\
3155 vput vexpr es substr $es 0 3
3156 if [ $es != 505 ]
3157 xcall bail "ins_ref $xh 3-10"
3159 echo "~^header show $xh"; read es;\
3160 vput vexpr es substr $es 0 3
3161 if [ $es != 501 ]
3162 xcall bail "ins_ref $xh 3-11"
3166 echo "~^header insert $xh <$xh@exam.ple> ";\
3167 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
3168 if [ $mult -ne 0 ]
3169 echo "~^header insert $xh <${xh}2@exam.ple> ";\
3170 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
3171 echo "~^header insert $xh ${xh}3@exam.ple";\
3172 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
3174 echo "~^header list $xh"; read hl; echo $hl;\
3175 call xerr "$hl" "ins_ref $xh 4-4"
3176 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
3177 call read_mline_res
3179 if [ $mult -ne 0 ] && [ $xh != subject ]
3180 echo "~^header remove-at $xh 3"; read es;\
3181 call xerr $es "ins_ref $xh 4-6"
3182 echo "~^header remove-at $xh 2"; read es;\
3183 call xerr $es "ins_ref $xh 4-7"
3185 echo "~^header remove-at $xh 1"; read es;\
3186 call xerr $es "ins_ref $xh 4-8"
3187 echo "~^header remove-at $xh 1"; read es;\
3188 vput vexpr es substr $es 0 3
3189 if [ $es != 501 ]
3190 xcall bail "ins_ref $xh 4-9"
3192 echo "~^header remove-at $xh T"; read es;\
3193 vput vexpr es substr $es 0 3
3194 if [ $es != 505 ]
3195 xcall bail "ins_ref $xh 4-10"
3197 echo "~^header show $xh"; read es;\
3198 vput vexpr es substr $es 0 3
3199 if [ $es != 501 ]
3200 xcall bail "ins_ref $xh 4-11"
3203 define t_header {
3204 echo t_header ENTER
3205 # In collect.c order
3206 call ins_addr from
3207 call ins_ref sender 0 # Not a "ref", but works
3208 call ins_addr To
3209 call ins_addr cC
3210 call ins_addr bCc
3211 call ins_addr reply-To
3212 call ins_addr mail-Followup-to
3213 call ins_ref messAge-id 0
3214 call ins_ref rEfErEncEs 1
3215 call ins_ref in-Reply-to 1
3216 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
3217 call ins_addr freeForm1
3218 call ins_addr freeform2
3220 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
3221 call read_mline_res
3222 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
3223 call read_mline_res
3225 echo t_header LEAVE
3227 define t_attach {
3228 echo t_attach ENTER
3230 echo "~^attachment";\
3231 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3232 if [ "$es" != 501 ]
3233 xcall bail "attach 0-1"
3236 echo "~^attach attribute ./.treadctl";\
3237 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3238 if [ "$es" != 501 ]
3239 xcall bail "attach 0-2"
3241 echo "~^attachment attribute-at 1";\
3242 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3243 if [ "$es" != 501 ]
3244 xcall bail "attach 0-3"
3247 echo "~^attachment insert ./.treadctl=ascii";\
3248 read hl; echo $hl; call xerr "$hl" "attach 1-1"
3249 echo "~^attachment list";\
3250 read es; echo $es;call xerr "$es" "attach 1-2"
3251 call read_mline_res
3252 echo "~^attachment attribute ./.treadctl";\
3253 read es; echo $es;call xerr "$es" "attach 1-3"
3254 call read_mline_res
3255 echo "~^attachment attribute .treadctl";\
3256 read es; echo $es;call xerr "$es" "attach 1-4"
3257 call read_mline_res
3258 echo "~^attachment attribute-at 1";\
3259 read es; echo $es;call xerr "$es" "attach 1-5"
3260 call read_mline_res
3262 echo "~^attachment attribute-set ./.treadctl filename rctl";\
3263 read es; echo $es;call xerr "$es" "attach 1-6"
3264 echo "~^attachment attribute-set .treadctl content-description Au";\
3265 read es; echo $es;call xerr "$es" "attach 1-7"
3266 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
3267 read es; echo $es;call xerr "$es" "attach 1-8"
3269 echo "~^attachment attribute ./.treadctl";\
3270 read es; echo $es;call xerr "$es" "attach 1-9"
3271 call read_mline_res
3272 echo "~^attachment attribute .treadctl";\
3273 read es; echo $es;call xerr "$es" "attach 1-10"
3274 call read_mline_res
3275 echo "~^attachment attribute rctl";\
3276 read es; echo $es;call xerr "$es" "attach 1-11"
3277 call read_mline_res
3278 echo "~^attachment attribute-at 1";\
3279 read es; echo $es;call xerr "$es" "attach 1-12"
3280 call read_mline_res
3283 echo "~^attachment insert ./.tattach=latin1";\
3284 read hl; echo $hl; call xerr "$hl" "attach 2-1"
3285 echo "~^attachment list";\
3286 read es; echo $es;call xerr "$es" "attach 2-2"
3287 call read_mline_res
3288 echo "~^attachment attribute ./.tattach";\
3289 read es; echo $es;call xerr "$es" "attach 2-3"
3290 call read_mline_res
3291 echo "~^attachment attribute .tattach";\
3292 read es; echo $es;call xerr "$es" "attach 2-4"
3293 call read_mline_res
3294 echo "~^attachment attribute-at 2";\
3295 read es; echo $es;call xerr "$es" "attach 2-5"
3296 call read_mline_res
3298 echo "~^attachment attribute-set ./.tattach filename tat";\
3299 read es; echo $es;call xerr "$es" "attach 2-6"
3300 echo \
3301 "~^attachment attribute-set .tattach content-description Au2";\
3302 read es; echo $es;call xerr "$es" "attach 2-7"
3303 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
3304 read es; echo $es;call xerr "$es" "attach 2-8"
3305 echo \
3306 "~^attachment attribute-set-at 2 content-type application/x-sh";\
3307 read es; echo $es;call xerr "$es" "attach 2-9"
3309 echo "~^attachment attribute ./.tattach";\
3310 read es; echo $es;call xerr "$es" "attach 2-10"
3311 call read_mline_res
3312 echo "~^attachment attribute .tattach";\
3313 read es; echo $es;call xerr "$es" "attach 2-11"
3314 call read_mline_res
3315 echo "~^attachment attribute tat";\
3316 read es; echo $es;call xerr "$es" "attach 2-12"
3317 call read_mline_res
3318 echo "~^attachment attribute-at 2";\
3319 read es; echo $es;call xerr "$es" "attach 2-13"
3320 call read_mline_res
3323 if [ "$t_remove" == "" ]
3324 return
3327 echo "~^attachment remove ./.treadctl"; read es;\
3328 call xerr $es "attach 3-1"
3329 echo "~^attachment remove ./.tattach"; read es;\
3330 call xerr $es "attach 3-2"
3331 echo "~^ attachment remove ./.treadctl"; read es;\
3332 vput vexpr es substr $es 0 3
3333 if [ $es != 501 ]
3334 xcall bail "attach 3-3"
3336 echo "~^ attachment remove ./.tattach"; read es;\
3337 vput vexpr es substr $es 0 3
3338 if [ $es != 501 ]
3339 xcall bail "attach 3-4"
3341 echo "~^attachment list"; read es;\
3342 vput vexpr es substr $es 0 3
3343 if [ $es != 501 ]
3344 xcall bail "attach 3-5"
3348 echo "~^attachment insert ./.tattach=latin1";\
3349 read hl; echo $hl; call xerr "$hl" "attach 4-1"
3350 echo "~^attachment insert ./.tattach=latin1";\
3351 read hl; echo $hl; call xerr "$hl" "attach 4-2"
3352 echo "~^attachment list";\
3353 read es; echo $es;call xerr "$es" "attach 4-3"
3354 call read_mline_res
3355 echo "~^ attachment remove .tattach"; read es;\
3356 vput vexpr es substr $es 0 3
3357 if [ $es != 506 ]
3358 xcall bail "attach 4-4 $es"
3360 echo "~^attachment remove-at T"; read es;\
3361 vput vexpr es substr $es 0 3
3362 if [ $es != 505 ]
3363 xcall bail "attach 4-5"
3365 echo "~^attachment remove ./.tattach"; read es;\
3366 call xerr $es "attach 4-6"
3367 echo "~^attachment remove ./.tattach"; read es;\
3368 call xerr $es "attach 4-7"
3369 echo "~^ attachment remove ./.tattach"; read es;\
3370 vput vexpr es substr $es 0 3
3371 if [ $es != 501 ]
3372 xcall bail "attach 4-8 $es"
3374 echo "~^attachment list"; read es;\
3375 vput vexpr es substr $es 0 3
3376 if [ $es != 501 ]
3377 xcall bail "attach 4-9"
3381 echo "~^attachment insert ./.tattach=latin1";\
3382 read hl; echo $hl; call xerr "$hl" "attach 5-1"
3383 echo "~^attachment insert ./.tattach=latin1";\
3384 read hl; echo $hl; call xerr "$hl" "attach 5-2"
3385 echo "~^attachment insert ./.tattach=latin1";\
3386 read hl; echo $hl; call xerr "$hl" "attach 5-3"
3387 echo "~^attachment list";\
3388 read es; echo $es;call xerr "$es" "attach 5-4"
3389 call read_mline_res
3391 echo "~^attachment remove-at 3"; read es;\
3392 call xerr $es "attach 5-5"
3393 echo "~^attachment remove-at 3"; read es;\
3394 vput vexpr es substr $es 0 3
3395 if [ $es != 501 ]
3396 xcall bail "attach 5-6"
3398 echo "~^attachment remove-at 2"; read es;\
3399 call xerr $es "attach 5-7"
3400 echo "~^attachment remove-at 2"; read es;\
3401 vput vexpr es substr $es 0 3
3402 if [ $es != 501 ]
3403 xcall bail "attach 5-8"
3405 echo "~^attachment remove-at 1"; read es;\
3406 call xerr $es "attach 5-9"
3407 echo "~^attachment remove-at 1"; read es;\
3408 vput vexpr es substr $es 0 3
3409 if [ $es != 501 ]
3410 xcall bail "attach 5-10"
3413 echo "~^attachment list"; read es;\
3414 vput vexpr es substr $es 0 3
3415 if [ $es != 501 ]
3416 xcall bail "attach 5-11"
3420 echo "~^attachment insert ./.tattach=latin1";\
3421 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3422 echo "~^attachment insert ./.tattach=latin1";\
3423 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3424 echo "~^attachment insert ./.tattach=latin1";\
3425 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3426 echo "~^attachment list";\
3427 read es; echo $es;call xerr "$es" "attach 6-4"
3428 call read_mline_res
3430 echo "~^attachment remove-at 1"; read es;\
3431 call xerr $es "attach 6-5"
3432 echo "~^attachment remove-at 1"; read es;\
3433 call xerr $es "attach 6-6"
3434 echo "~^attachment remove-at 1"; read es;\
3435 call xerr $es "attach 6-7"
3436 echo "~^attachment remove-at 1"; read es;\
3437 vput vexpr es substr $es 0 3
3438 if [ $es != 501 ]
3439 xcall bail "attach 6-8"
3442 echo "~^attachment list"; read es;\
3443 vput vexpr es substr $es 0 3
3444 if [ $es != 501 ]
3445 xcall bail "attach 6-9"
3448 echo t_attach LEAVE
3450 define t_ocs {
3451 read ver
3452 echo t_ocs
3453 call t_header
3454 call t_attach
3456 define t_oce {
3457 echo on-compose-enter, mailx-command<$mailx-command>
3458 alternates alter1@exam.ple alter2@exam.ple
3459 alternates
3460 set autocc='alter1@exam.ple alter2@exam.ple'
3461 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3462 echo mailx-subject<$mailx-subject>
3463 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3464 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3465 mailx-raw-bcc<$mailx-raw-bcc>
3466 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3467 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3469 define t_ocl {
3470 echo on-compose-leave, mailx-command<$mailx-command>
3471 vput alternates al
3472 eval alternates $al alter3@exam.ple alter4@exam.ple
3473 alternates
3474 set autobcc='alter3@exam.ple alter4@exam.ple'
3475 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3476 echo mailx-subject<$mailx-subject>
3477 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3478 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3479 mailx-raw-bcc<$mailx-raw-bcc>
3480 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3481 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3483 define t_occ {
3484 echo on-compose-cleanup, mailx-command<$mailx-command>
3485 unalternates *
3486 alternates
3487 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3488 echo mailx-subject<$mailx-subject>
3489 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3490 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3491 mailx-raw-bcc<$mailx-raw-bcc>
3492 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3493 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3495 wysh set on-compose-splice=t_ocs \
3496 on-compose-enter=t_oce on-compose-leave=t_ocl \
3497 on-compose-cleanup=t_occ
3498 __EOT__
3500 ${rm} -f "${MBOX}"
3501 printf 'm this-goes@nowhere\nbody\n!.\n' |
3502 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3503 -X'source ./.trc' -Smta=./.tsendmail.sh \
3504 >./.tall 2>&1
3505 ${cat} ./.tall >> "${MBOX}"
3506 check behave:compose_hooks-1 0 "${MBOX}" '522535560 10101'
3508 ${rm} -f "${MBOX}"
3509 printf 'm this-goes@nowhere\nbody\n!.\n' |
3510 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3511 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh \
3512 >./.tall 2>&1
3513 ${cat} ./.tall >> "${MBOX}"
3514 check behave:compose_hooks-2 0 "${MBOX}" '3654000499 12535'
3518 # Some state machine stress, shell compose hook, localopts for hook, etc.
3519 # readctl in child. ~r as HERE document
3520 ${rm} -f "${MBOX}"
3521 printf 'm ex@am.ple\nbody\n!.
3522 echon ${mailx-command}${mailx-subject}
3523 echon ${mailx-from}${mailx-sender}
3524 echon ${mailx-to}${mailx-cc}${mailx-bcc}
3525 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
3526 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
3527 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
3528 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3529 -Smta=./.tsendmail.sh \
3531 define bail {
3532 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3534 define xerr {
3535 vput vexpr es substr "$1" 0 1
3536 if [ "$es" != 2 ]
3537 xcall bail "$2"
3540 define read_mline_res {
3541 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3542 echo $len/$es/$^ERRNAME: $hl
3543 if [ $es -ne $^ERR-NONE ]
3544 xcall bail read_mline_res
3545 elif [ $len -ne 0 ]
3546 \xcall read_mline_res
3549 define _work {
3550 vput vexpr i + 1 "$2"
3551 if [ $i -lt 111 ]
3552 vput vexpr j % $i 10
3553 if [ $j -ne 0 ]
3554 set j=xcall
3555 else
3556 echon "$i.. "
3557 set j=call
3559 eval \\$j _work $1 $i
3560 return $?
3562 vput vexpr i + $i "$1"
3563 return $i
3565 define _read {
3566 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
3567 echo read:$es/$en: $line
3568 if [ "${es}" -ne -1 ]
3569 xcall _read
3571 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3573 define t_ocs {
3574 read ver
3575 echo t_ocs
3576 echo "~^header list"; read hl; echo $hl;\
3577 vput vexpr es substr "$hl" 0 1
3578 if [ "$es" != 2 ]
3579 xcall bail "header list"
3580 endif
3582 call _work 1; echo $?
3583 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3584 read es; echo $es; vput vexpr es substr "$es" 0 1
3585 if [ "$es" != 2 ]
3586 xcall bail "be diet"
3587 endif
3588 echo "~^header insert cc <splice2@exam.ple>";\
3589 read es; echo $es; vput vexpr es substr "$es" 0 1
3590 if [ "$es" != 2 ]
3591 xcall bail "be diet2"
3592 endif
3594 call _work 2; echo $?
3595 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3596 read es; echo $es;vput vexpr es substr "$es" 0 1
3597 if [ "$es" != 2 ]
3598 xcall bail "be juicy"
3599 endif
3600 echo "~^header insert bcc juice2@exam.ple";\
3601 read es; echo $es;vput vexpr es substr "$es" 0 1
3602 if [ "$es" != 2 ]
3603 xcall bail "be juicy2"
3604 endif
3605 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3606 read es; echo $es;vput vexpr es substr "$es" 0 1
3607 if [ "$es" != 2 ]
3608 xcall bail "be juicy3"
3609 endif
3610 echo "~^header insert bcc juice4@exam.ple";\
3611 read es; echo $es;vput vexpr es substr "$es" 0 1
3612 if [ "$es" != 2 ]
3613 xcall bail "be juicy4"
3614 endif
3616 echo "~^header remove-at bcc 3";\
3617 read es; echo $es;vput vexpr es substr "$es" 0 1
3618 if [ "$es" != 2 ]
3619 xcall bail "remove juicy5"
3620 endif
3621 echo "~^header remove-at bcc 2";\
3622 read es; echo $es;vput vexpr es substr "$es" 0 1
3623 if [ "$es" != 2 ]
3624 xcall bail "remove juicy6"
3625 endif
3626 echo "~^header remove-at bcc 3";\
3627 read es; echo $es;vput vexpr es substr "$es" 0 3
3628 if [ "$es" != 501 ]
3629 xcall bail "failed to remove-at"
3630 endif
3631 # Add duplicates which ought to be removed!
3632 echo "~^header insert bcc juice4@exam.ple";\
3633 read es; echo $es;vput vexpr es substr "$es" 0 1
3634 if [ "$es" != 2 ]
3635 xcall bail "be juicy4-1"
3636 endif
3637 echo "~^header insert bcc juice4@exam.ple";\
3638 read es; echo $es;vput vexpr es substr "$es" 0 1
3639 if [ "$es" != 2 ]
3640 xcall bail "be juicy4-2"
3641 endif
3642 echo "~^header insert bcc juice4@exam.ple";\
3643 read es; echo $es;vput vexpr es substr "$es" 0 1
3644 if [ "$es" != 2 ]
3645 xcall bail "be juicy4-3"
3646 endif
3647 echo "~:set t_ocs"
3650 call _work 3; echo $?
3651 echo "~r - '__EOT'"
3652 vput ! i echo just knock if you can hear me;\
3653 i=0;\
3654 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3655 echo relax
3656 echon shell-cmd says $?/$^ERRNAME: $i
3657 echo "~x will not become interpreted, we are reading until __EOT"
3658 echo "__EOT"
3659 read r_status; echo "~~r status output: $r_status"
3660 echo "~:echo $? $! $^ERRNAME"
3661 read r_status
3662 echo "~~r status from parent: $r_status"
3665 call _work 4; echo $?
3666 vput cwd cwd;echo cwd:$?
3667 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3668 call _read
3671 call _work 5; echo $?
3672 echo "~^header show MAILX-Command"; read es;\
3673 call xerr $es "t_header 1000"; call read_mline_res
3674 echo "~^header show MAILX-raw-TO"; read es;\
3675 call xerr $es "t_header 1001"; xcall read_mline_res
3677 echoerr IT IS WRONG IF YOU SEE THIS
3679 define t_oce {
3680 echo on-compose-enter, mailx-command<$mailx-command>
3681 set t_oce autobcc=oce@exam.ple
3682 alternates alter1@exam.ple alter2@exam.ple
3683 alternates
3684 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3685 echo mailx-subject<$mailx-subject>
3686 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3687 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3688 mailx-raw-bcc<$mailx-raw-bcc>
3689 echo mailx-orig-from<$mailx-orig-from> \
3690 mailx-orig-to<$mailx-orig-to> \
3691 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3693 define t_ocl {
3694 echo on-compose-leave, mailx-command<$mailx-command>
3695 set t_ocl autocc=ocl@exam.ple
3696 unalternates *
3697 alternates alter3@exam.ple alter4@exam.ple
3698 alternates
3699 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3700 echo mailx-subject<$mailx-subject>
3701 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3702 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3703 mailx-raw-bcc<$mailx-raw-bcc>
3704 echo mailx-orig-from<$mailx-orig-from> \
3705 mailx-orig-to<$mailx-orig-to> \
3706 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3708 define t_occ {
3709 echo on-compose-cleanup, mailx-command<$mailx-command>
3710 set t_occ autocc=occ@exam.ple
3711 unalternates *
3712 alternates
3713 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3714 echo mailx-subject<$mailx-subject>
3715 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3716 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3717 mailx-raw-bcc<$mailx-raw-bcc>
3718 echo mailx-orig-from<$mailx-orig-from> \
3719 mailx-orig-to<$mailx-orig-to> \
3720 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3722 wysh set on-compose-splice=t_ocs \
3723 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
3724 ~t shell@exam.ple\\n~:set t_ocs_sh\\n\"" \
3725 on-compose-enter=t_oce on-compose-leave=t_ocl \
3726 on-compose-cleanup=t_occ
3727 ' > ./.tnotes 2>&1
3728 ex0_test behave:compose_hooks-3-estat
3729 ${cat} ./.tnotes >> "${MBOX}"
3731 check behave:compose_hooks-3 - "${MBOX}" '679526364 2431'
3733 # Reply, forward, resend, Resend
3735 ${rm} -f "${MBOX}"
3736 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3737 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3738 -Smta=./.tsendmail.sh
3740 printf '
3741 echo start: $? $! $^ERRNAME
3742 File %s
3743 echo File: $? $! $^ERRNAME;echo;echo
3744 reply 1
3745 this is content of reply 1
3747 echo reply 1: $? $! $^ERRNAME;echo;echo
3748 Reply 1 2
3749 this is content of Reply 1 2
3751 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3752 forward 1 fwdex@am.ple
3753 this is content of forward 1
3755 echo forward 1: $? $! $^ERRNAME;echo;echo
3756 resend 1 2 resendex@am.ple
3757 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3758 Resend 1 2 Resendex@am.ple
3759 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3760 ' "${MBOX}" |
3761 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3762 -Smta=./.tsendmail.sh \
3764 define bail {
3765 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3767 define xerr {
3768 vput vexpr es substr "$1" 0 1
3769 if [ "$es" != 2 ]
3770 xcall bail "$2"
3773 define read_mline_res {
3774 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3775 echo mline_res:$len/$es/$^ERRNAME: $hl
3776 if [ $es -ne $^ERR-NONE ]
3777 xcall bail read_mline_res
3778 elif [ $len -ne 0 ]
3779 \xcall read_mline_res
3782 define work_hl {
3783 echo "~^header show $1"; read es;\
3784 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3785 if [ $# -gt 1 ]
3786 shift
3787 xcall work_hl "$@"
3790 define t_ocs {
3791 read ver
3792 echo t_ocs version $ver
3793 echo "~^header list"; read hl; echo $hl;\
3794 echoerr the header list is $hl;\
3795 call xerr "$hl" "header list"
3796 eval vpospar set $hl
3797 shift
3798 xcall work_hl "$@"
3799 echoerr IT IS WRONG IF YOU SEE THIS
3801 define t_oce {
3802 echo on-XY-enter, mailx-command<$mailx-command>
3803 set t_oce autobcc=oce@exam.ple
3804 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3805 echo mailx-subject<$mailx-subject>
3806 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3807 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3808 mailx-raw-bcc<$mailx-raw-bcc>
3809 echo mailx-orig-from<$mailx-orig-from> \
3810 mailx-orig-to<$mailx-orig-to> \
3811 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3813 define t_ocl {
3814 echo on-XY-leave, mailx-command<$mailx-command>
3815 set t_ocl autocc=ocl@exam.ple
3816 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3817 echo mailx-subject<$mailx-subject>
3818 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3819 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3820 mailx-raw-bcc<$mailx-raw-bcc>
3821 echo mailx-orig-from<$mailx-orig-from> \
3822 mailx-orig-to<$mailx-orig-to> \
3823 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3825 define t_occ {
3826 echo on-XY-cleanup, mailx-command<$mailx-command>
3827 set t_occ autocc=occ@exam.ple
3828 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3829 echo mailx-subject<$mailx-subject>
3830 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3831 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3832 mailx-raw-bcc<$mailx-raw-bcc>
3833 echo mailx-orig-from<$mailx-orig-from> \
3834 mailx-orig-to<$mailx-orig-to> \
3835 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3837 wysh set on-compose-splice=t_ocs \
3838 on-compose-enter=t_oce on-compose-leave=t_ocl \
3839 on-compose-cleanup=t_occ \
3840 on-resend-enter=t_oce on-resend-cleanup=t_occ
3841 ' > ./.tnotes 2>&1
3842 ex0_test behave:compose_hooks-4-estat
3843 ${cat} ./.tnotes >> "${MBOX}"
3845 check behave:compose_hooks-4 - "${MBOX}" '3038884027 7516'
3847 t_epilog
3850 t_behave_mass_recipients() {
3851 t_prolog t_behave_mass_recipients
3852 TRAP_EXIT_ADDONS="./.t*"
3854 ${cat} <<-_EOT > ./.tsendmail.sh
3855 #!${SHELL} -
3856 (echo 'From Eucalyptus Sat Jul 08 21:14:57 2017' && ${cat} && echo
3857 ) >> "${MBOX}"
3858 _EOT
3859 chmod 0755 ./.tsendmail.sh
3861 ${cat} <<'__EOT__' > ./.trc
3862 define bail {
3863 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3865 define ins_addr {
3866 wysh set nr=$1 hn=$2
3867 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
3868 if [ "$es" -ne 0 ]
3869 xcall bail "ins_addr $hn 1-$nr"
3871 vput vexpr nr + $nr 1
3872 if [ "$nr" -le "$maximum" ]
3873 xcall ins_addr $nr $hn
3876 define bld_alter {
3877 wysh set nr=$1 hn=$2
3878 alternates $hn$nr@$hn
3879 vput vexpr nr + $nr 2
3880 if [ "$nr" -le "$maximum" ]
3881 xcall bld_alter $nr $hn
3884 define t_ocs {
3885 read ver
3886 call ins_addr 1 t
3887 call ins_addr 1 c
3888 call ins_addr 1 b
3890 define t_ocl {
3891 if [ "$t_remove" != '' ]
3892 call bld_alter 1 t
3893 call bld_alter 2 c
3896 set on-compose-splice=t_ocs on-compose-leave=t_ocl
3897 __EOT__
3899 ${rm} -f "${MBOX}"
3900 printf 'm this-goes@nowhere\nbody\n!.\n' |
3901 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3902 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3903 >./.tall 2>&1
3904 ${cat} ./.tall >> "${MBOX}"
3905 check behave:mass_recipients-1 0 "${MBOX}" '2912243346 51526'
3907 ${rm} -f "${MBOX}"
3908 printf 'm this-goes@nowhere\nbody\n!.\n' |
3909 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3910 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3911 >./.tall 2>&1
3912 ${cat} ./.tall >> "${MBOX}"
3913 check behave:mass_recipients-2 0 "${MBOX}" '4097804632 34394'
3915 t_epilog
3918 t_behave_mime_types_load_control() {
3919 t_prolog t_behave_mime_types_load_control
3920 TRAP_EXIT_ADDONS="./.t*"
3922 ${cat} <<-_EOT > ./.tmts1
3923 @ application/mathml+xml mathml
3924 _EOT
3925 ${cat} <<-_EOT > ./.tmts2
3926 @ x-conference/x-cooltalk ice
3927 @ aga-aga aga
3928 @ application/aga-aga aga
3929 _EOT
3931 ${cat} <<-_EOT > ./.tmts1.mathml
3932 <head>nonsense ML</head>
3933 _EOT
3934 ${cat} <<-_EOT > ./.tmts2.ice
3935 Icy, icy road.
3936 _EOT
3937 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
3938 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
3940 printf '
3941 m %s
3942 Schub-di-du
3943 ~@ ./.tmts1.mathml
3944 ~@ ./.tmts2.ice
3945 ~@ ./.tmtsx.doom
3946 ~@ ./.tmtsx.aga
3948 File %s
3949 from*
3950 type
3952 ' "${MBOX}" "${MBOX}" |
3953 ${MAILX} ${ARGS} \
3954 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
3955 > ./.tout 2>&1
3956 ex0_test behave:mime_types_load_control
3958 ${cat} "${MBOX}" >> ./.tout
3959 check behave:mime_types_load_control-1 - ./.tout '1441260727 2449'
3961 echo type | ${MAILX} ${ARGS} -R \
3962 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
3963 -f "${MBOX}" >> ./.tout 2>&1
3964 check behave:mime_types_load_control-2 0 ./.tout '1441391438 3646'
3966 t_epilog
3969 t_behave_lreply_futh_rth_etc() {
3970 t_prolog t_behave_lreply_futh_rth_etc
3971 TRAP_EXIT_ADDONS="./.t*"
3973 ${cat} <<-_EOT > ./.tsendmail.sh
3974 #!${SHELL} -
3975 (echo 'From HumulusLupulus Thu Jul 27 14:41:20 2017' && ${cat} && echo
3976 ) >> "${MBOX}"
3977 _EOT
3978 chmod 0755 ./.tsendmail.sh
3980 ${cat} <<-_EOT > ./.tmbox
3981 From neverneverland Sun Jul 23 13:46:25 2017
3982 Subject: Bugstop: five miles out 1
3983 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3984 From: mister originator <mr@originator>
3985 To: bugstop-commit@five.miles.out, laber@backe.eu
3986 Cc: is@a.list
3987 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
3988 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
3989 Date: Wed, 19 Jul 2017 09:22:57 -0400
3990 Message-Id: <20170719132257.766AF781267@originator>
3991 Status: RO
3993 > |Sorry, I think I misunderstand something. I would think that
3995 That's appalling.
3997 From neverneverland Fri Jul 7 22:39:11 2017
3998 Subject: Bugstop: five miles out 2
3999 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
4000 Content-Transfer-Encoding: 7bit
4001 From: mister originator <mr@originator>
4002 To: bugstop-commit@five.miles.out
4003 Cc: is@a.list
4004 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
4005 Date: Fri, 07 Jul 2017 16:33:59 -0400
4006 Status: R
4008 capable of changing back.
4010 From neverneverland Fri Jul 7 22:42:00 2017
4011 Subject: Bugstop: five miles out 3
4012 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4013 Content-Transfer-Encoding: 7bit
4014 From: mister originator <mr@originator>
4015 To: bugstop-commit@five.miles.out
4016 Cc: is@a.list
4017 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
4018 Date: Fri, 07 Jul 2017 16:33:59 -0400
4019 List-Post: <mailto:bugstop@five.miles.out>
4020 Status: R
4022 are you ready, boots?
4024 From neverneverland Sat Aug 19 23:15:00 2017
4025 Subject: Bugstop: five miles out 4
4026 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
4027 Content-Transfer-Encoding: 7bit
4028 From: mister originator <mr@originator>
4029 To: bugstop@five.miles.out
4030 Cc: is@a.list
4031 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
4032 Date: Fri, 07 Jul 2017 16:33:59 -0400
4033 List-Post: <mailto:bugstop@five.miles.out>
4034 Status: R
4036 are you ready, boots?
4037 _EOT
4041 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh \
4042 -Rf ./.tmbox >> "${MBOX}" 2>&1
4043 define r {
4044 wysh set m="This is text of \"reply ${1}."
4045 reply 1 2 3
4046 !I m
4049 !I m
4052 !I m
4055 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
4057 define R {
4058 wysh set m="This is text of \"Reply ${1}."
4059 eval Reply $2
4060 !I m
4061 !I 2
4064 echo -----After Reply $1.$2: $?/$^ERRNAME
4066 define _Lh {
4067 read protover
4068 echo '~I m'
4069 echo '~I n'
4070 echo '".'
4072 define _Ls {
4073 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
4074 eval Lreply $2
4076 define L {
4077 # We need two indirections for this test: one for the case that Lreply
4078 # fails because of missing recipients: we need to read EOF next, thus
4079 # place this in _Ls last; and second for the succeeding cases EOF is
4080 # not what these should read, so go over the backside and splice it in!
4081 call _Ls "$@"
4082 echo -----After Lreply $1.$2: $?/$^ERRNAME
4084 define x {
4085 localopts call-fixate yes
4086 call r $1
4087 call R $1 1; call R $1 2; call R $1 3; call R $1 4
4088 call L $1 1; call L $1 2; call L $1 3
4090 define tweak {
4091 echo;echo '===== CHANGING === '"$*"' =====';echo
4092 eval "$@"
4095 set from=laber@backe.eu
4096 mlist is@a.list
4097 call x 1
4098 call tweak set reply-to-honour
4099 call x 2
4100 call tweak set followup-to
4101 call x 3
4102 call tweak set followup-to-honour
4103 call x 4
4104 call tweak mlist bugstop@five.miles.out
4105 call x 5
4106 call tweak mlsubscribe bugstop@five.miles.out
4107 call x 6
4108 call tweak set recipients-in-cc
4109 call x 7
4110 _EOT
4112 check behave:lreply_futh_rth_etc-1 0 "${MBOX}" '940818845 29373'
4116 ${cat} <<-_EOT > ./.tmbox
4117 From tom@i-i.example Thu Oct 26 03:15:55 2017
4118 Date: Wed, 25 Oct 2017 21:15:46 -0400
4119 From: tom <tom@i-i.example>
4120 To: Steffen Nurpmeso <steffen@sdaoden.eu>
4121 Cc: tom <tom@i-i.example>
4122 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
4123 Message-ID: <20171026011546.GA11643@i-i.example>
4124 Reply-To: tom@i-i.example
4125 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
4126 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
4127 Status: R
4129 The report's useful :-)
4130 _EOT
4132 printf 'reply 1\nthank you\n!.\n' |
4133 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh -Sreply-to-honour \
4134 -Rf ./.tmbox > "${MBOX}" 2>&1
4135 check behave:lreply_futh_rth_etc-2 0 "${MBOX}" '1045866991 331'
4137 t_epilog
4140 t_behave_xxxheads_rfc2047() {
4141 t_prolog t_behave_xxxheads_rfc2047
4142 TRAP_EXIT_ADDONS="./.t*"
4144 ${cat} <<-_EOT > ./.tsendmail.sh
4145 #!${SHELL} -
4146 (echo 'From GentianaLutea Mon Dec 04 17:15:29 2017' && ${cat} &&
4147 echo) >> "${MBOX}"
4148 _EOT
4149 chmod 0755 ./.tsendmail.sh
4152 ${rm} -f "${MBOX}"
4153 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4154 -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̲' \
4155 "${MBOX}"
4156 check behave:xxxheads_rfc2047-1 0 "${MBOX}" '3370931614 375'
4158 # Single word (overlong line split -- bad standard! Requires injection of
4159 # artificial data!! But can be prevented by using RFC 2047 encoding)
4160 ${rm} -f "${MBOX}"
4161 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
4162 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4163 check behave:xxxheads_rfc2047-2 0 "${MBOX}" '489922370 1718'
4165 # Combination of encoded words, space and tabs of varying sort
4166 ${rm} -f "${MBOX}"
4167 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4168 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4169 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4170 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4171 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4172 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4173 "${MBOX}"
4174 check behave:xxxheads_rfc2047-3 0 "${MBOX}" '1676887734 591'
4176 # Overlong multibyte sequence that must be forcefully split
4177 # todo This works even before v15.0, but only by accident
4178 ${rm} -f "${MBOX}"
4179 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4180 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4181 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4182 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4183 "${MBOX}"
4184 check behave:xxxheads_rfc2047-4 0 "${MBOX}" '3029301775 659'
4186 # Trailing WS
4187 ${rm} -f "${MBOX}"
4188 echo | ${MAILX} ${ARGS} \
4189 -s "1-1 B2 B3 B4 B5 B6 B\
4190 1-2 B2 B3 B4 B5 B6 B\
4191 1-3 B2 B3 B4 B5 B6 B\
4192 1-4 B2 B3 B4 B5 B6 B\
4193 1-5 B2 B3 B4 B5 B6 B\
4194 1-6 B2 B3 B4 B5 B6 " \
4195 "${MBOX}"
4196 check behave:xxxheads_rfc2047-5 0 "${MBOX}" '4126167195 297'
4198 # Leading and trailing WS
4199 ${rm} -f "${MBOX}"
4200 echo | ${MAILX} ${ARGS} \
4201 -s " 2-1 B2 B3 B4 B5 B6 B\
4202 1-2 B2 B3 B4 B5 B6 B\
4203 1-3 B2 B3 B4 B5 B6 B\
4204 1-4 B2 B3 B4 B5 B6 " \
4205 "${MBOX}"
4206 check behave:xxxheads_rfc2047-6 0 "${MBOX}" '3600624479 236'
4208 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
4209 ${rm} -f "${MBOX}"
4210 echo "Dat Früchtchen riecht häußlich" |
4211 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tsendmail.sh \
4212 -s Hühöttchen \
4213 'Schnödes "Früchtchen" <do@du> (Hä!)'
4214 check behave:xxxheads_rfc2047-7 0 "${MBOX}" '800505986 368'
4216 t_epilog
4219 t_behave_rfc2231() {
4220 t_prolog t_behave_rfc2231
4221 TRAP_EXIT_ADDONS="./.t*"
4224 mkdir ./.ttt || exit 1
4225 cd ./.ttt || exit 2
4226 : > "ma'ger.txt"
4227 : > "mä'ger.txt"
4228 : > 'diet\ is \curd.txt'
4229 : > 'diet "is" curd.txt'
4230 : > höde-tröge.txt
4231 : > 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
4232 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4233 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4234 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4236 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4237 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
4238 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
4239 -a ./.ttt/höde-tröge.txt \
4240 -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 \
4241 -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 \
4242 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4243 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4244 "${MBOX}"
4245 check behave:rfc2231-1 0 "${MBOX}" '684985954 3092'
4247 # `resend' test, reusing $MBOX
4248 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4249 check behave:rfc2231-2 0 ./.t2 '684985954 3092'
4251 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4252 check behave:rfc2231-3 0 ./.t3 '3130352658 3148'
4254 t_epilog
4257 t_behave_iconv_mbyte_base64() {
4258 t_prolog t_behave_iconv_mbyte_base64
4259 TRAP_EXIT_ADDONS="./.t*"
4261 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv &&
4262 (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
4263 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4265 else
4266 echo 'behave:iconv_mbyte_base64: unsupported, skipped'
4267 return
4270 ${cat} <<-_EOT > ./.tsendmail.sh
4271 #!${SHELL} -
4272 (echo 'From DroseriaRotundifolia Thu Aug 03 17:26:25 2017' && ${cat} &&
4273 echo) >> "${MBOX}"
4274 _EOT
4275 chmod 0755 ./.tsendmail.sh
4277 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
4278 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4279 -Smta=./.tsendmail.sh \
4280 -Sescape=! -Smime-encoding=base64 2>./.terr
4281 set ttycharset=utf-8 sendcharsets=iso-2022-jp
4282 m t1@exam.ple
4283 !s Japanese from UTF-8 to ISO-2022-JP
4284 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4286 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4289 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4291 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4294 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
4295 m t2@exam.ple
4296 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
4297 \e$B%7%8%e%&%+%i2J!J%7%8%e%&%+%i$+!"3XL>\e(B Paridae\e$B!K$O!"D;N`%9%:%aL\$N2J$G$"$k!#%7%8%e%&%+%i!J;M==?}!K$HAm>N$5$l$k$,!"695A$K$O$3$N\e(B1\e$B<o$r%7%8%e%&%+%i$H8F$V!#\e(B
4299 \e$B%+%s%`%j%,%i!J3XL>\e(BParus cristatus\e$B!K$O!"%9%:%aL\%7%8%e%&%+%i2J$KJ,N`$5$l$kD;N`$N0l<o!#\e(B
4302 \e$B%+%s%`%j%,%i!J3XL>\e(BParus cristatus\e$B!K$O!"%9%:%aL\%7%8%e%&%+%i2J$KJ,N`$5$l$kD;N`$N0l<o!#\e(B
4304 \e$B%7%8%e%&%+%i2J!J%7%8%e%&%+%i$+!"3XL>\e(B Paridae\e$B!K$O!"D;N`%9%:%aL\$N2J$G$"$k!#%7%8%e%&%+%i!J;M==?}!K$HAm>N$5$l$k$,!"695A$K$O$3$N\e(B1\e$B<o$r%7%8%e%&%+%i$H8F$V!#\e(B
4306 _EOT
4307 check behave:iconv_mbyte_base64-1 0 "${MBOX}" '3428985079 1976'
4308 check behave:iconv_mbyte_base64-2 - ./.terr '4294967295 0'
4310 printf 'eval f 1; write ./.twrite\n' |
4311 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4312 check behave:iconv_mbyte_base64-3 0 ./.twrite '1259742080 686'
4313 check behave:iconv_mbyte_base64-4 - ./.tlog '3956097665 119'
4314 else
4315 echo 'behave:iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
4318 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4319 rm -f "${MBOX}" ./.twrite
4320 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4321 -Smta=./.tsendmail.sh \
4322 -Sescape=! -Smime-encoding=base64 2>./.terr
4323 set ttycharset=utf-8 sendcharsets=euc-jp
4324 m t1@exam.ple
4325 !s Japanese from UTF-8 to EUC-JP
4326 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4328 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4331 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4333 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4336 set ttycharset=EUC-JP sendcharsets=utf-8
4337 m t2@exam.ple
4338 !s Japanese from EUC-JP to UTF-8
4339 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4341 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4344 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4346 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4348 _EOT
4349 check behave:iconv_mbyte_base64-5 0 "${MBOX}" '1686827547 2051'
4350 check behave:iconv_mbyte_base64-6 - ./.terr '4294967295 0'
4352 printf 'eval f 1; write ./.twrite\n' |
4353 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4354 check behave:iconv_mbyte_base64-7 0 ./.twrite '1259742080 686'
4355 check behave:iconv_mbyte_base64-8 - ./.tlog '500059195 119'
4356 else
4357 echo 'behave:iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
4360 t_epilog
4363 t_behave_iconv_mainbody() {
4364 t_prolog t_behave_iconv_mainbody
4365 TRAP_EXIT_ADDONS="./.t*"
4368 if have_feat iconv &&
4369 (</dev/null iconv -f utf-8 -t ascii) >/dev/null 2>&1; then
4370 j="`printf '–' | iconv -f utf-8 -t ascii 2>/dev/null`"
4371 # This assumes iconv(1) behaves like iconv(3), but well.
4372 # This is flaky because the behaviour is so non-uniform
4373 if [ ${?} -ne 0 ]; then
4374 if [ x"${j}" = 'x?' ]; then
4376 else
4379 elif [ x"${j}" = 'x?' ]; then
4381 elif [ x"${j}" = 'x*' ]; then
4385 if [ -z "${i}" ]; then
4386 echo 'behave:iconv_mainbody: unsupported, skipped'
4387 return
4390 ${cat} <<-_EOT > ./.tsendmail.sh
4391 #!${SHELL} -
4392 (echo 'From HamamelisVirginiana Fri Oct 20 16:23:21 2017' && ${cat} &&
4393 echo) >> "${MBOX}"
4394 _EOT
4395 chmod 0755 ./.tsendmail.sh
4397 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tsendmail.sh \
4398 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
4399 -s '–' over-the@rain.bow 2>./.terr
4400 check behave:iconv_mainbody-1 0 "${MBOX}" '3634015017 251'
4401 check behave:iconv_mainbody-2 - ./.terr '4294967295 0'
4403 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tsendmail.sh \
4404 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
4405 -s '–' over-the@rain.bow 2>./.terr
4406 exn0_test behave:iconv_mainbody-3
4407 check behave:iconv_mainbody-3 - "${MBOX}" '3634015017 251'
4408 check behave:iconv_mainbody-4 - ./.terr '2579894983 148'
4410 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
4411 j=${?}
4412 ex0_test behave:iconv_mainbody-5-0 ${j}
4413 if [ x${i} = x1 ]; then
4414 # yuck, just assume ???, we need a test program for that one!
4415 check behave:iconv_mainbody-5-1-1 - ./.tout '1959197095 283'
4416 check behave:iconv_mainbody-5-1-1 - ./.terr '4294967295 0'
4417 elif [ x${i} = x2 ]; then
4418 check behave:iconv_mainbody-5-2-1 - ./.tout '1959197095 283'
4419 check behave:iconv_mainbody-5-2-2 - ./.terr '4294967295 0'
4420 elif [ x${i} = x3 ]; then
4421 check behave:iconv_mainbody-5-3-1 - ./.tout '3196380198 279'
4422 check behave:iconv_mainbody-5-3-2 - ./.terr '4294967295 0'
4423 else
4424 check behave:iconv_mainbody-5-4-1 - ./.tout '3760313827 279'
4425 check behave:iconv_mainbody-5-4-2 - ./.terr '4294967295 0'
4428 t_epilog
4431 t_behave_q_t_etc_opts() {
4432 t_prolog t_behave_q_t_etc_opts
4433 TRAP_EXIT_ADDONS="./.t*"
4435 # Three tests for MIME encoding and (a bit) content classification.
4436 # At the same time testing -q FILE, < FILE and -t FILE
4437 t__put_body > ./.tin
4439 ${rm} -f "${MBOX}"
4440 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
4441 -a ./.tin -s "`t__put_subject`" "${MBOX}"
4442 check behave:q_t_etc_opts-1 0 "${MBOX}" '3570973309 6646'
4444 ${rm} -f "${MBOX}"
4445 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
4446 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
4447 check behave:q_t_etc_opts-2 0 "${MBOX}" '3570973309 6646'
4449 ${rm} -f "${MBOX}"
4450 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
4451 ${cat} ./.tin
4452 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
4453 check behave:q_t_etc_opts-3 0 "${MBOX}" '3570973309 6646'
4455 t_epilog
4458 t_behave_s_mime() {
4459 have_feat smime || {
4460 echo 'behave:s/mime: unsupported, skipped'
4461 return
4464 t_prolog t_behave_s_mime
4465 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
4466 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
4467 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
4469 printf 'behave:s/mime: .. generating test key and certificate ..\n'
4470 ${cat} <<-_EOT > ./.t.conf
4471 [ req ]
4472 default_bits = 1024
4473 default_keyfile = keyfile.pem
4474 distinguished_name = req_distinguished_name
4475 attributes = req_attributes
4476 prompt = no
4477 output_password =
4479 [ req_distinguished_name ]
4480 C = GB
4481 ST = Over the
4482 L = rainbow
4483 O = S-nail
4484 OU = S-nail.smime
4485 CN = S-nail.test
4486 emailAddress = test@localhost
4488 [ req_attributes ]
4489 challengePassword =
4490 _EOT
4491 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
4492 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >/dev/null 2>&1
4493 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
4495 # Sign/verify
4496 printf 'behave:s/mime:sign/verify: '
4497 echo bla | ${MAILX} ${ARGS} \
4498 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4499 -Ssmime-sign -Sfrom=test@localhost \
4500 -s 'S/MIME test' ./.VERIFY
4501 if [ $? -eq 0 ]; then
4502 printf 'ok\n'
4503 else
4504 printf 'failed\n'
4505 ESTAT=1
4506 t_epilog
4507 return
4510 ${awk} '
4511 BEGIN{ skip=0 }
4512 /^Content-Description: /{ skip = 2; print; next }
4513 /^$/{ if(skip) --skip }
4514 { if(!skip) print }
4516 < ./.VERIFY > "${MBOX}"
4517 check behave:s/mime:sign/verify:checksum - "${MBOX}" '2900817158 648'
4519 printf 'behave:s/mime:sign/verify:verify '
4520 printf 'verify\nx\n' |
4521 ${MAILX} ${ARGS} \
4522 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4523 -Ssmime-sign -Sfrom=test@localhost \
4524 -Serrexit -R \
4525 -f ./.VERIFY >/dev/null 2>&1
4526 if [ $? -eq 0 ]; then
4527 printf 'ok\n'
4528 else
4529 printf 'failed\n'
4530 ESTAT=1
4531 t_epilog
4532 return
4535 printf 'behave:s/mime:sign/verify:disproof-1 '
4536 if openssl smime -verify -CAfile ./.tcert.pem \
4537 -in ./.VERIFY >/dev/null 2>&1; then
4538 printf 'ok\n'
4539 else
4540 printf 'failed\n'
4541 ESTAT=1
4542 t_epilog
4543 return
4546 # (signing +) encryption / decryption
4547 ${cat} <<-_EOT > ./.tsendmail.sh
4548 #!${SHELL} -
4549 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
4550 _EOT
4551 chmod 0755 ./.tsendmail.sh
4553 printf 'behave:s/mime:encrypt+sign: '
4554 echo bla |
4555 ${MAILX} ${ARGS} \
4556 -Ssmime-force-encryption \
4557 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4558 -Smta=./.tsendmail.sh \
4559 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4560 -Ssmime-sign -Sfrom=test@localhost \
4561 -s 'S/MIME test' recei@ver.com
4562 if [ $? -eq 0 ]; then
4563 printf 'ok\n'
4564 else
4565 ESTAT=1
4566 printf 'error: encrypt+sign failed\n'
4569 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
4570 check behave:s/mime:encrypt+sign:checksum - "${MBOX}" '1937410597 327'
4572 printf 'behave:s/mime:decrypt+verify: '
4573 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
4574 ${MAILX} ${ARGS} \
4575 -Ssmime-force-encryption \
4576 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4577 -Smta=./.tsendmail.sh \
4578 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4579 -Ssmime-sign -Sfrom=test@localhost \
4580 -Serrexit -R \
4581 -f ./.ENCRYPT >/dev/null 2>&1
4582 if [ $? -eq 0 ]; then
4583 printf 'ok\n'
4584 else
4585 ESTAT=1
4586 printf 'failed\n'
4589 ${awk} '
4590 BEGIN{ skip=0 }
4591 /^Content-Description: /{ skip = 2; print; next }
4592 /^$/{ if(skip) --skip }
4593 { if(!skip) print }
4595 < ./.DECRYPT > "${MBOX}"
4596 check behave:s/mime:decrypt+verify:checksum - "${MBOX}" '1720739247 931'
4598 printf 'behave:s/mime:decrypt+verify:disproof-1: '
4599 if (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
4600 openssl smime -verify -CAfile ./.tcert.pem) >/dev/null 2>&1; then
4601 printf 'ok\n'
4602 else
4603 printf 'failed\n'
4604 ESTAT=1
4607 printf "behave:s/mime:encrypt: "
4608 echo bla | ${MAILX} ${ARGS} \
4609 -Ssmime-force-encryption \
4610 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4611 -Smta=./.tsendmail.sh \
4612 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4613 -Sfrom=test@localhost \
4614 -s 'S/MIME test' recei@ver.com
4615 if [ $? -eq 0 ]; then
4616 printf 'ok\n'
4617 else
4618 ESTAT=1
4619 printf 'failed\n'
4622 # Same as behave:s/mime:encrypt+sign:checksum above
4623 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
4624 check behave:s/mime:encrypt:checksum - "${MBOX}" '1937410597 327'
4626 ${rm} -f ./.DECRYPT
4627 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
4628 -Ssmime-force-encryption \
4629 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4630 -Smta=./.tsendmail.sh \
4631 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4632 -Sfrom=test@localhost \
4633 -Serrexit -R \
4634 -f ./.ENCRYPT >/dev/null 2>&1
4635 check behave:s/mime:decrypt 0 "./.DECRYPT" '2624716890 422'
4637 printf 'behave:s/mime:decrypt:disproof-1: '
4638 if openssl smime -decrypt -inkey ./.tkey.pem \
4639 -in ./.ENCRYPT >/dev/null 2>&1; then
4640 printf 'ok\n'
4641 else
4642 printf 'failed\n'
4643 ESTAT=1
4646 t_epilog
4649 # t_content()
4650 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
4651 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
4652 # Note we unfortunately need to place some statements without proper
4653 # indentation because of continuation problems
4654 # xxx Note: t_content() was the first test (series) written. Today many
4655 # xxx aspects are (better) covered by other tests above, some are not.
4656 # xxx At some future date and time, convert the last remains not covered
4657 # xxx elsewhere to a real t_behave_* test and drop t_content()
4658 t_content() {
4659 t_prolog t_content
4661 # Test for [260e19d] (Juergen Daubert)
4662 ${rm} -f "${MBOX}"
4663 echo body | ${MAILX} ${ARGS} "${MBOX}"
4664 check content:004 0 "${MBOX}" '2917662811 98'
4666 # "Test for" [d6f316a] (Gavin Troy)
4667 ${rm} -f "${MBOX}"
4668 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
4669 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
4670 check content:006 0 "${MBOX}" '2099098650 122'
4671 check content:006-1 - "${BODY}" '794542938 174'
4673 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
4674 ${rm} -f "${MBOX}"
4675 ${awk} 'BEGIN{
4676 for(i = 0; i < 10000; ++i)
4677 printf "\xC3\xBC"
4678 #printf "\xF0\x90\x87\x90"
4679 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
4680 check content:007 0 "${MBOX}" '534262374 61816'
4682 t_epilog
4685 t__put_subject() {
4686 # MIME encoding (QP) stress message subject
4687 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
4688 'adadaddsssssssddddddddddddddddddddd'\
4689 'ddddddddddddddddddddddddddddddddddd'\
4690 'ddddddddddddddddddddddddddddddddddd'\
4691 'dddddddddddddddddddd Hallelulja? Od'\
4692 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
4693 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
4694 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
4695 'fffffffffffffffffffffffffffffffffff'\
4696 'fffffffffffffffffffff ggggggggggggg'\
4697 'ggggggggggggggggggggggggggggggggggg'\
4698 'ggggggggggggggggggggggggggggggggggg'\
4699 'ggggggggggggggggggggggggggggggggggg'\
4700 'gggggggggggggggg'
4703 t__put_body() {
4704 # MIME encoding (QP) stress message body
4705 printf \
4706 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
4707 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
4708 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
4709 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
4710 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
4711 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
4712 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
4713 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
4714 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
4715 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
4716 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
4717 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
4718 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
4719 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
4720 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
4721 "auf den zeilen vorher.\r\n"\
4722 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
4723 ".\r\n"\
4724 "Die letzte Zeile war nur ein Punkt.\r\n"\
4725 "..\r\n"\
4726 "Das waren deren zwei.\r\n"\
4727 " \r\n"\
4728 "Die letzte Zeile war ein Leerschritt.\n"\
4729 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
4730 "Prösterchen.\r\n"\
4731 ".\n"\
4732 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
4733 "..\n"\
4734 "Das waren deren zwei. ditto.\n"\
4735 "Prösterchen.\n"\
4736 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
4737 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
4738 "auf den zeilen vorher.\n"\
4739 "ditto.\n"\
4740 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
4741 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
4742 "\n"\
4743 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4744 "\n"\
4745 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4746 "3\n"\
4747 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4748 "34\n"\
4749 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4750 "345\n"\
4751 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4752 "3456\n"\
4753 "QP am Zeilenende über soft-nl hinweg\n"\
4754 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4755 "ö123\n"\
4756 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4757 "1ö23\n"\
4758 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4759 "12ö3\n"\
4760 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4761 "123ö\n"\
4762 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
4763 " \n"\
4764 "Die letzte Zeile war ein Leerschritt.\n"\
4768 t_all() {
4769 # if have_feat devel; then
4770 # ARGS="${ARGS} -Smemdebug"
4771 # export ARGS
4772 # fi
4774 if [ -n "${UTF8_LOCALE}" ]; then
4775 printf 'Using Unicode locale %s\n' "${UTF8_LOCALE}"
4776 else
4777 printf 'No Unicode locale found, disabling Unicode tests\n'
4780 t_behave
4781 t_content
4784 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
4785 cc_all_configs
4786 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
4787 t_all
4788 else
4789 while [ ${#} -gt 0 ]; do
4790 ${1}
4791 shift
4792 done
4795 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
4797 exit ${ESTAT}
4798 # s-sh-mode