cc-test.sh: t_behave_iconv_mainbody() should compile test instead, sigh!
[s-mailx.git] / cc-test.sh
blob2de6c5f6f9f487655d38ae43b1c578fd87a11ca5
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 t_epilog
671 t_behave_input_inject_semicolon_seq() {
672 t_prolog t_behave_input_inject_semicolon_seq
674 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
675 define mydeepmac {
676 echon '(mydeepmac)';
678 define mymac {
679 echon this_is_mymac;call mydeepmac;echon ';';
681 echon one';';call mymac;echon two";";call mymac;echo three$';';
682 define mymac {
683 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
685 echon one';';call mymac;echon two";";call mymac;echo three$';';
686 __EOT
688 check behave:input_inject_semicolon_seq 0 "${MBOX}" '512117110 140'
690 t_epilog
693 t_behave_commandalias() {
694 t_prolog t_behave_commandalias
696 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
697 commandalias echo echo hoho
698 echo stop.
699 commandalias X Xx
700 commandalias Xx XxX
701 commandalias XxX XxXx
702 commandalias XxXx XxXxX
703 commandalias XxXxX XxXxXx
704 commandalias XxXxXx echo huhu
705 commandalias XxXxXxX echo huhu
707 commandalias XxXxXx XxXxXxX
709 uncommandalias echo
710 commandalias XxXxXx echo huhu
712 __EOT
714 check behave:commandalias 0 "${MBOX}" '3694143612 31'
716 t_epilog
719 t_behave_ifelse() {
720 t_prolog t_behave_ifelse
722 # Nestable conditions test
723 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
724 if 0
725 echo 1.err
726 else
727 echo 1.ok
728 endif
729 if 1
730 echo 2.ok
731 else
732 echo 2.err
733 endif
734 if $dietcurd
735 echo 3.err
736 else
737 echo 3.ok
738 endif
739 set dietcurd=yoho
740 if $dietcurd
741 echo 4.ok
742 else
743 echo 4.err
744 endif
745 if $dietcurd == 'yoho'
746 echo 5.ok
747 else
748 echo 5.err
749 endif
750 if $dietcurd @== 'Yoho'
751 echo 5-1.ok
752 else
753 echo 5-1.err
754 endif
755 if $dietcurd == 'Yoho'
756 echo 5-2.err
757 else
758 echo 5-2.ok
759 endif
760 if $dietcurd != 'yoho'
761 echo 6.err
762 else
763 echo 6.ok
764 endif
765 if $dietcurd @!= 'Yoho'
766 echo 6-1.err
767 else
768 echo 6-1.ok
769 endif
770 if $dietcurd != 'Yoho'
771 echo 6-2.ok
772 else
773 echo 6-2.err
774 endif
775 # Nesting
776 if faLse
777 echo 7.err1
778 if tRue
779 echo 7.err2
780 if yEs
781 echo 7.err3
782 else
783 echo 7.err4
784 endif
785 echo 7.err5
786 endif
787 echo 7.err6
788 else
789 echo 7.ok7
790 if YeS
791 echo 7.ok8
792 if No
793 echo 7.err9
794 else
795 echo 7.ok9
796 endif
797 echo 7.ok10
798 else
799 echo 7.err11
800 if yeS
801 echo 7.err12
802 else
803 echo 7.err13
804 endif
805 endif
806 echo 7.ok14
807 endif
808 if r
809 echo 8.ok1
810 if R
811 echo 8.ok2
812 else
813 echo 8.err2
814 endif
815 echo 8.ok3
816 else
817 echo 8.err1
818 endif
819 if s
820 echo 9.err1
821 else
822 echo 9.ok1
823 if S
824 echo 9.err2
825 else
826 echo 9.ok2
827 endif
828 echo 9.ok3
829 endif
830 # `elif'
831 if $dietcurd == 'yohu'
832 echo 10.err1
833 elif $dietcurd == 'yoha'
834 echo 10.err2
835 elif $dietcurd == 'yohe'
836 echo 10.err3
837 elif $dietcurd == 'yoho'
838 echo 10.ok1
839 if $dietcurd == 'yohu'
840 echo 10.err4
841 elif $dietcurd == 'yoha'
842 echo 10.err5
843 elif $dietcurd == 'yohe'
844 echo 10.err6
845 elif $dietcurd == 'yoho'
846 echo 10.ok2
847 if $dietcurd == 'yohu'
848 echo 10.err7
849 elif $dietcurd == 'yoha'
850 echo 10.err8
851 elif $dietcurd == 'yohe'
852 echo 10.err9
853 elif $dietcurd == 'yoho'
854 echo 10.ok3
855 else
856 echo 10.err10
857 endif
858 else
859 echo 10.err11
860 endif
861 else
862 echo 10.err12
863 endif
864 # integer
865 set dietcurd=10
866 if $dietcurd -lt 11
867 echo 11.ok1
868 if $dietcurd -gt 9
869 echo 11.ok2
870 else
871 echo 11.err2
872 endif
873 if $dietcurd -eq 10
874 echo 11.ok3
875 else
876 echo 11.err3
877 endif
878 if $dietcurd -ge 10
879 echo 11.ok4
880 else
881 echo 11.err4
882 endif
883 if $dietcurd -le 10
884 echo 11.ok5
885 else
886 echo 11.err5
887 endif
888 if $dietcurd -ge 11
889 echo 11.err6
890 else
891 echo 11.ok6
892 endif
893 if $dietcurd -le 9
894 echo 11.err7
895 else
896 echo 11.ok7
897 endif
898 else
899 echo 11.err1
900 endif
901 set dietcurd=Abc
902 if $dietcurd < aBd
903 echo 12.ok1
904 if $dietcurd @> abB
905 echo 12.ok2
906 else
907 echo 12.err2
908 endif
909 if $dietcurd @== aBC
910 echo 12.ok3
911 else
912 echo 12.err3
913 endif
914 if $dietcurd @>= AbC
915 echo 12.ok4
916 else
917 echo 12.err4
918 endif
919 if $dietcurd @<= ABc
920 echo 12.ok5
921 else
922 echo 12.err5
923 endif
924 if $dietcurd @>= abd
925 echo 12.err6
926 else
927 echo 12.ok6
928 endif
929 if $dietcurd @<= abb
930 echo 12.err7
931 else
932 echo 12.ok7
933 endif
934 else
935 echo 12.err1
936 endif
937 if $dietcurd < aBc
938 echo 12-1.ok
939 else
940 echo 12-1.err
941 endif
942 if $dietcurd @< aBc
943 echo 12-2.err
944 else
945 echo 12-2.ok
946 endif
947 if $dietcurd > ABc
948 echo 12-3.ok
949 else
950 echo 12-3.err
951 endif
952 if $dietcurd @> ABc
953 echo 12-3.err
954 else
955 echo 12-3.ok
956 endif
957 if $dietcurd @i=% aB
958 echo 13.ok
959 else
960 echo 13.err
961 endif
962 if $dietcurd =% aB
963 echo 13-1.err
964 else
965 echo 13-1.ok
966 endif
967 if $dietcurd @=% bC
968 echo 14.ok
969 else
970 echo 14.err
971 endif
972 if $dietcurd !% aB
973 echo 15-1.ok
974 else
975 echo 15-1.err
976 endif
977 if $dietcurd @!% aB
978 echo 15-2.err
979 else
980 echo 15-2.ok
981 endif
982 if $dietcurd !% bC
983 echo 15-3.ok
984 else
985 echo 15-3.err
986 endif
987 if $dietcurd @!% bC
988 echo 15-4.err
989 else
990 echo 15-4.ok
991 endif
992 if $dietcurd =% Cd
993 echo 16.err
994 else
995 echo 16.ok
996 endif
997 if $dietcurd !% Cd
998 echo 17.ok
999 else
1000 echo 17.err
1001 endif
1002 set diet=abc curd=abc
1003 if $diet == $curd
1004 echo 18.ok
1005 else
1006 echo 18.err
1007 endif
1008 set diet=abc curd=abcd
1009 if $diet != $curd
1010 echo 19.ok
1011 else
1012 echo 19.err
1013 endif
1014 # 1. Shitty grouping capabilities as of today
1015 unset diet curd ndefined
1016 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
1017 [ yes ]
1018 echo 20.ok
1019 else
1020 echo 20.err
1021 endif
1022 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
1023 echo 21.ok
1024 else
1025 echo 21.err
1026 endif
1027 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
1028 echo 22.ok
1029 else
1030 echo 22.err
1031 endif
1032 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
1033 echo 23.ok
1034 else
1035 echo 23.err
1036 endif
1037 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
1038 echo 24.err
1039 else
1040 echo 24.ok
1041 endif
1042 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
1043 && [ no ] || [ yes ]
1044 echo 25.ok
1045 else
1046 echo 25.err
1047 endif
1048 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1049 echo 26.ok
1050 else
1051 echo 26.err
1052 endif
1053 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
1054 echo 27.err
1055 else
1056 echo 27.ok
1057 endif
1058 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
1059 echo 28.err
1060 else
1061 echo 28.ok
1062 endif
1063 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
1064 echo 29.err
1065 else
1066 echo 29.ok
1067 endif
1068 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
1069 echo 30.err
1070 else
1071 echo 30.ok
1072 endif
1073 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
1074 echo 31.ok
1075 else
1076 echo 31.err
1077 endif
1078 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
1079 echo 32.err
1080 else
1081 echo 32.ok
1082 endif
1083 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
1084 echo 33.ok
1085 else
1086 echo 33.err
1087 endif
1088 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
1089 echo 34.err
1090 else
1091 echo 34.ok
1092 endif
1093 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
1094 echo 35.ok
1095 else
1096 echo 35.err
1097 endif
1098 set diet=yo curd=ho
1099 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1100 echo 36.err
1101 else
1102 echo 36.ok
1103 endif
1104 set ndefined
1105 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
1106 echo 37.ok
1107 else
1108 echo 37.err
1109 endif
1110 # 2. Shitty grouping capabilities as of today
1111 unset diet curd ndefined
1112 if [ false || false || true ] && [ false || true ] && yes
1113 echo 40.ok
1114 else
1115 echo 40.err
1116 endif
1117 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
1118 echo 41.ok
1119 else
1120 echo 41.err
1121 endif
1122 if [ 1 || 0 || 0 || 0 ]
1123 echo 42.ok
1124 else
1125 echo 42.err
1126 endif
1127 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
1128 echo 43.ok
1129 else
1130 echo 43.err
1131 endif
1132 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
1133 echo 44.err
1134 else
1135 echo 44.ok
1136 endif
1137 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
1138 echo 45.ok
1139 else
1140 echo 45.err
1141 endif
1142 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1143 echo 46.ok
1144 else
1145 echo 46.err
1146 endif
1147 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1148 echo 47.err
1149 else
1150 echo 47.ok
1151 endif
1152 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1153 echo 48.err
1154 else
1155 echo 48.ok
1156 endif
1157 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1158 echo 49.err
1159 else
1160 echo 49.ok
1161 endif
1162 if 1 || 0 || 0 || 0 && 0
1163 echo 50.err
1164 else
1165 echo 50.ok
1166 endif
1167 if 1 || 0 || 0 || 0 && 1
1168 echo 51.ok
1169 else
1170 echo 51.err
1171 endif
1172 if 0 || 0 || 0 || 1 && 0
1173 echo 52.err
1174 else
1175 echo 52.ok
1176 endif
1177 if 0 || 0 || 0 || 1 && 1
1178 echo 53.ok
1179 else
1180 echo 53.err
1181 endif
1182 if 0 || 0 || 0 || 1 && 0 || 1 && 0
1183 echo 54.err
1184 else
1185 echo 54.ok
1186 endif
1187 if 0 || 0 || 0 || 1 && 0 || 1 && 1
1188 echo 55.ok
1189 else
1190 echo 55.err
1191 endif
1192 set diet=yo curd=ho
1193 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1194 echo 56.err
1195 else
1196 echo 56.ok
1197 endif
1198 if $diet == 'yo' && $curd == 'ho' && $ndefined
1199 echo 57.err
1200 else
1201 echo 57.ok
1202 endif
1203 set ndefined
1204 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1205 echo 57.ok
1206 else
1207 echo 57.err
1208 endif
1209 if $diet == 'yo' && $curd == 'ho' && $ndefined
1210 echo 58.ok
1211 else
1212 echo 58.err
1213 endif
1214 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1215 echo 59.ok
1216 else
1217 echo 59.err
1218 endif
1219 # Some more en-braced variables
1220 set diet=yo curd=ho
1221 if ${diet} == ${curd}
1222 echo 70.err
1223 else
1224 echo 70.ok
1225 endif
1226 if ${diet} != ${curd}
1227 echo 71.ok
1228 else
1229 echo 71.err
1230 endif
1231 if $diet == ${curd}
1232 echo 72.err
1233 else
1234 echo 72.ok
1235 endif
1236 if ${diet} == $curd
1237 echo 73.err
1238 else
1239 echo 73.ok
1240 endif
1241 # Unary !
1242 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1243 echo 80.ok
1244 else
1245 echo 80.err
1246 endif
1247 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1248 echo 81.ok
1249 else
1250 echo 81.err
1251 endif
1252 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1253 echo 82.ok
1254 else
1255 echo 82.err
1256 endif
1257 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1258 echo 83.err
1259 else
1260 echo 83.ok
1261 endif
1262 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1263 echo 84.err
1264 else
1265 echo 84.ok
1266 endif
1267 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1268 echo 85.err
1269 else
1270 echo 85.ok
1271 endif
1272 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1273 echo 86.err
1274 else
1275 echo 86.ok
1276 endif
1277 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1278 echo 87.ok
1279 else
1280 echo 87.err
1281 endif
1282 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1283 echo 88.ok
1284 else
1285 echo 88.err
1286 endif
1287 # Unary !, odd
1288 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1289 echo 90.ok
1290 else
1291 echo 90.err
1292 endif
1293 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1294 echo 91.ok
1295 else
1296 echo 91.err
1297 endif
1298 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1299 echo 92.ok
1300 else
1301 echo 92.err
1302 endif
1303 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1304 echo 93.err
1305 else
1306 echo 93.ok
1307 endif
1308 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1309 echo 94.ok
1310 else
1311 echo 94.err
1312 endif
1313 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1314 echo 95.err
1315 else
1316 echo 95.ok
1317 endif
1318 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1319 echo 96.err
1320 else
1321 echo 96.ok
1322 endif
1323 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1324 echo 97.ok
1325 else
1326 echo 97.err
1327 endif
1328 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1329 echo 98.ok
1330 else
1331 echo 98.err
1332 endif
1333 __EOT
1335 check behave:if-normal 0 "${MBOX}" '1688759742 719'
1337 if have_feat regex; then
1338 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1339 set dietcurd=yoho
1340 if $dietcurd =~ '^yo.*'
1341 echo 1.ok
1342 else
1343 echo 1.err
1344 endif
1345 if $dietcurd =~ '^Yo.*'
1346 echo 1-1.err
1347 else
1348 echo 1-1.ok
1349 endif
1350 if $dietcurd @=~ '^Yo.*'
1351 echo 1-2.ok
1352 else
1353 echo 1-2.err
1354 endif
1355 if $dietcurd =~ '^yOho.+'
1356 echo 2.err
1357 else
1358 echo 2.ok
1359 endif
1360 if $dietcurd @!~ '.*Ho$'
1361 echo 3.err
1362 else
1363 echo 3.ok
1364 endif
1365 if $dietcurd !~ '.+yohO$'
1366 echo 4.ok
1367 else
1368 echo 4.err
1369 endif
1370 if [ $dietcurd @i!~ '.+yoho$' ]
1371 echo 5.ok
1372 else
1373 echo 5.err
1374 endif
1375 if ! [ $dietcurd @i=~ '.+yoho$' ]
1376 echo 6.ok
1377 else
1378 echo 6.err
1379 endif
1380 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1381 echo 7.ok
1382 else
1383 echo 7.err
1384 endif
1385 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1386 echo 8.ok
1387 else
1388 echo 8.err
1389 endif
1390 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1391 echo 9.ok
1392 else
1393 echo 9.err
1394 endif
1395 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1396 echo 10.err
1397 else
1398 echo 10.ok
1399 endif
1400 if ! ! ! $dietcurd !~ '.+yoho$'
1401 echo 11.err
1402 else
1403 echo 11.ok
1404 endif
1405 if ! ! ! $dietcurd =~ '.+yoho$'
1406 echo 12.ok
1407 else
1408 echo 12.err
1409 endif
1410 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1411 echo 13.ok
1412 else
1413 echo 13.err
1414 endif
1415 set diet=abc curd='^abc$'
1416 if $diet =~ $curd
1417 echo 14.ok
1418 else
1419 echo 14.err
1420 endif
1421 set diet=abc curd='^abcd$'
1422 if $diet !~ $curd
1423 echo 15.ok
1424 else
1425 echo 15.err
1426 endif
1427 __EOT
1429 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1430 else
1431 printf 'behave:if-regex: unsupported, skipped\n'
1434 t_epilog
1437 t_behave_localopts() {
1438 t_prolog t_behave_localopts
1440 # Nestable conditions test
1441 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1442 define t2 {
1443 echo in: t2
1444 set t2=t2
1445 echo $t2
1447 define t1 {
1448 echo in: t1
1449 set gv1=gv1
1450 localopts on
1451 set lv1=lv1 lv2=lv2
1452 set lv3=lv3
1453 call t2
1454 localopts off
1455 set gv2=gv2
1456 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1458 define t0 {
1459 echo in: t0
1460 call t1
1461 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1462 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1464 account trouble {
1465 echo in: trouble
1466 call t0
1468 call t0
1469 unset gv1 gv2
1470 account trouble
1471 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1472 account null
1473 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1476 define ll2 {
1477 localopts $1
1478 set x=2
1479 echo ll2=$x
1481 define ll1 {
1482 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1483 set x=1
1484 echo ll1.1=$x
1485 call ll2 $1
1486 echo ll1.2=$x
1488 define ll0 {
1489 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
1490 set x=0
1491 echo ll0.1=$x
1492 call ll1 $y "$@"
1493 echo ll0.2=$x
1495 define llx {
1496 echo ----- $1: $2 -> $3 -> $4
1497 echo ll-1.1=$x
1498 eval localopts $1
1499 call ll0 "$@"
1500 echo ll-1.2=$x
1501 unset x
1503 define lly {
1504 call llx 'call off' on on on
1505 call llx 'call off' off on on
1506 call llx 'call off' on off on
1507 call llx 'call off' on off off
1508 localopts call-fixate on
1509 call llx 'call-fixate on' on on on
1510 call llx 'call-fixate on' off on on
1511 call llx 'call-fixate on' on off on
1512 call llx 'call-fixate on' on off off
1513 unset x;localopts call on
1514 call llx 'call on' on on on
1515 call llx 'call on' off on on
1516 call llx 'call on' on off on
1517 call llx 'call on' on off off
1519 call lly
1520 __EOT
1522 check behave:localopts 0 "${MBOX}" '4016155249 1246'
1524 t_epilog
1527 t_behave_local() {
1528 t_prolog t_behave_local
1530 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1531 define du2 {
1532 echo du2-1 du=$du
1533 local set du=$1
1534 echo du2-2 du=$du
1535 local unset du
1536 echo du2-3 du=$du
1538 define du {
1539 local set du=dudu
1540 echo du-1 du=$du
1541 call du2 du2du2
1542 echo du-2 du=$du
1543 local set nodu
1544 echo du-3 du=$du
1546 define ich {
1547 echo ich-1 du=$du
1548 call du
1549 echo ich-2 du=$du
1551 define wir {
1552 localopts $1
1553 set du=wirwir
1554 echo wir-1 du=$du
1555 call ich
1556 echo wir-2 du=$du
1558 echo ------- global-1 du=$du
1559 call ich
1560 echo ------- global-2 du=$du
1561 set du=global
1562 call ich
1563 echo ------- global-3 du=$du
1564 call wir on
1565 echo ------- global-4 du=$du
1566 call wir off
1567 echo ------- global-5 du=$du
1568 __EOT
1570 check behave:local-1 0 "${MBOX}" '2411598140 641'
1572 t_epilog
1575 t_behave_macro_param_shift() {
1576 t_prolog t_behave_macro_param_shift
1578 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1579 define t2 {
1580 echo in: t2
1581 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1582 localopts on
1583 wysh set ignerr=$1
1584 shift
1585 localopts off
1586 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1587 if [ $# > 1 ] || [ $ignerr == '' ]
1588 shift 2
1589 else
1590 ignerr shift 2
1591 endif
1592 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1593 shift 0
1594 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1595 if [ $# > 0 ]
1596 shift
1597 endif
1598 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1600 define t1 {
1601 set errexit
1602 echo in: t1
1603 call t2 1 you get four args
1604 echo t1.1: $?';' ignerr ($ignerr) should not exist
1605 call t2 1 you get 'three args'
1606 echo t1.2: $?';' ignerr ($ignerr) should not exist
1607 call t2 1 you 'get two args'
1608 echo t1.3: $?';' ignerr ($ignerr) should not exist
1609 call t2 1 'you get one arg'
1610 echo t1.4: $?';' ignerr ($ignerr) should not exist
1611 ignerr call t2 '' 'you get one arg'
1612 echo t1.5: $?';' ignerr ($ignerr) should not exist
1614 call t1
1615 __EOT
1617 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1619 t_epilog
1622 t_behave_addrcodec() {
1623 t_prolog t_behave_addrcodec
1625 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1626 vput addrcodec res e 1 <doog@def>
1627 echo $?/$^ERRNAME $res
1628 eval vput addrcodec res d $res
1629 echo $?/$^ERRNAME $res
1630 vput addrcodec res e 2 . <doog@def>
1631 echo $?/$^ERRNAME $res
1632 eval vput addrcodec res d $res
1633 echo $?/$^ERRNAME $res
1634 vput addrcodec res e 3 Sauer Dr. <doog@def>
1635 echo $?/$^ERRNAME $res
1636 eval vput addrcodec res d $res
1637 echo $?/$^ERRNAME $res
1638 vput addrcodec res e 3.50 Sauer (Ma) Dr. <doog@def>
1639 echo $?/$^ERRNAME $res
1640 eval vput addrcodec res d $res
1641 echo $?/$^ERRNAME $res
1642 vput addrcodec res e 3.51 Sauer (Ma) "Dr." <doog@def>
1643 echo $?/$^ERRNAME $res
1644 eval vput addrcodec res d $res
1645 echo $?/$^ERRNAME $res
1647 vput addrcodec res +e 4 Sauer (Ma) Dr. <doog@def>
1648 echo $?/$^ERRNAME $res
1649 eval vput addrcodec res d $res
1650 echo $?/$^ERRNAME $res
1651 vput addrcodec res +e 5 Sauer (Ma) Braten Dr. <doog@def>
1652 echo $?/$^ERRNAME $res
1653 eval vput addrcodec res d $res
1654 echo $?/$^ERRNAME $res
1655 vput addrcodec res +e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1656 echo $?/$^ERRNAME $res
1657 eval vput addrcodec res d $res
1658 echo $?/$^ERRNAME $res
1659 vput addrcodec res +e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1660 echo $?/$^ERRNAME $res
1661 eval vput addrcodec res d $res
1662 echo $?/$^ERRNAME $res
1663 vput addrcodec res +e 8 \
1664 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1665 echo $?/$^ERRNAME $res
1666 eval vput addrcodec res d $res
1667 echo $?/$^ERRNAME $res
1668 vput addrcodec res +e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1669 echo $?/$^ERRNAME $res
1670 eval vput addrcodec res d $res
1671 echo $?/$^ERRNAME $res
1672 vput addrcodec res +e 10 (Ma)Braten Dr. (Heu) <doog@def>
1673 echo $?/$^ERRNAME $res
1674 eval vput addrcodec res d $res
1675 echo $?/$^ERRNAME $res
1676 vput addrcodec res +e 11 (Ma)Braten Dr"." (Heu) <doog@def>
1677 echo $?/$^ERRNAME $res
1678 eval vput addrcodec res d $res
1679 echo $?/$^ERRNAME $res
1680 vput addrcodec res +e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1681 echo $?/$^ERRNAME $res
1682 eval vput addrcodec res d $res
1683 echo $?/$^ERRNAME $res
1684 vput addrcodec res +e 13(Ma)Braten Dr. (Heu) <doog@def>
1685 echo $?/$^ERRNAME $res
1686 eval vput addrcodec res d $res
1687 echo $?/$^ERRNAME $res
1688 vput addrcodec res +e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1689 echo $?/$^ERRNAME $res
1690 eval vput addrcodec res d $res
1691 echo $?/$^ERRNAME $res
1692 vput addrcodec res +e 15 \
1693 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1694 echo $?/$^ERRNAME $res
1695 eval vput addrcodec res d $res
1696 echo $?/$^ERRNAME $res
1697 vput addrcodec res +e 16 \
1698 "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 17 \
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 18 \
1708 <doog@def> "Hey" Du "Wie() findet " " Dr. """ das? ()
1709 echo $?/$^ERRNAME $res
1710 eval vput addrcodec res d $res
1711 echo $?/$^ERRNAME $res
1712 vput addrcodec res +e 19 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1713 echo $?/$^ERRNAME $res
1714 eval vput addrcodec res d $res
1715 echo $?/$^ERRNAME $res
1717 vput addrcodec res ++e 20 Hey\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1718 echo $?/$^ERRNAME $res
1719 vput addrcodec res ++e 21 Hey\,\"" <doog@def> "Wie()" findet \" Dr. \" das?
1720 echo $?/$^ERRNAME $res
1721 eval vput addrcodec res d $res
1722 echo $?/$^ERRNAME $res
1724 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie()" findet \" Dr. \" das?
1725 echo $?/$^ERRNAME $res
1726 eval vput addrcodec res d $res
1727 echo $?/$^ERRNAME $res
1729 vput addrcodec res s \
1730 "23 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1731 echo $?/$^ERRNAME $res
1733 # Fix for [f3852f88]
1734 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot(e)d"
1735 echo $?/$^ERRNAME $res
1736 eval vput addrcodec res d $res
1737 echo $?/$^ERRNAME $res
1738 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot(e)d"
1739 echo $?/$^ERRNAME $res
1740 eval vput addrcodec res d $res
1741 echo $?/$^ERRNAME $res
1742 __EOT
1744 check behave:addrcodec-1 0 "${MBOX}" '1047317989 2612'
1746 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1747 mlist isa1@list
1748 mlsubscribe isa2@list
1750 vput addrcodec res skin Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1751 echo $?/$^ERRNAME $res
1752 vput addrcodec res skinlist Hey\\,\" <isa0@list> "Wie()" find \" Dr. \" das?
1753 echo $?/$^ERRNAME $res
1754 vput addrcodec res skin Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1755 echo $?/$^ERRNAME $res
1756 vput addrcodec res skinlist Hey\\,\" <isa1@list> "Wie()" find \" Dr. \" das?
1757 echo $?/$^ERRNAME $res
1758 vput addrcodec res skin Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1759 echo $?/$^ERRNAME $res
1760 vput addrcodec res skinlist Hey\\,\" <isa2@list> "Wie()" find \" Dr. \" das?
1761 echo $?/$^ERRNAME $res
1762 __EOT
1764 check behave:addrcodec-2 0 "${MBOX}" '1391779299 104'
1766 t_epilog
1769 t_behave_vexpr() {
1770 t_prolog t_behave_vexpr
1772 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1773 vput vexpr res = 9223372036854775807
1774 echo $?/$^ERRNAME $res
1775 vput vexpr res = 9223372036854775808
1776 echo $?/$^ERRNAME $res
1777 vput vexpr res =@ 9223372036854775808
1778 echo $?/$^ERRNAME $res
1779 vput vexpr res = -9223372036854775808
1780 echo $?/$^ERRNAME $res
1781 vput vexpr res = -9223372036854775809
1782 echo $?/$^ERRNAME $res
1783 vput vexpr res =@ -9223372036854775809
1784 echo $?/$^ERRNAME $res
1785 echo ' #1'
1786 vput vexpr res ~ 0
1787 echo $?/$^ERRNAME $res
1788 vput vexpr res ~ 1
1789 echo $?/$^ERRNAME $res
1790 vput vexpr res ~ -1
1791 echo $?/$^ERRNAME $res
1792 echo ' #2'
1793 vput vexpr res + 0 0
1794 echo $?/$^ERRNAME $res
1795 vput vexpr res + 0 1
1796 echo $?/$^ERRNAME $res
1797 vput vexpr res + 1 1
1798 echo $?/$^ERRNAME $res
1799 echo ' #3'
1800 vput vexpr res + 9223372036854775807 0
1801 echo $?/$^ERRNAME $res
1802 vput vexpr res + 9223372036854775807 1
1803 echo $?/$^ERRNAME $res
1804 vput vexpr res +@ 9223372036854775807 1
1805 echo $?/$^ERRNAME $res
1806 vput vexpr res + 0 9223372036854775807
1807 echo $?/$^ERRNAME $res
1808 vput vexpr res + 1 9223372036854775807
1809 echo $?/$^ERRNAME $res
1810 vput vexpr res +@ 1 9223372036854775807
1811 echo $?/$^ERRNAME $res
1812 echo ' #4'
1813 vput vexpr res + -9223372036854775808 0
1814 echo $?/$^ERRNAME $res
1815 vput vexpr res + -9223372036854775808 -1
1816 echo $?/$^ERRNAME $res
1817 vput vexpr res +@ -9223372036854775808 -1
1818 echo $?/$^ERRNAME $res
1819 vput vexpr res + 0 -9223372036854775808
1820 echo $?/$^ERRNAME $res
1821 vput vexpr res + -1 -9223372036854775808
1822 echo $?/$^ERRNAME $res
1823 vput vexpr res +@ -1 -9223372036854775808
1824 echo $?/$^ERRNAME $res
1825 echo ' #5'
1826 vput vexpr res - 0 0
1827 echo $?/$^ERRNAME $res
1828 vput vexpr res - 0 1
1829 echo $?/$^ERRNAME $res
1830 vput vexpr res - 1 1
1831 echo $?/$^ERRNAME $res
1832 echo ' #6'
1833 vput vexpr res - 9223372036854775807 0
1834 echo $?/$^ERRNAME $res
1835 vput vexpr res - 9223372036854775807 -1
1836 echo $?/$^ERRNAME $res
1837 vput vexpr res -@ 9223372036854775807 -1
1838 echo $?/$^ERRNAME $res
1839 vput vexpr res - 0 9223372036854775807
1840 echo $?/$^ERRNAME $res
1841 vput vexpr res - -1 9223372036854775807
1842 echo $?/$^ERRNAME $res
1843 vput vexpr res - -2 9223372036854775807
1844 echo $?/$^ERRNAME $res
1845 vput vexpr res -@ -2 9223372036854775807
1846 echo $?/$^ERRNAME $res
1847 echo ' #7'
1848 vput vexpr res - -9223372036854775808 +0
1849 echo $?/$^ERRNAME $res
1850 vput vexpr res - -9223372036854775808 +1
1851 echo $?/$^ERRNAME $res
1852 vput vexpr res -@ -9223372036854775808 +1
1853 echo $?/$^ERRNAME $res
1854 vput vexpr res - 0 -9223372036854775808
1855 echo $?/$^ERRNAME $res
1856 vput vexpr res - +1 -9223372036854775808
1857 echo $?/$^ERRNAME $res
1858 vput vexpr res -@ +1 -9223372036854775808
1859 echo $?/$^ERRNAME $res
1860 echo ' #8'
1861 vput vexpr res + -13 -2
1862 echo $?/$^ERRNAME $res
1863 vput vexpr res - 0 0
1864 echo $?/$^ERRNAME $res
1865 vput vexpr res - 0 1
1866 echo $?/$^ERRNAME $res
1867 vput vexpr res - 1 1
1868 echo $?/$^ERRNAME $res
1869 vput vexpr res - -13 -2
1870 echo $?/$^ERRNAME $res
1871 echo ' #9'
1872 vput vexpr res * 0 0
1873 echo $?/$^ERRNAME $res
1874 vput vexpr res * 0 1
1875 echo $?/$^ERRNAME $res
1876 vput vexpr res * 1 1
1877 echo $?/$^ERRNAME $res
1878 vput vexpr res * -13 -2
1879 echo $?/$^ERRNAME $res
1880 echo ' #10'
1881 vput vexpr res / 0 0
1882 echo $?/$^ERRNAME $res
1883 vput vexpr res / 0 1
1884 echo $?/$^ERRNAME $res
1885 vput vexpr res / 1 1
1886 echo $?/$^ERRNAME $res
1887 vput vexpr res / -13 -2
1888 echo $?/$^ERRNAME $res
1889 echo ' #11'
1890 vput vexpr res % 0 0
1891 echo $?/$^ERRNAME $res
1892 vput vexpr res % 0 1
1893 echo $?/$^ERRNAME $res
1894 vput vexpr res % 1 1
1895 echo $?/$^ERRNAME $res
1896 vput vexpr res % -13 -2
1897 echo $?/$^ERRNAME $res
1898 __EOT
1900 check behave:vexpr-numeric 0 "${MBOX}" '1723609217 1048'
1902 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1903 vput vexpr res find 'bananarama' 'nana'
1904 echo $?/$^ERRNAME :$res:
1905 vput vexpr res find 'bananarama' 'bana'
1906 echo $?/$^ERRNAME :$res:
1907 vput vexpr res find 'bananarama' 'Bana'
1908 echo $?/$^ERRNAME :$res:
1909 vput vexpr res find 'bananarama' 'rama'
1910 echo $?/$^ERRNAME :$res:
1911 echo ' #1'
1912 vput vexpr res ifind 'bananarama' 'nana'
1913 echo $?/$^ERRNAME :$res:
1914 vput vexpr res ifind 'bananarama' 'bana'
1915 echo $?/$^ERRNAME :$res:
1916 vput vexpr res ifind 'bananarama' 'Bana'
1917 echo $?/$^ERRNAME :$res:
1918 vput vexpr res ifind 'bananarama' 'rama'
1919 echo $?/$^ERRNAME :$res:
1920 echo ' #2'
1921 vput vexpr res substring 'bananarama' 1
1922 echo $?/$^ERRNAME :$res:
1923 vput vexpr res substring 'bananarama' 3
1924 echo $?/$^ERRNAME :$res:
1925 vput vexpr res substring 'bananarama' 5
1926 echo $?/$^ERRNAME :$res:
1927 vput vexpr res substring 'bananarama' 7
1928 echo $?/$^ERRNAME :$res:
1929 vput vexpr res substring 'bananarama' 9
1930 echo $?/$^ERRNAME :$res:
1931 vput vexpr res substring 'bananarama' 10
1932 echo $?/$^ERRNAME :$res:
1933 vput vexpr res substring 'bananarama' 1 3
1934 echo $?/$^ERRNAME :$res:
1935 vput vexpr res substring 'bananarama' 3 3
1936 echo $?/$^ERRNAME :$res:
1937 vput vexpr res substring 'bananarama' 5 3
1938 echo $?/$^ERRNAME :$res:
1939 vput vexpr res substring 'bananarama' 7 3
1940 echo $?/$^ERRNAME :$res:
1941 vput vexpr res substring 'bananarama' 9 3
1942 echo $?/$^ERRNAME :$res:
1943 vput vexpr res substring 'bananarama' 10 3
1944 echo $?/$^ERRNAME :$res:
1945 echo ' #3'
1946 vput vexpr res substring 'bananarama' -1
1947 echo $?/$^ERRNAME :$res:
1948 vput vexpr res substring 'bananarama' -3
1949 echo $?/$^ERRNAME :$res:
1950 vput vexpr res substring 'bananarama' -5
1951 echo $?/$^ERRNAME :$res:
1952 vput vexpr res substring 'bananarama' -7
1953 echo $?/$^ERRNAME :$res:
1954 vput vexpr res substring 'bananarama' -9
1955 echo $?/$^ERRNAME :$res:
1956 vput vexpr res substring 'bananarama' -10
1957 echo $?/$^ERRNAME :$res:
1958 vput vexpr res substring 'bananarama' 1 -3
1959 echo $?/$^ERRNAME :$res:
1960 vput vexpr res substring 'bananarama' 3 -3
1961 echo $?/$^ERRNAME :$res:
1962 vput vexpr res substring 'bananarama' 5 -3
1963 echo $?/$^ERRNAME :$res:
1964 vput vexpr res substring 'bananarama' 7 -3
1965 echo $?/$^ERRNAME :$res:
1966 vput vexpr res substring 'bananarama' 9 -3
1967 echo $?/$^ERRNAME :$res:
1968 vput vexpr res substring 'bananarama' 10 -3
1969 echo $?/$^ERRNAME :$res:
1970 echo ' #4'
1971 vput vexpr res trim 'Cocoon Cocoon'
1972 echo $?/$^ERRNAME :$res:
1973 vput vexpr res trim ' Cocoon Cocoon '
1974 echo $?/$^ERRNAME :$res:
1975 vput vexpr res trim-front 'Cocoon Cocoon'
1976 echo $?/$^ERRNAME :$res:
1977 vput vexpr res trim-front ' Cocoon Cocoon '
1978 echo $?/$^ERRNAME :$res:
1979 vput vexpr res trim-end 'Cocoon Cocoon'
1980 echo $?/$^ERRNAME :$res:
1981 vput vexpr res trim-end ' Cocoon Cocoon '
1982 echo $?/$^ERRNAME :$res:
1983 __EOT
1985 check behave:vexpr-string 0 "${MBOX}" '3182004322 601'
1987 if have_feat regex; then
1988 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1989 vput vexpr res regex 'bananarama' 'nana'
1990 echo $?/$^ERRNAME :$res:
1991 vput vexpr res regex 'bananarama' 'bana'
1992 echo $?/$^ERRNAME :$res:
1993 vput vexpr res regex 'bananarama' 'Bana'
1994 echo $?/$^ERRNAME :$res:
1995 vput vexpr res regex 'bananarama' 'rama'
1996 echo $?/$^ERRNAME :$res:
1997 echo ' #1'
1998 vput vexpr res iregex 'bananarama' 'nana'
1999 echo $?/$^ERRNAME :$res:
2000 vput vexpr res iregex 'bananarama' 'bana'
2001 echo $?/$^ERRNAME :$res:
2002 vput vexpr res iregex 'bananarama' 'Bana'
2003 echo $?/$^ERRNAME :$res:
2004 vput vexpr res iregex 'bananarama' 'rama'
2005 echo $?/$^ERRNAME :$res:
2006 echo ' #2'
2007 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2008 echo $?/$^ERRNAME :$res:
2009 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2010 echo $?/$^ERRNAME :$res:
2011 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
2012 echo $?/$^ERRNAME :$res:
2013 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
2014 echo $?/$^ERRNAME :$res:
2015 echo ' #3'
2016 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
2017 echo $?/$^ERRNAME :$res:
2018 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
2019 echo $?/$^ERRNAME :$res:
2020 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
2021 echo $?/$^ERRNAME :$res:
2022 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
2023 echo $?/$^ERRNAME :$res:
2024 echo ' #4'
2025 __EOT
2027 check behave:vexpr-regex 0 "${MBOX}" '3270360157 311'
2028 else
2029 printf 'behave:vexpr-regex: unsupported, skipped\n'
2032 t_epilog
2035 t_behave_call_ret() {
2036 t_prolog t_behave_call_ret
2038 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2039 define w1 {
2040 echon ">$1 "
2041 vput vexpr i + $1 1
2042 if [ $i -le 42 ]
2043 vput vexpr j '&' $i 7
2044 if [ $j -eq 7 ]
2045 echo .
2047 call w1 $i
2048 wysh set i=$? k=$!
2049 vput vexpr j '&' $i 7
2050 echon "<$1/$i/$k "
2051 if [ $j -eq 7 ]
2052 echo .
2054 else
2055 echo ! The end for $1
2057 return $1
2059 # Transport $?/$! up the call chain
2060 define w2 {
2061 echon ">$1 "
2062 vput vexpr i + $1 1
2063 if [ $1 -lt 42 ]
2064 call w2 $i
2065 wysh set i=$? j=$! k=$^ERRNAME
2066 echon "<$1/$i/$k "
2067 return $i $j
2068 else
2069 echo ! The end for $1
2070 return $i $^ERR-BUSY
2072 echoerr au
2074 # Up and down it goes
2075 define w3 {
2076 echon ">$1/$2 "
2077 vput vexpr i + $1 1
2078 if [ $1 -lt 42 ]
2079 call w3 $i $2
2080 wysh set i=$? j=$!
2081 vput vexpr k - $1 $2
2082 if [ $k -eq 21 ]
2083 vput vexpr i + $1 1
2084 vput vexpr j + $2 1
2085 echo "# <$i/$j> .. "
2086 call w3 $i $j
2087 wysh set i=$? j=$!
2089 eval echon "<\$1=\$i/\$^ERRNAME-$j "
2090 return $i $j
2091 else
2092 echo ! The end for $1=$i/$2
2093 if [ "$2" != "" ]
2094 return $i $^ERR-DOM
2095 else
2096 return $i $^ERR-BUSY
2099 echoerr au
2102 call w1 0; echo ?=$? !=$!; echo -----;
2103 call w2 0; echo ?=$? !=$^ERRNAME; echo -----;
2104 call w3 0 1; echo ?=$? !=$^ERRNAME; echo -----;
2105 __EOT
2107 check behave:call_ret 0 "${MBOX}" '1572045517 5922'
2109 t_epilog
2112 t_behave_xcall() {
2113 t_prolog t_behave_xcall
2115 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
2116 define work {
2117 echon "$1 "
2118 vput vexpr i + $1 1
2119 if [ $i -le 1111 ]
2120 vput vexpr j '&' $i 7
2121 if [ $j -eq 7 ]
2122 echo .
2124 \xcall work $i $2
2126 echo ! The end for $1/$2
2127 if [ "$2" != "" ]
2128 return $i $^ERR-BUSY
2131 define xwork {
2132 \xcall work 0 $2
2134 call work 0
2135 echo ?=$? !=$!
2136 call xwork
2137 echo ?=$? !=$!
2138 xcall xwork
2139 echo ?=$? !=$^ERRNAME
2141 call work 0 yes
2142 echo ?=$? !=$^ERRNAME
2143 call xwork 0 yes
2144 echo ?=$? !=$^ERRNAME
2145 __EOT
2147 check behave:xcall-1 0 "${MBOX}" '2401702082 23801'
2151 ${cat} <<- '__EOT' > "${BODY}"
2152 define __w {
2153 echon "$1 "
2154 vput vexpr i + $1 1
2155 if [ $i -le 111 ]
2156 vput vexpr j '&' $i 7
2157 if [ $j -eq 7 ]
2158 echo .
2160 \xcall __w $i $2
2162 echo ! The end for $1
2163 if [ $2 -eq 0 ]
2164 nonexistingcommand
2165 echo would be err with errexit
2166 return
2168 echo calling exit
2169 exit
2171 define work {
2172 echo eins
2173 call __w 0 0
2174 echo zwei, ?=$? !=$!
2175 localopts yes; set errexit
2176 ignerr call __w 0 0
2177 echo drei, ?=$? !=$^ERRNAME
2178 call __w 0 $1
2179 echo vier, ?=$? !=$^ERRNAME, this is an error
2181 ignerr call work 0
2182 echo outer 1, ?=$? !=$^ERRNAME
2183 xxxign call work 0
2184 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
2185 call work 1
2186 echo outer 3, ?=$? !=$^ERRNAME
2187 echo this is definitely an error
2188 __EOT
2190 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
2191 > "${MBOX}" 2>&1
2192 check behave:xcall-2 0 "${MBOX}" '3900716531 4200'
2194 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
2195 > "${MBOX}" 2>&1
2196 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
2198 t_epilog
2201 t_behave_vpospar() {
2202 t_prolog t_behave_vpospar
2204 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2205 vpospar set hey, "'you ", world!
2206 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2207 vput vpospar x quote; echo x<$x>
2208 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2209 vput vpospar y quote;echo y<$y>
2210 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2211 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2212 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2214 define infun2 {
2215 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2216 vput vpospar z quote;echo infun2:z<$z>
2219 define infun {
2220 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2221 vput vpospar y quote;echo infun:y<$y>
2222 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2223 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2224 eval call infun2 $x
2225 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2226 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
2229 call infun This "in a" fun
2230 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2231 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2232 __EOT
2233 check behave:vpospar-1 0 "${MBOX}" '155175639 866'
2236 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2237 set ifs=\'
2238 echo ifs<$ifs> ifs-ws<$ifs-ws>
2239 vpospar set hey, "'you ", world!
2240 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2241 vput vpospar x quote; echo x<$x>
2242 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2243 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2245 set ifs=,
2246 echo ifs<$ifs> ifs-ws<$ifs-ws>
2247 vpospar set hey, "'you ", world!
2248 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2249 set ifs=,
2250 vput vpospar x quote; echo x<$x>
2251 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2252 eval vpospar set ${x};\
2253 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2255 wysh set ifs=$',\t'
2256 echo ifs<$ifs> ifs-ws<$ifs-ws>
2257 vpospar set hey, "'you ", world!
2258 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2259 wysh set ifs=$',\t'
2260 vput vpospar x quote; echo x<$x>
2261 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2262 eval vpospar set ${x};\
2263 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
2264 __EOT
2265 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
2267 t_epilog
2270 t_behave_atxplode() {
2271 t_prolog t_behave_atxplode
2272 TRAP_EXIT_ADDONS="./.t*"
2274 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
2275 x() { echo $#; }
2276 xxx() {
2277 printf " (1/$#: <$1>)"
2278 shift
2279 if [ $# -gt 0 ]; then
2280 xxx "$@"
2281 else
2282 echo
2285 yyy() {
2286 eval "$@ ' ball"
2288 set --
2289 x "$@"
2290 x "$@"''
2291 x " $@"
2292 x "$@ "
2293 printf yyy;yyy 'xxx' "b\$'\t'u ' "
2294 printf xxx;xxx arg ,b u.
2295 printf xxx;xxx arg , .
2296 printf xxx;xxx arg ,ball.
2298 define x {
2299 echo $#
2301 define xxx {
2302 echon " (1/$#: <$1>)"
2303 shift
2304 if [ $# -gt 0 ]
2305 \xcall xxx "$@"
2306 endif
2307 echo
2309 define yyy {
2310 eval "$@ ' ball"
2312 vpospar set
2313 call x "$@"
2314 call x "$@"''
2315 call x " $@"
2316 call x "$@ "
2317 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
2318 echon xxx;call xxx arg ,b u.
2319 echon xxx;call xxx arg , .
2320 echon xxx;call xxx arg ,ball.
2323 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
2324 check behave:atxplode-1 0 "${MBOX}" '41566293 164'
2326 #${SHELL} ./.t.sh > ./.tshout 2>&1
2327 #check behave:atxplode:disproof-1 0 ./.tshout '41566293 164'
2329 t_epilog
2332 t_behave_read() {
2333 t_prolog t_behave_read
2334 TRAP_EXIT_ADDONS="./.t*"
2336 ${cat} <<- '__EOT' > .tin
2337 hey1, "'you ", world!
2338 hey2, "'you ", bugs bunny!
2339 hey3, "'you ",
2340 hey4, "'you "
2341 __EOT
2343 ${cat} <<- '__EOT' |\
2344 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
2345 read a b c
2346 echo $?/$^ERRNAME / <$a><$b><$c>
2347 read a b c
2348 echo $?/$^ERRNAME / <$a><$b><$c>
2349 read a b c
2350 echo $?/$^ERRNAME / <$a><$b><$c>
2351 read a b c
2352 echo $?/$^ERRNAME / <$a><$b><$c>
2353 unset a b c;read a b c
2354 echo $?/$^ERRNAME / <$a><$b><$c>
2355 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
2356 __EOT
2357 check behave:read-1 0 "${MBOX}" '1527910147 173'
2359 ${cat} <<- '__EOT' > .tin2
2360 hey2.0,:"'you ",:world!:mars.:
2361 hey2.1,:"'you ",:world!
2362 hey2.2,:"'you ",:bugs bunny!
2363 hey2.3,:"'you ",:
2364 hey2.4,:"'you ":
2366 __EOT
2368 ${cat} <<- '__EOT' |\
2369 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2370 set ifs=:
2371 read a b c
2372 echo $?/$^ERRNAME / <$a><$b><$c>
2373 read a b c
2374 echo $?/$^ERRNAME / <$a><$b><$c>
2375 read a b c
2376 echo $?/$^ERRNAME / <$a><$b><$c>
2377 read a b c
2378 echo $?/$^ERRNAME / <$a><$b><$c>
2379 read a b c
2380 echo $?/$^ERRNAME / <$a><$b><$c>
2381 read a b c
2382 echo $?/$^ERRNAME / <$a><$b><$c>
2383 unset a b c;read a b c
2384 echo $?/$^ERRNAME / <$a><$b><$c>
2385 read a b c
2386 echo $?/$^ERRNAME / <$a><$b><$c>
2387 readctl remove 6;echo readctl remove:$?/$^ERRNAME
2388 __EOT
2389 check behave:read-ifs 0 "${MBOX}" '890153490 298'
2391 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
2392 readctl create .tin
2393 readall d; echo $?/$^ERRNAME / <$d>
2394 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2395 readctl create .tin2
2396 readall d; echo $?/$^ERRNAME / <$d>
2397 wysh set d;readall d;echo $?/$^ERRNAME / <$d>
2398 readctl remove .tin;echo $?/$^ERRNAME;\
2399 readctl remove .tin2;echo $?/$^ERRNAME
2400 __EOT
2401 check behave:readall 0 "${MBOX}" '860434889 333'
2403 t_epilog
2406 t_behave_mbox() {
2407 t_prolog t_behave_mbox
2408 TRAP_EXIT_ADDONS="./.t*"
2412 while [ ${i} -lt 112 ]; do
2413 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2414 "${MBOX}" "${i}" "${i}"
2415 i=`add ${i} 1`
2416 done
2417 ) | ${MAILX} ${ARGS}
2418 check behave:mbox-1 0 "${MBOX}" '1140119864 13780'
2420 printf 'File "%s"\ncopy * "%s"\nFile "%s"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
2421 ${MAILX} ${ARGS} > .tlst
2422 check behave:mbox-2 0 .tlst '2739893312 9103'
2424 printf 'File "%s"\ncopy * "file://%s"\nFile "file://%s"\nfrom*' \
2425 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} > .tlst
2426 check behave:mbox-3 0 .tlst '1702194178 9110'
2428 # only the odd (even)
2430 printf 'File "file://%s"\ncopy ' .tmbox2
2432 while [ ${i} -lt 112 ]; do
2433 j=`modulo ${i} 2`
2434 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2435 i=`add ${i} 1`
2436 done
2437 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
2438 ) | ${MAILX} ${ARGS} > .tlst
2439 check behave:mbox-4 0 .tmbox3 '631132924 6890'
2440 check behave:mbox-5 - .tlst '2960975049 4573'
2441 # ...
2443 printf 'file "file://%s"\nmove ' .tmbox2
2445 while [ ${i} -lt 112 ]; do
2446 j=`modulo ${i} 2`
2447 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2448 i=`add ${i} 1`
2449 done
2450 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
2451 .tmbox3 .tmbox3 .tmbox2
2452 ) | ${MAILX} ${ARGS} > .tlst
2453 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2454 ${sed} 2d < .tlst > .tlstx
2455 check behave:mbox-7 - .tlstx '2729940494 13645'
2457 t_epilog
2460 t_behave_maildir() {
2461 t_prolog t_behave_maildir
2462 TRAP_EXIT_ADDONS="./.t*"
2466 while [ ${i} -lt 112 ]; do
2467 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2468 "${MBOX}" "${i}" "${i}"
2469 i=`add ${i} 1`
2470 done
2471 ) | ${MAILX} ${ARGS}
2472 check behave:maildir-1 0 "${MBOX}" '1140119864 13780'
2474 printf 'File "%s"
2475 copy * "%s"
2476 File "%s"
2477 from*
2478 ' "${MBOX}" .tmdir1 .tmdir1 |
2479 ${MAILX} ${ARGS} -Snewfolders=maildir > .tlst
2480 check behave:maildir-2 0 .tlst '1797938753 9103'
2482 printf 'File "%s"
2483 copy * "maildir://%s"
2484 File "maildir://%s"
2485 from*
2486 ' "${MBOX}" .tmdir2 .tmdir2 |
2487 ${MAILX} ${ARGS} > .tlst
2488 check behave:maildir-3 0 .tlst '1155631089 9113'
2490 printf 'File "maildir://%s"
2491 copy * "file://%s"
2492 File "file://%s"
2493 from*
2494 ' .tmdir2 .tmbox1 .tmbox1 |
2495 ${MAILX} ${ARGS} > .tlst
2496 check behave:maildir-4 0 .tmbox1 '2646131190 13220'
2497 check behave:maildir-5 - .tlst '3701297796 9110'
2499 # only the odd (even)
2501 printf 'File "maildir://%s"
2502 copy ' .tmdir2
2504 while [ ${i} -lt 112 ]; do
2505 j=`modulo ${i} 2`
2506 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2507 i=`add ${i} 1`
2508 done
2509 printf ' file://%s
2510 File "file://%s"
2511 from*
2512 ' .tmbox2 .tmbox2
2513 ) | ${MAILX} ${ARGS} > .tlst
2514 check behave:maildir-6 0 .tmbox2 '142890131 6610'
2515 check behave:maildir-7 - .tlst '960096773 4573'
2516 # ...
2518 printf 'file "maildir://%s"
2519 move ' .tmdir2
2521 while [ ${i} -lt 112 ]; do
2522 j=`modulo ${i} 2`
2523 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2524 i=`add ${i} 1`
2525 done
2526 printf ' file://%s
2527 File "file://%s"
2528 from*
2529 File "maildir://%s"
2530 from*
2531 ' .tmbox2 .tmbox2 .tmdir2
2532 ) | ${MAILX} ${ARGS} > .tlst
2533 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
2534 ${sed} 2d < .tlst > .tlstx
2535 check behave:maildir-9 - .tlstx '4216815295 13645'
2537 t_epilog
2540 t_behave_record_a_resend() {
2541 t_prolog t_behave_record_a_resend
2542 TRAP_EXIT_ADDONS="./.t.record ./.t.resent"
2544 printf '
2545 set record=%s
2546 m %s\n~s Subject 1.\nHello.\n~.
2547 set record-files add-file-recipients
2548 m %s\n~s Subject 2.\nHello.\n~.
2549 File %s
2550 resend 2 ./.t.resent
2551 Resend 1 ./.t.resent
2552 set record-resent
2553 resend 2 ./.t.resent
2554 Resend 1 ./.t.resent
2555 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2556 ${MAILX} ${ARGS}
2558 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2559 check behave:record_a_resend-2 - .t.record '391356429 460'
2560 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2562 t_epilog
2565 t_behave_e_H_L_opts() {
2566 t_prolog t_behave_e_H_L_opts
2567 TRAP_EXIT_ADDONS="./.tsendmail.sh ./.t.mbox"
2569 touch ./.t.mbox
2570 ${MAILX} ${ARGS} -ef ./.t.mbox
2571 echo ${?} > "${MBOX}"
2573 ${cat} <<-_EOT > ./.tsendmail.sh
2574 #!${SHELL} -
2575 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2576 ) >> "./.t.mbox"
2577 _EOT
2578 chmod 0755 ./.tsendmail.sh
2579 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2580 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2581 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2582 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2584 ${MAILX} ${ARGS} -ef ./.t.mbox
2585 echo ${?} >> "${MBOX}"
2586 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2587 echo ${?} >> "${MBOX}"
2588 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2589 echo ${?} >> "${MBOX}"
2590 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2591 echo ${?} >> "${MBOX}"
2592 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2593 echo ${?} >> "${MBOX}"
2594 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2595 echo ${?} >> "${MBOX}"
2596 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2597 echo ${?} >> "${MBOX}"
2599 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2600 echo ${?} >> "${MBOX}"
2601 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2602 echo ${?} >> "${MBOX}"
2603 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2604 echo ${?} >> "${MBOX}"
2605 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2606 echo ${?} >> "${MBOX}"
2607 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2608 echo ${?} >> "${MBOX}"
2609 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2610 echo ${?} >> "${MBOX}"
2611 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev/null
2612 echo ${?} >> "${MBOX}"
2614 check behave:e_H_L_opts - "${MBOX}" '1708955574 678'
2616 t_epilog
2619 t_behave_alternates() {
2620 t_prolog t_behave_alternates
2621 TRAP_EXIT_ADDONS="./.t*"
2623 ${cat} <<-_EOT > ./.tsendmail.sh
2624 #!${SHELL} -
2625 (echo 'From Valeriana Sat Jul 08 15:54:03 2017' && ${cat} && echo
2626 ) >> "${MBOX}"
2627 _EOT
2628 chmod 0755 ./.tsendmail.sh
2630 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2631 echo --0
2632 alternates
2633 echo $?/$^ERRNAME
2634 alternates a1@b1 a2@b2 a3@b3
2635 echo $?/$^ERRNAME
2636 alternates
2637 echo $?/$^ERRNAME
2638 vput alternates rv
2639 echo $?/$^ERRNAME <$rv>
2641 echo --1
2642 unalternates a2@b2
2643 vput alternates rv
2644 echo $?/$^ERRNAME <$rv>
2645 unalternates a3@b3
2646 vput alternates rv
2647 echo $?/$^ERRNAME <$rv>
2648 unalternates a1@b1
2649 vput alternates rv
2650 echo $?/$^ERRNAME <$rv>
2652 echo --2
2653 unalternates *
2654 alternates a1@b1 a2@b2 a3@b3
2655 unalternates a3@b3
2656 vput alternates rv
2657 echo $?/$^ERRNAME <$rv>
2658 unalternates a2@b2
2659 vput alternates rv
2660 echo $?/$^ERRNAME <$rv>
2661 unalternates a1@b1
2662 vput alternates rv
2663 echo $?/$^ERRNAME <$rv>
2665 echo --3
2666 alternates a1@b1 a2@b2 a3@b3
2667 unalternates a1@b1
2668 vput alternates rv
2669 echo $?/$^ERRNAME <$rv>
2670 unalternates a2@b2
2671 vput alternates rv
2672 echo $?/$^ERRNAME <$rv>
2673 unalternates a3@b3
2674 vput alternates rv
2675 echo $?/$^ERRNAME <$rv>
2677 echo --4
2678 unalternates *
2679 alternates a1@b1 a2@b2 a3@b3
2680 unalternates *
2681 vput alternates rv
2682 echo $?/$^ERRNAME <$rv>
2684 echo --5
2685 unalternates *
2686 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
2687 m a1@b1 a1@c1 a1@d1
2688 ~s all alternates, only a1@b1 remains
2689 ~c a2@b2
2690 ~b a3@b3 a3@c3 a3@d3
2691 ~r - '_EOT'
2692 This body is!
2693 This also body is!!
2694 _EOT
2697 echo --6
2698 unalternates *
2699 alternates a1@b1 a1@c1 a2@b2 a3@b3
2700 m a1@b1 a1@c1 a1@d1
2701 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
2702 ~c a2@b2
2703 ~b a3@b3 a3@c3 a3@d3
2704 ~r - '_EOT'
2705 This body2 is!
2706 _EOT
2709 echo --7
2710 alternates a1@b1 a2@b2 a3; set allnet
2711 m a1@b1 a1@c1 a1@d1
2712 ~s all alternates via allnet, only a1@b1 remains
2713 ~c a2@b2
2714 ~b a3@b3 a3@c3 a3@d3
2715 ~r - '_EOT'
2716 This body3 is!
2717 _EOT
2720 echo --10
2721 unalternates *
2722 alternates a1@b1
2723 echo $?/$^ERRNAME
2724 vput alternates rv
2725 echo $?/$^ERRNAME <$rv>
2726 alternates a2@b2
2727 echo $?/$^ERRNAME
2728 vput alternates rv
2729 echo $?/$^ERRNAME <$rv>
2730 alternates a3@b3
2731 echo $?/$^ERRNAME
2732 vput alternates rv
2733 echo $?/$^ERRNAME <$rv>
2734 alternates a4@b4
2735 echo $?/$^ERRNAME
2736 vput alternates rv
2737 echo $?/$^ERRNAME <$rv>
2739 unalternates *
2740 vput alternates rv
2741 echo $?/$^ERRNAME <$rv>
2743 echo --11
2744 set posix
2745 alternates a1@b1 a2@b2
2746 echo $?/$^ERRNAME
2747 vput alternates rv
2748 echo $?/$^ERRNAME <$rv>
2749 alternates a3@b3 a4@b4
2750 echo $?/$^ERRNAME
2751 vput alternates rv
2752 echo $?/$^ERRNAME <$rv>
2753 __EOT
2754 check behave:alternates-1 0 "${MBOX}" '142184864 515'
2755 check behave:alternates-2 - .tall '1878598364 505'
2757 t_epilog
2760 t_behave_alias() {
2761 t_prolog t_behave_alias
2762 TRAP_EXIT_ADDONS="./.t*"
2764 ${cat} <<-_EOT > ./.tsendmail.sh
2765 #!${SHELL} -
2766 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2767 ) >> "${MBOX}"
2768 _EOT
2769 chmod 0755 ./.tsendmail.sh
2771 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2772 alias a1 ex1@a1.ple
2773 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
2774 alias a1 ex4@a1.ple
2775 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2776 alias a3 a4
2777 alias a4 a5 ex1@a4.ple
2778 alias a5 a6
2779 alias a6 a7 ex1@a6.ple
2780 alias a7 a8
2781 alias a8 ex1@a8.ple
2782 alias a1
2783 alias a2
2784 alias a3
2785 m a1
2786 ~c a2
2787 ~b a3
2788 ~r - '_EOT'
2789 This body is!
2790 This also body is!!
2791 _EOT
2792 __EOT
2793 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2794 check behave:alias-2 - .tall '3548953204 152'
2796 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2797 # TODO need to somehow provide its contents to the test, then test
2799 t_epilog
2802 t_behave_filetype() {
2803 t_prolog t_behave_filetype
2804 TRAP_EXIT_ADDONS="./.t*"
2806 ${cat} <<-_EOT > ./.tsendmail.sh
2807 #!${SHELL} -
2808 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2809 ) >> "${MBOX}"
2810 _EOT
2811 chmod 0755 ./.tsendmail.sh
2813 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
2814 "${SRCDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2815 check behave:filetype-1 0 "${MBOX}" '1594682963 13520'
2817 if (echo | gzip -c) >/dev/null 2>&1; then
2818 ${rm} -f ./.t.mbox*
2820 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
2821 "${MBOX}" | ${MAILX} ${ARGS} \
2822 -X'filetype gz gzip\ -dc gzip\ -c'
2823 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2824 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
2825 } > ./.t.out 2>&1
2826 check behave:filetype-2 - "./.t.mbox" '1594682963 13520'
2827 check behave:filetype-3 - "./.t.out" '2392348396 102'
2828 else
2829 echo 'behave:filetype-2: unsupported, skipped'
2830 echo 'behave:filetype-3: unsupported, skipped'
2834 ${rm} -f ./.t.mbox*
2835 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
2836 copy 2 ./.t.mbox.gz
2837 copy 1 ./.t.mbox.gz
2838 copy 2 ./.t.mbox.gz
2839 ' "${MBOX}" |
2840 ${MAILX} ${ARGS} \
2841 -X'filetype gz gzip\ -dc gzip\ -c' \
2842 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
2843 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
2844 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2845 ${MAILX} ${ARGS} \
2846 -X'filetype gz gzip\ -dc gzip\ -c' \
2847 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
2848 } > ./.t.out 2>&1
2849 check behave:filetype-4 - "./.t.mbox" '2886541147 27060'
2850 check behave:filetype-5 - "./.t.out" '852335377 172'
2852 t_epilog
2855 t_behave_message_injections() {
2856 t_prolog t_behave_message_injections
2857 TRAP_EXIT_ADDONS="./.t*"
2859 ${cat} <<-_EOT > ./.tsendmail.sh
2860 #!${SHELL} -
2861 (echo 'From Echinacea Tue Jun 20 15:54:02 2017' && ${cat} && echo
2862 ) > "${MBOX}"
2863 _EOT
2864 chmod 0755 ./.tsendmail.sh
2866 echo mysig > ./.tmysig
2868 echo some-body | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh \
2869 -Smessage-inject-head=head-inject \
2870 -Smessage-inject-tail=tail-inject \
2871 -Ssignature=./.tmysig \
2872 ex@am.ple > ./.tall 2>&1
2873 check behave:message_injections-1 0 "${MBOX}" '2434746382 134'
2874 check behave:message_injections-2 - .tall '4294967295 0' # empty file
2876 ${cat} <<-_EOT > ./.template
2877 From: me
2878 To: ex1@am.ple
2879 Cc: ex2@am.ple
2880 Subject: This subject is
2882 Body, body, body me.
2883 _EOT
2884 < ./.template ${MAILX} ${ARGS} -t -Smta=./.tsendmail.sh \
2885 -Smessage-inject-head=head-inject \
2886 -Smessage-inject-tail=tail-inject \
2887 -Ssignature=./.tmysig \
2888 > ./.tall 2>&1
2889 check behave:message_injections-3 0 "${MBOX}" '3114203412 198'
2890 check behave:message_injections-4 - .tall '4294967295 0' # empty file
2892 t_epilog
2895 t_behave_compose_hooks() { # TODO monster
2896 t_prolog t_behave_compose_hooks
2897 TRAP_EXIT_ADDONS="./.t*"
2899 (echo line one&&echo line two&&echo line three) > ./.treadctl
2900 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
2902 ${cat} <<-_EOT > ./.tsendmail.sh
2903 #!${SHELL} -
2904 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat} && echo
2905 ) >> "${MBOX}"
2906 _EOT
2907 chmod 0755 ./.tsendmail.sh
2909 ${cat} <<'__EOT__' > ./.trc
2910 define bail {
2911 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
2913 define xerr {
2914 vput vexpr es substr "$1" 0 1
2915 if [ "$es" != 2 ]
2916 xcall bail "$2"
2919 define read_mline_res {
2920 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2921 echo $len/$es/$^ERRNAME: $hl
2922 if [ $es -ne $^ERR-NONE ]
2923 xcall bail read_mline_res
2924 elif [ $len -ne 0 ]
2925 \xcall read_mline_res
2928 define ins_addr {
2929 wysh set xh=$1
2930 echo "~^header list"; read hl; echo $hl;\
2931 call xerr "$hl" "in_addr ($xh) 0-1"
2933 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2934 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
2935 echo "~^header insert $xh <${xh}2@exam.ple>";\
2936 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
2937 echo "~^header insert $xh ${xh}3@exam.ple";\
2938 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
2939 echo "~^header list $xh"; read hl; echo $hl;\
2940 call xerr "$hl" "ins_addr $xh 1-4"
2941 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
2942 call read_mline_res
2944 if [ "$t_remove" == "" ]
2945 return
2948 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
2949 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
2950 if [ $es != 501 ]
2951 xcall bail "ins_addr $xh 2-2"
2953 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
2954 if [ $es != 501 ]
2955 xcall bail "ins_addr $xh 2-3"
2957 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
2958 if [ $es != 501 ]
2959 xcall bail "ins_addr $xh 2-4"
2963 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2964 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
2965 echo "~^header insert $xh <${xh}2@exam.ple>";\
2966 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
2967 echo "~^header insert $xh ${xh}3@exam.ple";\
2968 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
2969 echo "~^header list $xh"; read hl; echo $hl;\
2970 call xerr "$hl" "ins_addr $xh 3-4"
2971 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
2972 call read_mline_res
2974 echo "~^header remove-at $xh 1"; read es;\
2975 call xerr $es "ins_addr $xh 3-6"
2976 echo "~^header remove-at $xh 1"; read es;\
2977 call xerr $es "ins_addr $xh 3-7"
2978 echo "~^header remove-at $xh 1"; read es;\
2979 call xerr $es "ins_addr $xh 3-8"
2980 echo "~^header remove-at $xh 1"; read es;\
2981 vput vexpr es substr $es 0 3
2982 if [ $es != 501 ]
2983 xcall bail "ins_addr $xh 3-9"
2985 echo "~^header remove-at $xh T"; read es;\
2986 vput vexpr es substr $es 0 3
2987 if [ $es != 505 ]
2988 xcall bail "ins_addr $xh 3-10"
2990 echo "~^header list $xh"; read es;\
2991 vput vexpr es substr $es 0 3
2992 if [ $es != 501 ]
2993 xcall bail "ins_addr $xh 3-11"
2995 echo "~^header show $xh"; read es;\
2996 vput vexpr es substr $es 0 3
2997 if [ $es != 501 ]
2998 xcall bail "ins_addr $xh 3-12"
3002 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
3003 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
3004 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
3005 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
3006 echo "~^header insert $xh ${xh}3@exam.ple";\
3007 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
3008 echo "~^header list $xh"; read hl; echo $hl;\
3009 call xerr "$hl" "header list $xh 3-4"
3010 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
3011 call read_mline_res
3013 echo "~^header remove-at $xh 3"; read es;\
3014 call xerr $es "ins_addr $xh 4-6"
3015 echo "~^header remove-at $xh 2"; read es;\
3016 call xerr $es "ins_addr $xh 4-7"
3017 echo "~^header remove-at $xh 1"; read es;\
3018 call xerr $es "ins_addr $xh 4-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 4-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 4-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 4-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 4-12"
3040 define ins_ref {
3041 wysh set xh=$1 mult=$2
3042 echo "~^header list"; read hl; echo $hl;\
3043 call xerr "$hl" "ins_ref ($xh) 0-1"
3045 echo "~^header insert $xh <$xh@exam.ple>";\
3046 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
3047 if [ $mult -ne 0 ]
3048 echo "~^header insert $xh <${xh}2@exam.ple>";\
3049 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
3050 echo "~^header insert $xh ${xh}3@exam.ple";\
3051 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
3052 else
3053 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
3054 vput vexpr es substr $es 0 3
3055 if [ $es != 506 ]
3056 xcall bail "ins_ref $xh 1-4"
3060 echo "~^header list $xh"; read hl; echo $hl;\
3061 call xerr "$hl" "ins_ref $xh 1-5"
3062 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
3063 call read_mline_res
3065 if [ "$t_remove" == "" ]
3066 return
3069 echo "~^header remove $xh"; read es;\
3070 call xerr $es "ins_ref $xh 2-1"
3071 echo "~^header remove $xh"; read es;\
3072 vput vexpr es substr $es 0 3
3073 if [ $es != 501 ]
3074 xcall bail "ins_ref $xh 2-2"
3076 echo "~^header list $xh"; read es;\
3077 vput vexpr es substr $es 0 3
3078 if [ $es != 501 ]
3079 xcall bail "$es ins_ref $xh 2-3"
3081 echo "~^header show $xh"; read es;\
3082 vput vexpr es substr $es 0 3
3083 if [ $es != 501 ]
3084 xcall bail "ins_ref $xh 2-4"
3088 echo "~^header insert $xh <$xh@exam.ple>";\
3089 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
3090 if [ $mult -ne 0 ]
3091 echo "~^header insert $xh <${xh}2@exam.ple>";\
3092 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
3093 echo "~^header insert $xh ${xh}3@exam.ple";\
3094 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
3096 echo "~^header list $xh";\
3097 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
3098 echo "~^header show $xh";\
3099 read es; call xerr $es "ins_ref $xh 3-5"
3100 call read_mline_res
3102 echo "~^header remove-at $xh 1"; read es;\
3103 call xerr $es "ins_ref $xh 3-6"
3104 if [ $mult -ne 0 ] && [ $xh != subject ]
3105 echo "~^header remove-at $xh 1"; read es;\
3106 call xerr $es "ins_ref $xh 3-7"
3107 echo "~^header remove-at $xh 1"; read es;\
3108 call xerr $es "ins_ref $xh 3-8"
3110 echo "~^header remove-at $xh 1"; read es;\
3111 vput vexpr es substr $es 0 3
3112 if [ $es != 501 ]
3113 xcall bail "ins_ref $xh 3-9"
3115 echo "~^header remove-at $xh T"; read es;\
3116 vput vexpr es substr $es 0 3
3117 if [ $es != 505 ]
3118 xcall bail "ins_ref $xh 3-10"
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 3-11"
3127 echo "~^header insert $xh <$xh@exam.ple> ";\
3128 read es; echo $es; call xerr "$es" "ins_ref $xh 4-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 4-2"
3132 echo "~^header insert $xh ${xh}3@exam.ple";\
3133 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
3135 echo "~^header list $xh"; read hl; echo $hl;\
3136 call xerr "$hl" "ins_ref $xh 4-4"
3137 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
3138 call read_mline_res
3140 if [ $mult -ne 0 ] && [ $xh != subject ]
3141 echo "~^header remove-at $xh 3"; read es;\
3142 call xerr $es "ins_ref $xh 4-6"
3143 echo "~^header remove-at $xh 2"; read es;\
3144 call xerr $es "ins_ref $xh 4-7"
3146 echo "~^header remove-at $xh 1"; read es;\
3147 call xerr $es "ins_ref $xh 4-8"
3148 echo "~^header remove-at $xh 1"; read es;\
3149 vput vexpr es substr $es 0 3
3150 if [ $es != 501 ]
3151 xcall bail "ins_ref $xh 4-9"
3153 echo "~^header remove-at $xh T"; read es;\
3154 vput vexpr es substr $es 0 3
3155 if [ $es != 505 ]
3156 xcall bail "ins_ref $xh 4-10"
3158 echo "~^header show $xh"; read es;\
3159 vput vexpr es substr $es 0 3
3160 if [ $es != 501 ]
3161 xcall bail "ins_ref $xh 4-11"
3164 define t_header {
3165 echo t_header ENTER
3166 # In collect.c order
3167 call ins_addr from
3168 call ins_ref sender 0 # Not a "ref", but works
3169 call ins_addr To
3170 call ins_addr cC
3171 call ins_addr bCc
3172 call ins_addr reply-To
3173 call ins_addr mail-Followup-to
3174 call ins_ref messAge-id 0
3175 call ins_ref rEfErEncEs 1
3176 call ins_ref in-Reply-to 1
3177 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
3178 call ins_addr freeForm1
3179 call ins_addr freeform2
3181 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
3182 call read_mline_res
3183 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
3184 call read_mline_res
3186 echo t_header LEAVE
3188 define t_attach {
3189 echo t_attach ENTER
3191 echo "~^attachment";\
3192 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3193 if [ "$es" != 501 ]
3194 xcall bail "attach 0-1"
3197 echo "~^attach attribute ./.treadctl";\
3198 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3199 if [ "$es" != 501 ]
3200 xcall bail "attach 0-2"
3202 echo "~^attachment attribute-at 1";\
3203 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
3204 if [ "$es" != 501 ]
3205 xcall bail "attach 0-3"
3208 echo "~^attachment insert ./.treadctl=ascii";\
3209 read hl; echo $hl; call xerr "$hl" "attach 1-1"
3210 echo "~^attachment list";\
3211 read es; echo $es;call xerr "$es" "attach 1-2"
3212 call read_mline_res
3213 echo "~^attachment attribute ./.treadctl";\
3214 read es; echo $es;call xerr "$es" "attach 1-3"
3215 call read_mline_res
3216 echo "~^attachment attribute .treadctl";\
3217 read es; echo $es;call xerr "$es" "attach 1-4"
3218 call read_mline_res
3219 echo "~^attachment attribute-at 1";\
3220 read es; echo $es;call xerr "$es" "attach 1-5"
3221 call read_mline_res
3223 echo "~^attachment attribute-set ./.treadctl filename rctl";\
3224 read es; echo $es;call xerr "$es" "attach 1-6"
3225 echo "~^attachment attribute-set .treadctl content-description Au";\
3226 read es; echo $es;call xerr "$es" "attach 1-7"
3227 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
3228 read es; echo $es;call xerr "$es" "attach 1-8"
3230 echo "~^attachment attribute ./.treadctl";\
3231 read es; echo $es;call xerr "$es" "attach 1-9"
3232 call read_mline_res
3233 echo "~^attachment attribute .treadctl";\
3234 read es; echo $es;call xerr "$es" "attach 1-10"
3235 call read_mline_res
3236 echo "~^attachment attribute rctl";\
3237 read es; echo $es;call xerr "$es" "attach 1-11"
3238 call read_mline_res
3239 echo "~^attachment attribute-at 1";\
3240 read es; echo $es;call xerr "$es" "attach 1-12"
3241 call read_mline_res
3244 echo "~^attachment insert ./.tattach=latin1";\
3245 read hl; echo $hl; call xerr "$hl" "attach 2-1"
3246 echo "~^attachment list";\
3247 read es; echo $es;call xerr "$es" "attach 2-2"
3248 call read_mline_res
3249 echo "~^attachment attribute ./.tattach";\
3250 read es; echo $es;call xerr "$es" "attach 2-3"
3251 call read_mline_res
3252 echo "~^attachment attribute .tattach";\
3253 read es; echo $es;call xerr "$es" "attach 2-4"
3254 call read_mline_res
3255 echo "~^attachment attribute-at 2";\
3256 read es; echo $es;call xerr "$es" "attach 2-5"
3257 call read_mline_res
3259 echo "~^attachment attribute-set ./.tattach filename tat";\
3260 read es; echo $es;call xerr "$es" "attach 2-6"
3261 echo \
3262 "~^attachment attribute-set .tattach content-description Au2";\
3263 read es; echo $es;call xerr "$es" "attach 2-7"
3264 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
3265 read es; echo $es;call xerr "$es" "attach 2-8"
3266 echo \
3267 "~^attachment attribute-set-at 2 content-type application/x-sh";\
3268 read es; echo $es;call xerr "$es" "attach 2-9"
3270 echo "~^attachment attribute ./.tattach";\
3271 read es; echo $es;call xerr "$es" "attach 2-10"
3272 call read_mline_res
3273 echo "~^attachment attribute .tattach";\
3274 read es; echo $es;call xerr "$es" "attach 2-11"
3275 call read_mline_res
3276 echo "~^attachment attribute tat";\
3277 read es; echo $es;call xerr "$es" "attach 2-12"
3278 call read_mline_res
3279 echo "~^attachment attribute-at 2";\
3280 read es; echo $es;call xerr "$es" "attach 2-13"
3281 call read_mline_res
3284 if [ "$t_remove" == "" ]
3285 return
3288 echo "~^attachment remove ./.treadctl"; read es;\
3289 call xerr $es "attach 3-1"
3290 echo "~^attachment remove ./.tattach"; read es;\
3291 call xerr $es "attach 3-2"
3292 echo "~^ attachment remove ./.treadctl"; read es;\
3293 vput vexpr es substr $es 0 3
3294 if [ $es != 501 ]
3295 xcall bail "attach 3-3"
3297 echo "~^ attachment remove ./.tattach"; read es;\
3298 vput vexpr es substr $es 0 3
3299 if [ $es != 501 ]
3300 xcall bail "attach 3-4"
3302 echo "~^attachment list"; read es;\
3303 vput vexpr es substr $es 0 3
3304 if [ $es != 501 ]
3305 xcall bail "attach 3-5"
3309 echo "~^attachment insert ./.tattach=latin1";\
3310 read hl; echo $hl; call xerr "$hl" "attach 4-1"
3311 echo "~^attachment insert ./.tattach=latin1";\
3312 read hl; echo $hl; call xerr "$hl" "attach 4-2"
3313 echo "~^attachment list";\
3314 read es; echo $es;call xerr "$es" "attach 4-3"
3315 call read_mline_res
3316 echo "~^ attachment remove .tattach"; read es;\
3317 vput vexpr es substr $es 0 3
3318 if [ $es != 506 ]
3319 xcall bail "attach 4-4 $es"
3321 echo "~^attachment remove-at T"; read es;\
3322 vput vexpr es substr $es 0 3
3323 if [ $es != 505 ]
3324 xcall bail "attach 4-5"
3326 echo "~^attachment remove ./.tattach"; read es;\
3327 call xerr $es "attach 4-6"
3328 echo "~^attachment remove ./.tattach"; read es;\
3329 call xerr $es "attach 4-7"
3330 echo "~^ attachment remove ./.tattach"; read es;\
3331 vput vexpr es substr $es 0 3
3332 if [ $es != 501 ]
3333 xcall bail "attach 4-8 $es"
3335 echo "~^attachment list"; read es;\
3336 vput vexpr es substr $es 0 3
3337 if [ $es != 501 ]
3338 xcall bail "attach 4-9"
3342 echo "~^attachment insert ./.tattach=latin1";\
3343 read hl; echo $hl; call xerr "$hl" "attach 5-1"
3344 echo "~^attachment insert ./.tattach=latin1";\
3345 read hl; echo $hl; call xerr "$hl" "attach 5-2"
3346 echo "~^attachment insert ./.tattach=latin1";\
3347 read hl; echo $hl; call xerr "$hl" "attach 5-3"
3348 echo "~^attachment list";\
3349 read es; echo $es;call xerr "$es" "attach 5-4"
3350 call read_mline_res
3352 echo "~^attachment remove-at 3"; read es;\
3353 call xerr $es "attach 5-5"
3354 echo "~^attachment remove-at 3"; read es;\
3355 vput vexpr es substr $es 0 3
3356 if [ $es != 501 ]
3357 xcall bail "attach 5-6"
3359 echo "~^attachment remove-at 2"; read es;\
3360 call xerr $es "attach 5-7"
3361 echo "~^attachment remove-at 2"; read es;\
3362 vput vexpr es substr $es 0 3
3363 if [ $es != 501 ]
3364 xcall bail "attach 5-8"
3366 echo "~^attachment remove-at 1"; read es;\
3367 call xerr $es "attach 5-9"
3368 echo "~^attachment remove-at 1"; read es;\
3369 vput vexpr es substr $es 0 3
3370 if [ $es != 501 ]
3371 xcall bail "attach 5-10"
3374 echo "~^attachment list"; read es;\
3375 vput vexpr es substr $es 0 3
3376 if [ $es != 501 ]
3377 xcall bail "attach 5-11"
3381 echo "~^attachment insert ./.tattach=latin1";\
3382 read hl; echo $hl; call xerr "$hl" "attach 6-1"
3383 echo "~^attachment insert ./.tattach=latin1";\
3384 read hl; echo $hl; call xerr "$hl" "attach 6-2"
3385 echo "~^attachment insert ./.tattach=latin1";\
3386 read hl; echo $hl; call xerr "$hl" "attach 6-3"
3387 echo "~^attachment list";\
3388 read es; echo $es;call xerr "$es" "attach 6-4"
3389 call read_mline_res
3391 echo "~^attachment remove-at 1"; read es;\
3392 call xerr $es "attach 6-5"
3393 echo "~^attachment remove-at 1"; read es;\
3394 call xerr $es "attach 6-6"
3395 echo "~^attachment remove-at 1"; read es;\
3396 call xerr $es "attach 6-7"
3397 echo "~^attachment remove-at 1"; read es;\
3398 vput vexpr es substr $es 0 3
3399 if [ $es != 501 ]
3400 xcall bail "attach 6-8"
3403 echo "~^attachment list"; read es;\
3404 vput vexpr es substr $es 0 3
3405 if [ $es != 501 ]
3406 xcall bail "attach 6-9"
3409 echo t_attach LEAVE
3411 define t_ocs {
3412 read ver
3413 echo t_ocs
3414 call t_header
3415 call t_attach
3417 define t_oce {
3418 echo on-compose-enter, mailx-command<$mailx-command>
3419 alternates alter1@exam.ple alter2@exam.ple
3420 alternates
3421 set autocc='alter1@exam.ple alter2@exam.ple'
3422 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3423 echo mailx-subject<$mailx-subject>
3424 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3425 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3426 mailx-raw-bcc<$mailx-raw-bcc>
3427 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3428 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3430 define t_ocl {
3431 echo on-compose-leave, mailx-command<$mailx-command>
3432 vput alternates al
3433 eval alternates $al alter3@exam.ple alter4@exam.ple
3434 alternates
3435 set autobcc='alter3@exam.ple alter4@exam.ple'
3436 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3437 echo mailx-subject<$mailx-subject>
3438 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3439 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3440 mailx-raw-bcc<$mailx-raw-bcc>
3441 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3442 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3444 define t_occ {
3445 echo on-compose-cleanup, mailx-command<$mailx-command>
3446 unalternates *
3447 alternates
3448 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3449 echo mailx-subject<$mailx-subject>
3450 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3451 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3452 mailx-raw-bcc<$mailx-raw-bcc>
3453 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
3454 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3456 wysh set on-compose-splice=t_ocs \
3457 on-compose-enter=t_oce on-compose-leave=t_ocl \
3458 on-compose-cleanup=t_occ
3459 __EOT__
3461 ${rm} -f "${MBOX}"
3462 printf 'm this-goes@nowhere\nbody\n!.\n' |
3463 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3464 -X'source ./.trc' -Smta=./.tsendmail.sh \
3465 >./.tall 2>&1
3466 ${cat} ./.tall >> "${MBOX}"
3467 check behave:compose_hooks-1 0 "${MBOX}" '522535560 10101'
3469 ${rm} -f "${MBOX}"
3470 printf 'm this-goes@nowhere\nbody\n!.\n' |
3471 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3472 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh \
3473 >./.tall 2>&1
3474 ${cat} ./.tall >> "${MBOX}"
3475 check behave:compose_hooks-2 0 "${MBOX}" '3654000499 12535'
3479 # Some state machine stress, shell compose hook, localopts for hook, etc.
3480 # readctl in child. ~r as HERE document
3481 ${rm} -f "${MBOX}"
3482 printf 'm ex@am.ple\nbody\n!.
3483 echon ${mailx-command}${mailx-subject}
3484 echon ${mailx-from}${mailx-sender}
3485 echon ${mailx-to}${mailx-cc}${mailx-bcc}
3486 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
3487 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
3488 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
3489 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3490 -Smta=./.tsendmail.sh \
3492 define bail {
3493 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3495 define xerr {
3496 vput vexpr es substr "$1" 0 1
3497 if [ "$es" != 2 ]
3498 xcall bail "$2"
3501 define read_mline_res {
3502 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3503 echo $len/$es/$^ERRNAME: $hl
3504 if [ $es -ne $^ERR-NONE ]
3505 xcall bail read_mline_res
3506 elif [ $len -ne 0 ]
3507 \xcall read_mline_res
3510 define _work {
3511 vput vexpr i + 1 "$2"
3512 if [ $i -lt 111 ]
3513 vput vexpr j % $i 10
3514 if [ $j -ne 0 ]
3515 set j=xcall
3516 else
3517 echon "$i.. "
3518 set j=call
3520 eval \\$j _work $1 $i
3521 return $?
3523 vput vexpr i + $i "$1"
3524 return $i
3526 define _read {
3527 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
3528 echo read:$es/$en: $line
3529 if [ "${es}" -ne -1 ]
3530 xcall _read
3532 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
3534 define t_ocs {
3535 read ver
3536 echo t_ocs
3537 echo "~^header list"; read hl; echo $hl;\
3538 vput vexpr es substr "$hl" 0 1
3539 if [ "$es" != 2 ]
3540 xcall bail "header list"
3541 endif
3543 call _work 1; echo $?
3544 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
3545 read es; echo $es; vput vexpr es substr "$es" 0 1
3546 if [ "$es" != 2 ]
3547 xcall bail "be diet"
3548 endif
3549 echo "~^header insert cc <splice2@exam.ple>";\
3550 read es; echo $es; vput vexpr es substr "$es" 0 1
3551 if [ "$es" != 2 ]
3552 xcall bail "be diet2"
3553 endif
3555 call _work 2; echo $?
3556 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
3557 read es; echo $es;vput vexpr es substr "$es" 0 1
3558 if [ "$es" != 2 ]
3559 xcall bail "be juicy"
3560 endif
3561 echo "~^header insert bcc juice2@exam.ple";\
3562 read es; echo $es;vput vexpr es substr "$es" 0 1
3563 if [ "$es" != 2 ]
3564 xcall bail "be juicy2"
3565 endif
3566 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
3567 read es; echo $es;vput vexpr es substr "$es" 0 1
3568 if [ "$es" != 2 ]
3569 xcall bail "be juicy3"
3570 endif
3571 echo "~^header insert bcc juice4@exam.ple";\
3572 read es; echo $es;vput vexpr es substr "$es" 0 1
3573 if [ "$es" != 2 ]
3574 xcall bail "be juicy4"
3575 endif
3577 echo "~^header remove-at bcc 3";\
3578 read es; echo $es;vput vexpr es substr "$es" 0 1
3579 if [ "$es" != 2 ]
3580 xcall bail "remove juicy5"
3581 endif
3582 echo "~^header remove-at bcc 2";\
3583 read es; echo $es;vput vexpr es substr "$es" 0 1
3584 if [ "$es" != 2 ]
3585 xcall bail "remove juicy6"
3586 endif
3587 echo "~^header remove-at bcc 3";\
3588 read es; echo $es;vput vexpr es substr "$es" 0 3
3589 if [ "$es" != 501 ]
3590 xcall bail "failed to remove-at"
3591 endif
3592 # Add duplicates which ought to be removed!
3593 echo "~^header insert bcc juice4@exam.ple";\
3594 read es; echo $es;vput vexpr es substr "$es" 0 1
3595 if [ "$es" != 2 ]
3596 xcall bail "be juicy4-1"
3597 endif
3598 echo "~^header insert bcc juice4@exam.ple";\
3599 read es; echo $es;vput vexpr es substr "$es" 0 1
3600 if [ "$es" != 2 ]
3601 xcall bail "be juicy4-2"
3602 endif
3603 echo "~^header insert bcc juice4@exam.ple";\
3604 read es; echo $es;vput vexpr es substr "$es" 0 1
3605 if [ "$es" != 2 ]
3606 xcall bail "be juicy4-3"
3607 endif
3608 echo "~:set t_ocs"
3611 call _work 3; echo $?
3612 echo "~r - '__EOT'"
3613 vput ! i echo just knock if you can hear me;\
3614 i=0;\
3615 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
3616 echo relax
3617 echon shell-cmd says $?/$^ERRNAME: $i
3618 echo "~x will not become interpreted, we are reading until __EOT"
3619 echo "__EOT"
3620 read r_status; echo "~~r status output: $r_status"
3621 echo "~:echo $? $! $^ERRNAME"
3622 read r_status
3623 echo "~~r status from parent: $r_status"
3626 call _work 4; echo $?
3627 vput cwd cwd;echo cwd:$?
3628 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
3629 call _read
3632 call _work 5; echo $?
3633 echo "~^header show MAILX-Command"; read es;\
3634 call xerr $es "t_header 1000"; call read_mline_res
3635 echo "~^header show MAILX-raw-TO"; read es;\
3636 call xerr $es "t_header 1001"; xcall read_mline_res
3638 echoerr IT IS WRONG IF YOU SEE THIS
3640 define t_oce {
3641 echo on-compose-enter, mailx-command<$mailx-command>
3642 set t_oce autobcc=oce@exam.ple
3643 alternates alter1@exam.ple alter2@exam.ple
3644 alternates
3645 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3646 echo mailx-subject<$mailx-subject>
3647 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3648 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3649 mailx-raw-bcc<$mailx-raw-bcc>
3650 echo mailx-orig-from<$mailx-orig-from> \
3651 mailx-orig-to<$mailx-orig-to> \
3652 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3654 define t_ocl {
3655 echo on-compose-leave, mailx-command<$mailx-command>
3656 set t_ocl autocc=ocl@exam.ple
3657 unalternates *
3658 alternates alter3@exam.ple alter4@exam.ple
3659 alternates
3660 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3661 echo mailx-subject<$mailx-subject>
3662 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3663 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3664 mailx-raw-bcc<$mailx-raw-bcc>
3665 echo mailx-orig-from<$mailx-orig-from> \
3666 mailx-orig-to<$mailx-orig-to> \
3667 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3669 define t_occ {
3670 echo on-compose-cleanup, mailx-command<$mailx-command>
3671 set t_occ autocc=occ@exam.ple
3672 unalternates *
3673 alternates
3674 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3675 echo mailx-subject<$mailx-subject>
3676 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3677 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3678 mailx-raw-bcc<$mailx-raw-bcc>
3679 echo mailx-orig-from<$mailx-orig-from> \
3680 mailx-orig-to<$mailx-orig-to> \
3681 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3683 wysh set on-compose-splice=t_ocs \
3684 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
3685 ~t shell@exam.ple\\n~:set t_ocs_sh\\n\"" \
3686 on-compose-enter=t_oce on-compose-leave=t_ocl \
3687 on-compose-cleanup=t_occ
3688 ' > ./.tnotes 2>&1
3689 ex0_test behave:compose_hooks-3-estat
3690 ${cat} ./.tnotes >> "${MBOX}"
3692 check behave:compose_hooks-3 - "${MBOX}" '679526364 2431'
3694 # Reply, forward, resend, Resend
3696 ${rm} -f "${MBOX}"
3697 printf 'set from=f1@z\nm t1@z\nb1\n!.\nset from=f2@z\nm t2@z\nb2\n!.\n' |
3698 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3699 -Smta=./.tsendmail.sh
3701 printf '
3702 echo start: $? $! $^ERRNAME
3703 File %s
3704 echo File: $? $! $^ERRNAME;echo;echo
3705 reply 1
3706 this is content of reply 1
3708 echo reply 1: $? $! $^ERRNAME;echo;echo
3709 Reply 1 2
3710 this is content of Reply 1 2
3712 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
3713 forward 1 fwdex@am.ple
3714 this is content of forward 1
3716 echo forward 1: $? $! $^ERRNAME;echo;echo
3717 resend 1 2 resendex@am.ple
3718 echo resend 1 2: $? $! $^ERRNAME;echo;echo
3719 Resend 1 2 Resendex@am.ple
3720 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
3721 ' "${MBOX}" |
3722 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
3723 -Smta=./.tsendmail.sh \
3725 define bail {
3726 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3728 define xerr {
3729 vput vexpr es substr "$1" 0 1
3730 if [ "$es" != 2 ]
3731 xcall bail "$2"
3734 define read_mline_res {
3735 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
3736 echo mline_res:$len/$es/$^ERRNAME: $hl
3737 if [ $es -ne $^ERR-NONE ]
3738 xcall bail read_mline_res
3739 elif [ $len -ne 0 ]
3740 \xcall read_mline_res
3743 define work_hl {
3744 echo "~^header show $1"; read es;\
3745 call xerr $es "work_hl $1"; echo $1; call read_mline_res
3746 if [ $# -gt 1 ]
3747 shift
3748 xcall work_hl "$@"
3751 define t_ocs {
3752 read ver
3753 echo t_ocs version $ver
3754 echo "~^header list"; read hl; echo $hl;\
3755 echoerr the header list is $hl;\
3756 call xerr "$hl" "header list"
3757 eval vpospar set $hl
3758 shift
3759 xcall work_hl "$@"
3760 echoerr IT IS WRONG IF YOU SEE THIS
3762 define t_oce {
3763 echo on-XY-enter, mailx-command<$mailx-command>
3764 set t_oce autobcc=oce@exam.ple
3765 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3766 echo mailx-subject<$mailx-subject>
3767 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3768 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3769 mailx-raw-bcc<$mailx-raw-bcc>
3770 echo mailx-orig-from<$mailx-orig-from> \
3771 mailx-orig-to<$mailx-orig-to> \
3772 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3774 define t_ocl {
3775 echo on-XY-leave, mailx-command<$mailx-command>
3776 set t_ocl autocc=ocl@exam.ple
3777 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3778 echo mailx-subject<$mailx-subject>
3779 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3780 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3781 mailx-raw-bcc<$mailx-raw-bcc>
3782 echo mailx-orig-from<$mailx-orig-from> \
3783 mailx-orig-to<$mailx-orig-to> \
3784 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3786 define t_occ {
3787 echo on-XY-cleanup, mailx-command<$mailx-command>
3788 set t_occ autocc=occ@exam.ple
3789 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
3790 echo mailx-subject<$mailx-subject>
3791 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
3792 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
3793 mailx-raw-bcc<$mailx-raw-bcc>
3794 echo mailx-orig-from<$mailx-orig-from> \
3795 mailx-orig-to<$mailx-orig-to> \
3796 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
3798 wysh set on-compose-splice=t_ocs \
3799 on-compose-enter=t_oce on-compose-leave=t_ocl \
3800 on-compose-cleanup=t_occ \
3801 on-resend-enter=t_oce on-resend-cleanup=t_occ
3802 ' > ./.tnotes 2>&1
3803 ex0_test behave:compose_hooks-4-estat
3804 ${cat} ./.tnotes >> "${MBOX}"
3806 check behave:compose_hooks-4 - "${MBOX}" '3038884027 7516'
3808 t_epilog
3811 t_behave_mass_recipients() {
3812 t_prolog t_behave_mass_recipients
3813 TRAP_EXIT_ADDONS="./.t*"
3815 ${cat} <<-_EOT > ./.tsendmail.sh
3816 #!${SHELL} -
3817 (echo 'From Eucalyptus Sat Jul 08 21:14:57 2017' && ${cat} && echo
3818 ) >> "${MBOX}"
3819 _EOT
3820 chmod 0755 ./.tsendmail.sh
3822 ${cat} <<'__EOT__' > ./.trc
3823 define bail {
3824 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
3826 define ins_addr {
3827 wysh set nr=$1 hn=$2
3828 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
3829 if [ "$es" -ne 0 ]
3830 xcall bail "ins_addr $hn 1-$nr"
3832 vput vexpr nr + $nr 1
3833 if [ "$nr" -le "$maximum" ]
3834 xcall ins_addr $nr $hn
3837 define bld_alter {
3838 wysh set nr=$1 hn=$2
3839 alternates $hn$nr@$hn
3840 vput vexpr nr + $nr 2
3841 if [ "$nr" -le "$maximum" ]
3842 xcall bld_alter $nr $hn
3845 define t_ocs {
3846 read ver
3847 call ins_addr 1 t
3848 call ins_addr 1 c
3849 call ins_addr 1 b
3851 define t_ocl {
3852 if [ "$t_remove" != '' ]
3853 call bld_alter 1 t
3854 call bld_alter 2 c
3857 set on-compose-splice=t_ocs on-compose-leave=t_ocl
3858 __EOT__
3860 ${rm} -f "${MBOX}"
3861 printf 'm this-goes@nowhere\nbody\n!.\n' |
3862 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3863 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3864 >./.tall 2>&1
3865 ${cat} ./.tall >> "${MBOX}"
3866 check behave:mass_recipients-1 0 "${MBOX}" '2912243346 51526'
3868 ${rm} -f "${MBOX}"
3869 printf 'm this-goes@nowhere\nbody\n!.\n' |
3870 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
3871 -St_remove=1 -X'source ./.trc' -Smta=./.tsendmail.sh -Smaximum=2001 \
3872 >./.tall 2>&1
3873 ${cat} ./.tall >> "${MBOX}"
3874 check behave:mass_recipients-2 0 "${MBOX}" '4097804632 34394'
3876 t_epilog
3879 t_behave_mime_types_load_control() {
3880 t_prolog t_behave_mime_types_load_control
3881 TRAP_EXIT_ADDONS="./.t*"
3883 ${cat} <<-_EOT > ./.tmts1
3884 @ application/mathml+xml mathml
3885 _EOT
3886 ${cat} <<-_EOT > ./.tmts2
3887 @ x-conference/x-cooltalk ice
3888 @ aga-aga aga
3889 @ application/aga-aga aga
3890 _EOT
3892 ${cat} <<-_EOT > ./.tmts1.mathml
3893 <head>nonsense ML</head>
3894 _EOT
3895 ${cat} <<-_EOT > ./.tmts2.ice
3896 Icy, icy road.
3897 _EOT
3898 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.doom
3899 printf 'of which the c\x01rack is coming soon' > ./.tmtsx.aga
3901 printf '
3902 m %s
3903 Schub-di-du
3904 ~@ ./.tmts1.mathml
3905 ~@ ./.tmts2.ice
3906 ~@ ./.tmtsx.doom
3907 ~@ ./.tmtsx.aga
3909 File %s
3910 from*
3911 type
3913 ' "${MBOX}" "${MBOX}" |
3914 ${MAILX} ${ARGS} \
3915 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
3916 > ./.tout 2>&1
3917 ex0_test behave:mime_types_load_control
3919 ${cat} "${MBOX}" >> ./.tout
3920 check behave:mime_types_load_control-1 - ./.tout '1441260727 2449'
3922 echo type | ${MAILX} ${ARGS} -R \
3923 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
3924 -f "${MBOX}" >> ./.tout 2>&1
3925 check behave:mime_types_load_control-2 0 ./.tout '1441391438 3646'
3927 t_epilog
3930 t_behave_lreply_futh_rth_etc() {
3931 t_prolog t_behave_lreply_futh_rth_etc
3932 TRAP_EXIT_ADDONS="./.t*"
3934 ${cat} <<-_EOT > ./.tsendmail.sh
3935 #!${SHELL} -
3936 (echo 'From HumulusLupulus Thu Jul 27 14:41:20 2017' && ${cat} && echo
3937 ) >> "${MBOX}"
3938 _EOT
3939 chmod 0755 ./.tsendmail.sh
3941 ${cat} <<-_EOT > ./.tmbox
3942 From neverneverland Sun Jul 23 13:46:25 2017
3943 Subject: Bugstop: five miles out 1
3944 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3945 From: mister originator <mr@originator>
3946 To: bugstop-commit@five.miles.out, laber@backe.eu
3947 Cc: is@a.list
3948 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
3949 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
3950 Date: Wed, 19 Jul 2017 09:22:57 -0400
3951 Message-Id: <20170719132257.766AF781267@originator>
3952 Status: RO
3954 > |Sorry, I think I misunderstand something. I would think that
3956 That's appalling.
3958 From neverneverland Fri Jul 7 22:39:11 2017
3959 Subject: Bugstop: five miles out 2
3960 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
3961 Content-Transfer-Encoding: 7bit
3962 From: mister originator <mr@originator>
3963 To: bugstop-commit@five.miles.out
3964 Cc: is@a.list
3965 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
3966 Date: Fri, 07 Jul 2017 16:33:59 -0400
3967 Status: R
3969 capable of changing back.
3971 From neverneverland Fri Jul 7 22:42:00 2017
3972 Subject: Bugstop: five miles out 3
3973 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3974 Content-Transfer-Encoding: 7bit
3975 From: mister originator <mr@originator>
3976 To: bugstop-commit@five.miles.out
3977 Cc: is@a.list
3978 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
3979 Date: Fri, 07 Jul 2017 16:33:59 -0400
3980 List-Post: <mailto:bugstop@five.miles.out>
3981 Status: R
3983 are you ready, boots?
3985 From neverneverland Sat Aug 19 23:15:00 2017
3986 Subject: Bugstop: five miles out 4
3987 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
3988 Content-Transfer-Encoding: 7bit
3989 From: mister originator <mr@originator>
3990 To: bugstop@five.miles.out
3991 Cc: is@a.list
3992 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
3993 Date: Fri, 07 Jul 2017 16:33:59 -0400
3994 List-Post: <mailto:bugstop@five.miles.out>
3995 Status: R
3997 are you ready, boots?
3998 _EOT
4002 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh \
4003 -Rf ./.tmbox >> "${MBOX}" 2>&1
4004 define r {
4005 wysh set m="This is text of \"reply ${1}."
4006 reply 1 2 3
4007 !I m
4010 !I m
4013 !I m
4016 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
4018 define R {
4019 wysh set m="This is text of \"Reply ${1}."
4020 eval Reply $2
4021 !I m
4022 !I 2
4025 echo -----After Reply $1.$2: $?/$^ERRNAME
4027 define _Lh {
4028 read protover
4029 echo '~I m'
4030 echo '~I n'
4031 echo '".'
4033 define _Ls {
4034 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
4035 eval Lreply $2
4037 define L {
4038 # We need two indirections for this test: one for the case that Lreply
4039 # fails because of missing recipients: we need to read EOF next, thus
4040 # place this in _Ls last; and second for the succeeding cases EOF is
4041 # not what these should read, so go over the backside and splice it in!
4042 call _Ls "$@"
4043 echo -----After Lreply $1.$2: $?/$^ERRNAME
4045 define x {
4046 localopts call-fixate yes
4047 call r $1
4048 call R $1 1; call R $1 2; call R $1 3; call R $1 4
4049 call L $1 1; call L $1 2; call L $1 3
4051 define tweak {
4052 echo;echo '===== CHANGING === '"$*"' =====';echo
4053 eval "$@"
4056 set from=laber@backe.eu
4057 mlist is@a.list
4058 call x 1
4059 call tweak set reply-to-honour
4060 call x 2
4061 call tweak set followup-to
4062 call x 3
4063 call tweak set followup-to-honour
4064 call x 4
4065 call tweak mlist bugstop@five.miles.out
4066 call x 5
4067 call tweak mlsubscribe bugstop@five.miles.out
4068 call x 6
4069 call tweak set recipients-in-cc
4070 call x 7
4071 _EOT
4073 check behave:lreply_futh_rth_etc-1 0 "${MBOX}" '940818845 29373'
4077 ${cat} <<-_EOT > ./.tmbox
4078 From tom@i-i.example Thu Oct 26 03:15:55 2017
4079 Date: Wed, 25 Oct 2017 21:15:46 -0400
4080 From: tom <tom@i-i.example>
4081 To: Steffen Nurpmeso <steffen@sdaoden.eu>
4082 Cc: tom <tom@i-i.example>
4083 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
4084 Message-ID: <20171026011546.GA11643@i-i.example>
4085 Reply-To: tom@i-i.example
4086 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
4087 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
4088 Status: R
4090 The report's useful :-)
4091 _EOT
4093 printf 'reply 1\nthank you\n!.\n' |
4094 ${MAILX} ${ARGS} -Sescape=! -Smta=./.tsendmail.sh -Sreply-to-honour \
4095 -Rf ./.tmbox > "${MBOX}" 2>&1
4096 check behave:lreply_futh_rth_etc-2 0 "${MBOX}" '1045866991 331'
4098 t_epilog
4101 t_behave_xxxheads_rfc2047() {
4102 t_prolog t_behave_xxxheads_rfc2047
4103 TRAP_EXIT_ADDONS="./.t*"
4105 ${cat} <<-_EOT > ./.tsendmail.sh
4106 #!${SHELL} -
4107 (echo 'From GentianaLutea Mon Dec 04 17:15:29 2017' && ${cat} &&
4108 echo) >> "${MBOX}"
4109 _EOT
4110 chmod 0755 ./.tsendmail.sh
4113 ${rm} -f "${MBOX}"
4114 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4115 -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̲' \
4116 "${MBOX}"
4117 check behave:xxxheads_rfc2047-1 0 "${MBOX}" '3370931614 375'
4119 # Single word (overlong line split -- bad standard! Requires injection of
4120 # artificial data!! But can be prevented by using RFC 2047 encoding)
4121 ${rm} -f "${MBOX}"
4122 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
4123 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
4124 check behave:xxxheads_rfc2047-2 0 "${MBOX}" '489922370 1718'
4126 # Combination of encoded words, space and tabs of varying sort
4127 ${rm} -f "${MBOX}"
4128 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4129 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
4130 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
4131 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
4132 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
4133 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
4134 "${MBOX}"
4135 check behave:xxxheads_rfc2047-3 0 "${MBOX}" '1676887734 591'
4137 # Overlong multibyte sequence that must be forcefully split
4138 # todo This works even before v15.0, but only by accident
4139 ${rm} -f "${MBOX}"
4140 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4141 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4142 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
4143 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
4144 "${MBOX}"
4145 check behave:xxxheads_rfc2047-4 0 "${MBOX}" '3029301775 659'
4147 # Trailing WS
4148 ${rm} -f "${MBOX}"
4149 echo | ${MAILX} ${ARGS} \
4150 -s "1-1 B2 B3 B4 B5 B6 B\
4151 1-2 B2 B3 B4 B5 B6 B\
4152 1-3 B2 B3 B4 B5 B6 B\
4153 1-4 B2 B3 B4 B5 B6 B\
4154 1-5 B2 B3 B4 B5 B6 B\
4155 1-6 B2 B3 B4 B5 B6 " \
4156 "${MBOX}"
4157 check behave:xxxheads_rfc2047-5 0 "${MBOX}" '4126167195 297'
4159 # Leading and trailing WS
4160 ${rm} -f "${MBOX}"
4161 echo | ${MAILX} ${ARGS} \
4162 -s " 2-1 B2 B3 B4 B5 B6 B\
4163 1-2 B2 B3 B4 B5 B6 B\
4164 1-3 B2 B3 B4 B5 B6 B\
4165 1-4 B2 B3 B4 B5 B6 " \
4166 "${MBOX}"
4167 check behave:xxxheads_rfc2047-6 0 "${MBOX}" '3600624479 236'
4169 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
4170 ${rm} -f "${MBOX}"
4171 echo "Dat Früchtchen riecht häußlich" |
4172 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=./.tsendmail.sh \
4173 -s Hühöttchen \
4174 'Schnödes "Früchtchen" <do@du> (Hä!)'
4175 check behave:xxxheads_rfc2047-7 0 "${MBOX}" '800505986 368'
4177 t_epilog
4180 t_behave_rfc2231() {
4181 t_prolog t_behave_rfc2231
4182 TRAP_EXIT_ADDONS="./.t*"
4185 mkdir ./.ttt || exit 1
4186 cd ./.ttt || exit 2
4187 : > "ma'ger.txt"
4188 : > "mä'ger.txt"
4189 : > 'diet\ is \curd.txt'
4190 : > 'diet "is" curd.txt'
4191 : > höde-tröge.txt
4192 : > 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
4193 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
4194 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
4195 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
4197 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
4198 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
4199 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
4200 -a ./.ttt/höde-tröge.txt \
4201 -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 \
4202 -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 \
4203 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
4204 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
4205 "${MBOX}"
4206 check behave:rfc2231-1 0 "${MBOX}" '684985954 3092'
4208 # `resend' test, reusing $MBOX
4209 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4210 check behave:rfc2231-2 0 ./.t2 '684985954 3092'
4212 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
4213 check behave:rfc2231-3 0 ./.t3 '3130352658 3148'
4215 t_epilog
4218 t_behave_iconv_mbyte_base64() {
4219 t_prolog t_behave_iconv_mbyte_base64
4220 TRAP_EXIT_ADDONS="./.t*"
4222 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv &&
4223 (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1 ||
4224 (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4226 else
4227 echo 'behave:iconv_mbyte_base64: unsupported, skipped'
4228 return
4231 ${cat} <<-_EOT > ./.tsendmail.sh
4232 #!${SHELL} -
4233 (echo 'From DroseriaRotundifolia Thu Aug 03 17:26:25 2017' && ${cat} &&
4234 echo) >> "${MBOX}"
4235 _EOT
4236 chmod 0755 ./.tsendmail.sh
4238 if (</dev/null iconv -f ascii -t iso-2022-jp) >/dev/null 2>&1; then
4239 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4240 -Smta=./.tsendmail.sh \
4241 -Sescape=! -Smime-encoding=base64 2>./.terr
4242 set ttycharset=utf-8 sendcharsets=iso-2022-jp
4243 m t1@exam.ple
4244 !s Japanese from UTF-8 to ISO-2022-JP
4245 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4247 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4250 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4252 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4255 set ttycharset=iso-2022-jp charset-7bit=iso-2022-jp sendcharsets=utf-8
4256 m t2@exam.ple
4257 !s Japanese from ISO-2022-JP to UTF-8, eh, no, also ISO-2022-JP
4258 \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
4260 \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
4263 \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
4265 \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
4267 _EOT
4268 check behave:iconv_mbyte_base64-1 0 "${MBOX}" '3428985079 1976'
4269 check behave:iconv_mbyte_base64-2 - ./.terr '4294967295 0'
4271 printf 'eval f 1; write ./.twrite\n' |
4272 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4273 check behave:iconv_mbyte_base64-3 0 ./.twrite '1259742080 686'
4274 check behave:iconv_mbyte_base64-4 - ./.tlog '3956097665 119'
4275 else
4276 echo 'behave:iconv_mbyte_base64: ISO-2022-JP unsupported, skipping 1-4'
4279 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
4280 rm -f "${MBOX}" ./.twrite
4281 cat <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
4282 -Smta=./.tsendmail.sh \
4283 -Sescape=! -Smime-encoding=base64 2>./.terr
4284 set ttycharset=utf-8 sendcharsets=euc-jp
4285 m t1@exam.ple
4286 !s Japanese from UTF-8 to EUC-JP
4287 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4289 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4292 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
4294 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
4297 set ttycharset=EUC-JP sendcharsets=utf-8
4298 m t2@exam.ple
4299 !s Japanese from EUC-JP to UTF-8
4300 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4302 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4305 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
4307 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
4309 _EOT
4310 check behave:iconv_mbyte_base64-5 0 "${MBOX}" '1686827547 2051'
4311 check behave:iconv_mbyte_base64-6 - ./.terr '4294967295 0'
4313 printf 'eval f 1; write ./.twrite\n' |
4314 ${MAILX} ${ARGS} ${ADDARG_UNI} -Rf "${MBOX}" >./.tlog 2>&1
4315 check behave:iconv_mbyte_base64-7 0 ./.twrite '1259742080 686'
4316 check behave:iconv_mbyte_base64-8 - ./.tlog '500059195 119'
4317 else
4318 echo 'behave:iconv_mbyte_base64: EUC-JP unsupported, skipping 5-8'
4321 t_epilog
4324 t_behave_iconv_mainbody() {
4325 t_prolog t_behave_iconv_mainbody
4326 TRAP_EXIT_ADDONS="./.t*"
4329 if have_feat iconv &&
4330 (</dev/null iconv -f utf-8 -t ascii) >/dev/null 2>&1; then
4331 j="`printf '–' | iconv -f utf-8 -t ascii 2>/dev/null`"
4332 # This assumes iconv(1) behaves like iconv(3), but well.
4333 # This is flaky because the behaviour is so non-uniform
4334 if [ ${?} -ne 0 ]; then
4335 if [ x"${j}" = 'x?' ]; then
4337 else
4340 elif [ x"${j}" = 'x?' ]; then
4342 elif [ x"${j}" = 'x*' ]; then
4346 if [ -z "${i}" ]; then
4347 echo 'behave:iconv_mainbody: unsupported, skipped'
4348 return
4351 ${cat} <<-_EOT > ./.tsendmail.sh
4352 #!${SHELL} -
4353 (echo 'From HamamelisVirginiana Fri Oct 20 16:23:21 2017' && ${cat} &&
4354 echo) >> "${MBOX}"
4355 _EOT
4356 chmod 0755 ./.tsendmail.sh
4358 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tsendmail.sh \
4359 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
4360 -s '–' over-the@rain.bow 2>./.terr
4361 check behave:iconv_mainbody-1 0 "${MBOX}" '3634015017 251'
4362 check behave:iconv_mainbody-2 - ./.terr '4294967295 0'
4364 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=./.tsendmail.sh \
4365 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
4366 -s '–' over-the@rain.bow 2>./.terr
4367 exn0_test behave:iconv_mainbody-3
4368 check behave:iconv_mainbody-3 - "${MBOX}" '3634015017 251'
4369 check behave:iconv_mainbody-4 - ./.terr '1960148192 128'
4371 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
4372 j=${?}
4373 ex0_test behave:iconv_mainbody-5-0 ${j}
4374 if [ x${i} = x1 ]; then
4375 # yuck, just assume ???, we need a test program for that one!
4376 check behave:iconv_mainbody-5-1-1 - ./.tout '1959197095 283'
4377 check behave:iconv_mainbody-5-1-1 - ./.terr '4294967295 0'
4378 elif [ x${i} = x2 ]; then
4379 check behave:iconv_mainbody-5-2-1 - ./.tout '1959197095 283'
4380 check behave:iconv_mainbody-5-2-2 - ./.terr '4294967295 0'
4381 elif [ x${i} = x3 ]; then
4382 check behave:iconv_mainbody-5-3-1 - ./.tout '3196380198 279'
4383 check behave:iconv_mainbody-5-3-2 - ./.terr '4294967295 0'
4384 else
4385 check behave:iconv_mainbody-5-4-1 - ./.tout '3760313827 279'
4386 check behave:iconv_mainbody-5-4-2 - ./.terr '4294967295 0'
4389 t_epilog
4392 t_behave_q_t_etc_opts() {
4393 t_prolog t_behave_q_t_etc_opts
4394 TRAP_EXIT_ADDONS="./.t*"
4396 # Three tests for MIME encoding and (a bit) content classification.
4397 # At the same time testing -q FILE, < FILE and -t FILE
4398 t__put_body > ./.tin
4400 ${rm} -f "${MBOX}"
4401 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
4402 -a ./.tin -s "`t__put_subject`" "${MBOX}"
4403 check behave:q_t_etc_opts-1 0 "${MBOX}" '3570973309 6646'
4405 ${rm} -f "${MBOX}"
4406 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
4407 -a ./.tin -s "`t__put_subject`" -q ./.tin "${MBOX}"
4408 check behave:q_t_etc_opts-2 0 "${MBOX}" '3570973309 6646'
4410 ${rm} -f "${MBOX}"
4411 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject`" && echo &&
4412 ${cat} ./.tin
4413 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
4414 check behave:q_t_etc_opts-3 0 "${MBOX}" '3570973309 6646'
4416 t_epilog
4419 t_behave_s_mime() {
4420 have_feat smime || {
4421 echo 'behave:s/mime: unsupported, skipped'
4422 return
4425 t_prolog t_behave_s_mime
4426 TRAP_EXIT_ADDONS="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
4427 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
4428 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
4430 printf 'behave:s/mime: .. generating test key and certificate ..\n'
4431 ${cat} <<-_EOT > ./.t.conf
4432 [ req ]
4433 default_bits = 1024
4434 default_keyfile = keyfile.pem
4435 distinguished_name = req_distinguished_name
4436 attributes = req_attributes
4437 prompt = no
4438 output_password =
4440 [ req_distinguished_name ]
4441 C = GB
4442 ST = Over the
4443 L = rainbow
4444 O = S-nail
4445 OU = S-nail.smime
4446 CN = S-nail.test
4447 emailAddress = test@localhost
4449 [ req_attributes ]
4450 challengePassword =
4451 _EOT
4452 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
4453 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >/dev/null 2>&1
4454 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
4456 # Sign/verify
4457 printf 'behave:s/mime:sign/verify: '
4458 echo bla | ${MAILX} ${ARGS} \
4459 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4460 -Ssmime-sign -Sfrom=test@localhost \
4461 -s 'S/MIME test' ./.VERIFY
4462 if [ $? -eq 0 ]; then
4463 printf 'ok\n'
4464 else
4465 printf 'failed\n'
4466 ESTAT=1
4467 t_epilog
4468 return
4471 ${awk} '
4472 BEGIN{ skip=0 }
4473 /^Content-Description: /{ skip = 2; print; next }
4474 /^$/{ if(skip) --skip }
4475 { if(!skip) print }
4477 < ./.VERIFY > "${MBOX}"
4478 check behave:s/mime:sign/verify:checksum - "${MBOX}" '2900817158 648'
4480 printf 'behave:s/mime:sign/verify:verify '
4481 printf 'verify\nx\n' |
4482 ${MAILX} ${ARGS} \
4483 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4484 -Ssmime-sign -Sfrom=test@localhost \
4485 -Serrexit -R \
4486 -f ./.VERIFY >/dev/null 2>&1
4487 if [ $? -eq 0 ]; then
4488 printf 'ok\n'
4489 else
4490 printf 'failed\n'
4491 ESTAT=1
4492 t_epilog
4493 return
4496 printf 'behave:s/mime:sign/verify:disproof-1 '
4497 if openssl smime -verify -CAfile ./.tcert.pem \
4498 -in ./.VERIFY >/dev/null 2>&1; then
4499 printf 'ok\n'
4500 else
4501 printf 'failed\n'
4502 ESTAT=1
4503 t_epilog
4504 return
4507 # (signing +) encryption / decryption
4508 ${cat} <<-_EOT > ./.tsendmail.sh
4509 #!${SHELL} -
4510 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
4511 _EOT
4512 chmod 0755 ./.tsendmail.sh
4514 printf 'behave:s/mime:encrypt+sign: '
4515 echo bla |
4516 ${MAILX} ${ARGS} \
4517 -Ssmime-force-encryption \
4518 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4519 -Smta=./.tsendmail.sh \
4520 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4521 -Ssmime-sign -Sfrom=test@localhost \
4522 -s 'S/MIME test' recei@ver.com
4523 if [ $? -eq 0 ]; then
4524 printf 'ok\n'
4525 else
4526 ESTAT=1
4527 printf 'error: encrypt+sign failed\n'
4530 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
4531 check behave:s/mime:encrypt+sign:checksum - "${MBOX}" '1937410597 327'
4533 printf 'behave:s/mime:decrypt+verify: '
4534 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
4535 ${MAILX} ${ARGS} \
4536 -Ssmime-force-encryption \
4537 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4538 -Smta=./.tsendmail.sh \
4539 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4540 -Ssmime-sign -Sfrom=test@localhost \
4541 -Serrexit -R \
4542 -f ./.ENCRYPT >/dev/null 2>&1
4543 if [ $? -eq 0 ]; then
4544 printf 'ok\n'
4545 else
4546 ESTAT=1
4547 printf 'failed\n'
4550 ${awk} '
4551 BEGIN{ skip=0 }
4552 /^Content-Description: /{ skip = 2; print; next }
4553 /^$/{ if(skip) --skip }
4554 { if(!skip) print }
4556 < ./.DECRYPT > "${MBOX}"
4557 check behave:s/mime:decrypt+verify:checksum - "${MBOX}" '1720739247 931'
4559 printf 'behave:s/mime:decrypt+verify:disproof-1: '
4560 if (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
4561 openssl smime -verify -CAfile ./.tcert.pem) >/dev/null 2>&1; then
4562 printf 'ok\n'
4563 else
4564 printf 'failed\n'
4565 ESTAT=1
4568 printf "behave:s/mime:encrypt: "
4569 echo bla | ${MAILX} ${ARGS} \
4570 -Ssmime-force-encryption \
4571 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4572 -Smta=./.tsendmail.sh \
4573 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4574 -Sfrom=test@localhost \
4575 -s 'S/MIME test' recei@ver.com
4576 if [ $? -eq 0 ]; then
4577 printf 'ok\n'
4578 else
4579 ESTAT=1
4580 printf 'failed\n'
4583 # Same as behave:s/mime:encrypt+sign:checksum above
4584 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
4585 check behave:s/mime:encrypt:checksum - "${MBOX}" '1937410597 327'
4587 ${rm} -f ./.DECRYPT
4588 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
4589 -Ssmime-force-encryption \
4590 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
4591 -Smta=./.tsendmail.sh \
4592 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
4593 -Sfrom=test@localhost \
4594 -Serrexit -R \
4595 -f ./.ENCRYPT >/dev/null 2>&1
4596 check behave:s/mime:decrypt 0 "./.DECRYPT" '2624716890 422'
4598 printf 'behave:s/mime:decrypt:disproof-1: '
4599 if openssl smime -decrypt -inkey ./.tkey.pem \
4600 -in ./.ENCRYPT >/dev/null 2>&1; then
4601 printf 'ok\n'
4602 else
4603 printf 'failed\n'
4604 ESTAT=1
4607 t_epilog
4610 # t_content()
4611 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
4612 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
4613 # Note we unfortunately need to place some statements without proper
4614 # indentation because of continuation problems
4615 # xxx Note: t_content() was the first test (series) written. Today many
4616 # xxx aspects are (better) covered by other tests above, some are not.
4617 # xxx At some future date and time, convert the last remains not covered
4618 # xxx elsewhere to a real t_behave_* test and drop t_content()
4619 t_content() {
4620 t_prolog t_content
4622 # Test for [260e19d] (Juergen Daubert)
4623 ${rm} -f "${MBOX}"
4624 echo body | ${MAILX} ${ARGS} "${MBOX}"
4625 check content:004 0 "${MBOX}" '2917662811 98'
4627 # "Test for" [d6f316a] (Gavin Troy)
4628 ${rm} -f "${MBOX}"
4629 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
4630 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
4631 check content:006 0 "${MBOX}" '2099098650 122'
4632 check content:006-1 - "${BODY}" '794542938 174'
4634 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
4635 ${rm} -f "${MBOX}"
4636 ${awk} 'BEGIN{
4637 for(i = 0; i < 10000; ++i)
4638 printf "\xC3\xBC"
4639 #printf "\xF0\x90\x87\x90"
4640 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
4641 check content:007 0 "${MBOX}" '534262374 61816'
4643 t_epilog
4646 t__put_subject() {
4647 # MIME encoding (QP) stress message subject
4648 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
4649 'adadaddsssssssddddddddddddddddddddd'\
4650 'ddddddddddddddddddddddddddddddddddd'\
4651 'ddddddddddddddddddddddddddddddddddd'\
4652 'dddddddddddddddddddd Hallelulja? Od'\
4653 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
4654 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
4655 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
4656 'fffffffffffffffffffffffffffffffffff'\
4657 'fffffffffffffffffffff ggggggggggggg'\
4658 'ggggggggggggggggggggggggggggggggggg'\
4659 'ggggggggggggggggggggggggggggggggggg'\
4660 'ggggggggggggggggggggggggggggggggggg'\
4661 'gggggggggggggggg'
4664 t__put_body() {
4665 # MIME encoding (QP) stress message body
4666 printf \
4667 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
4668 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
4669 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
4670 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
4671 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
4672 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
4673 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
4674 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
4675 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
4676 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
4677 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
4678 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
4679 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
4680 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
4681 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
4682 "auf den zeilen vorher.\r\n"\
4683 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
4684 ".\r\n"\
4685 "Die letzte Zeile war nur ein Punkt.\r\n"\
4686 "..\r\n"\
4687 "Das waren deren zwei.\r\n"\
4688 " \r\n"\
4689 "Die letzte Zeile war ein Leerschritt.\n"\
4690 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
4691 "Prösterchen.\r\n"\
4692 ".\n"\
4693 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
4694 "..\n"\
4695 "Das waren deren zwei. ditto.\n"\
4696 "Prösterchen.\n"\
4697 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
4698 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
4699 "auf den zeilen vorher.\n"\
4700 "ditto.\n"\
4701 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
4702 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
4703 "\n"\
4704 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4705 "\n"\
4706 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4707 "3\n"\
4708 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4709 "34\n"\
4710 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4711 "345\n"\
4712 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
4713 "3456\n"\
4714 "QP am Zeilenende über soft-nl hinweg\n"\
4715 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4716 "ö123\n"\
4717 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4718 "1ö23\n"\
4719 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4720 "12ö3\n"\
4721 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
4722 "123ö\n"\
4723 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
4724 " \n"\
4725 "Die letzte Zeile war ein Leerschritt.\n"\
4729 t_all() {
4730 # if have_feat devel; then
4731 # ARGS="${ARGS} -Smemdebug"
4732 # export ARGS
4733 # fi
4735 if [ -n "${UTF8_LOCALE}" ]; then
4736 printf 'Using Unicode locale %s\n' "${UTF8_LOCALE}"
4737 else
4738 printf 'No Unicode locale found, disabling Unicode tests\n'
4741 t_behave
4742 t_content
4745 if [ -z "${CHECK_ONLY}${MAE_TEST}" ]; then
4746 cc_all_configs
4747 elif [ -z "${MAE_TEST}" ] || [ ${#} -eq 0 ]; then
4748 t_all
4749 else
4750 while [ ${#} -gt 0 ]; do
4751 ${1}
4752 shift
4753 done
4756 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'
4758 exit ${ESTAT}
4759 # s-sh-mode