2 #@ Synopsis: [OBJDIR=XY] ./mx-test.sh --check mailx-binary [:SKIPTESTNAME:]
3 #@ [OBJDIR=XY] ./mx-test.sh --run-test mailx-binary [:TESTNAME:]
4 #@ [./mx-test.sh # Note: performs hundreds of compilations!]
5 #@ --no-jobs can be used to prevent spawning concurrent tests.
6 #@ --no-colour or $MAILX_CC_TEST_NO_COLOUR for not trying to use colour
7 #@ (then grep for ^ERROR, for example).
8 #@ The last mode also reacts on $MAILX_CC_ALL_TESTS_DUMPERR, for even easier
9 #@ grep ^ERROR handling.
10 #@ And setting $MAILX_CC_TEST_NO_CLEANUP keeps all test data around, fwiw:
11 #@ this works with --run-test only.
12 #@ $JOBWAIT, $JOBMON and $SKIPTEST are taken from environment when found.
18 # Instead of figuring out the environment in here, require a configured build
19 # system and include that! Our makefile and configure ensure that this test
20 # does not run in the configured, but the user environment nonetheless!
23 if [ -f .
/mk-config.env
]; then
25 elif [ -f snailmail.jpg
] && [ -f "${OBJDIR}"/mk-config.env
]; then
26 i
=`pwd`/ # not from environment, sic
30 echo >&2 'S-nail/S-mailx is not configured.'
31 echo >&2 'This test script requires the shell environment that only the'
32 echo >&2 'configuration script can figure out, even if used to test'
33 echo >&2 'a different binary than the one that would be produced!'
34 echo >&2 '(The information will be in ${OBJDIR:=.obj}/mk-config.env.)'
35 echo >&2 'Hit RETURN to run "make config"'
41 if [ -z "${MAILX__CC_TEST_RUNNING}" ]; then
42 MAILX__CC_TEST_RUNNING
=1
43 export MAILX__CC_TEST_RUNNING
44 exec "${SHELL}" "${i}${0}" "${@}"
47 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
48 # such is a compile-time variable
49 ARGS
='-Sv15-compat -:/ -Sdotlock-disable -Smta=test -Smta-bcc-ok'
50 ARGS
="${ARGS}"' -Smemdebug -Sstealthmua'
51 ARGS
="${ARGS}"' -Smime-encoding=quoted-printable -Snosave'
52 ARGS
="${ARGS}"' -Smailcap-disable -Smimetypes-load-control='
53 NOBATCH_ARGS
="${ARGS}"' -Sexpandaddr'
54 ARGS
="${ARGS}"' -Sexpandaddr=restrict -#'
55 ADDARG_UNI
=-Sttycharset=UTF-8
59 ERR
=.
/.cc-test.err
# Covers some which cannot be checksummed; not quoted!
61 #UTF8_LOCALE= HONOURS_READONLY= autodetected unless set
64 # When testing mass mail/loops, maximum number of receivers/loops.
65 # TODO note we do not gracefully handle ARG_MAX excess yet!
66 # Those which use this have checksums for 2001 and 201.
67 # Some use the smaller automatically if +debug
68 LOOPS_BIG
=2001 LOOPS_SMALL
=201
69 LOOPS_MAX
=$LOOPS_SMALL
71 # How long unless started tests get reaped (avoid endless looping)
76 # Note valgrind has problems with FDs in forked childs, which causes some tests
77 # to fail (the FD is rewound and thus will be dumped twice)
79 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
85 jspawn X_Y_opt_input_go_stack
90 jspawn input_inject_semicolon_seq
92 jspawn commandalias
# test now, save space later on!
102 jspawn macro_param_shift
112 jspawn headerpick
# so we have a notion that it works a bit
115 # Send/RFC absolute basics
130 # MIME and RFC basics
131 jspawn mime_if_not_ascii
133 jspawn xxxheads_rfc2047
134 jspawn iconv_mbyte_base64
135 jspawn iconv_mainbody
136 jspawn mime_force_sendout
137 jspawn binary_mainbody
138 jspawn C_opt_customhdr
141 # Operational basics with trivial tests
148 # Operational basics with easy tests
149 jspawn expandaddr
# (after t_alias)
150 jspawn mta_aliases
# (after t_expandaddr)
154 jspawn message_injections
156 jspawn rfc2231
# (after attachments)
157 jspawn mime_types_load_control
160 # Around state machine, after basics
165 jspawn on_main_loop_tick
166 jspawn on_program_exit
169 # Heavy use of/rely on state machine (behaviour) and basics
171 jspawn mass_recipients
172 jspawn lreply_futh_rth_etc
186 ## Now it is getting really weird. You have been warned.
187 # Setup and support {{{
188 export ARGS ADDARG_UNI CONF BODY MBOX MAIL TMPDIR \
189 MAKE
awk cat cksum rm sed grep
193 # Wed Oct 2 01:50:07 UTC 1996
194 SOURCE_DATE_EPOCH
=844221007
196 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
197 unset POSIXLY_CORRECT LOGNAME USER
202 Synopsis: [OBJDIR=x] mx-test.sh [--no-jobs] --check mailx-binary [:SKIPTEST:]
203 Synopsis: [OBJDIR=x] mx-test.sh [--no-jobs] --run-test mailx-binary [:TEST:]
204 Synopsis: [OBJDIR=x] mx-test.sh [--no-jobs]
206 --check EXE [:SKIPTEST:] run test series, exit success or error.
207 [:SKIPTEST:]s (and $SKIPTEST=) will be excluded.
208 --run-test EXE [:TEST:] run all or only the given TESTs, and create
209 test output data files; if run in a git(1)
210 checkout with the [test-out] branch available,
211 it will also create file diff(1)erences
212 --no-jobs do not spawn multiple jobs simultaneously
213 (dependent on make(1) and sh(1), pass JOBMON=n, too)
214 --no-colour or $MAILX_CC_TEST_NO_COLOUR: no colour
215 (for example to: grep ^ERROR)
216 $MAILX_CC_ALL_TESTS_DUMPER in addition for even
217 easier grep ^ERROR handling
219 The last invocation style will compile and test as many different
220 configurations as possible.
221 EXE should be absolute or relative to $OBJDIR, which can be may be set to the
222 location of the built objects etc.
223 $MAILX_CC_TEST_NO_CLEANUP skips deletion of test data (works only with
224 one test, aka --run-test).
225 $JOBWAIT could denote a timeout, $JOBMON controls usage of "set -m".
230 CHECK
= RUN_TEST
= MAILX
=
231 DEVELDIFF
= DUMPERR
= GIT_REPO
=
232 MAXJOBS
=1 NOCOLOUR
= NOJOBS
=
233 while [ ${#} -gt 0 ]; do
234 if [ "${1}" = --no-jobs ]; then
237 elif [ "${1}" = --no-colour ]; then
240 elif [ "${1}" = -h ] ||
[ "${1}" = --help ]; then
248 if [ "${1}" = --check ]; then
250 [ -x "${MAILX}" ] || usage
252 SKIPTEST
="${@} ${SKIPTEST}"
253 [ -d ..
/.git
] && [ -z "${MAILX__CC_TEST_NO_DATA_FILES}" ] && GIT_REPO
=1
254 echo 'Mode: --check, binary: '"${MAILX}"
255 elif [ "${1}" = --run-test ]; then
256 [ ${#} -ge 2 ] || usage
257 RUN_TEST
=1 MAILX
=${2}
258 [ -x "${MAILX}" ] || usage
260 [ -d ..
/.git
] && GIT_REPO
=1
261 echo 'Mode: --run-test, binary: '"${MAILX}"
263 [ ${#} -eq 0 ] || usage
264 echo 'Mode: full compile test, this will take a long time...'
265 MAILX__CC_TEST_NO_DATA_FILES
=1
266 export MAILX__CC_TEST_NO_DATA_FILES
270 # Since we invoke $MAILX from within several directories we need a fully
271 # qualified path. Or at least something similar.
272 { echo ${MAILX} | ${grep} -q ^/; } || MAILX="${TMPDIR}"/${MAILX}
274 MAILX
="${MEMTESTER}${MAILX}"
275 export RAWMAILX MAILX
277 # We want an UTF-8 locale, and HONOURS_READONLY {{{
278 if [ -n "${CHECK}${RUN_TEST}" ]; then
279 if [ -z "${UTF8_LOCALE}" ]; then
280 # Try ourselfs via nl_langinfo(CODESET) first (requires a new version)
281 if command -v "${RAWMAILX}" >/dev
/null
2>&1 &&
282 ("${RAWMAILX}" -:/ -Xxit) >/dev
/null
2>&1; then
283 echo 'Trying to detect UTF-8 locale via '"${RAWMAILX}"
284 i
=`LC_ALL=C.utf8 "${RAWMAILX}" ${ARGS} -X '
286 \if "${ttycharset}" =%?case utf
291 \wysh set LC_ALL=${1}
293 \eval xcall cset_test "${@}"
297 \call cset_test C.UTF-8 POSIX.utf8 POSIX.UTF-8 \
298 en_EN.utf8 en_EN.UTF-8 en_US.utf8 en_US.UTF-8
300 [ $?
-eq 0 ] && UTF8_LOCALE
=$i
303 if [ -z "${UTF8_LOCALE}" ] && (locale yesexpr
) >/dev
/null
2>&1; then
304 echo 'Trying to detect UTF-8 locale via locale -a'
305 UTF8_LOCALE
=`locale -a | { m=
308 ${grep} -i -e utf8 -e utf-8; } >/dev/null 2>&1; then
311 ${grep} -e POSIX -e en_EN -e en_US; } \
312 >/dev/null 2>&1; then
322 if [ -n "${UTF8_LOCALE}" ]; then
323 echo 'Using Unicode locale '"${UTF8_LOCALE}"
325 echo 'No Unicode locale found, disabling Unicode tests'
328 if [ -z "${HONOURS_READONLY}" ]; then
329 trap "${rm} -f ./.tisrdonly" EXIT
330 trap "exit 1" HUP INT TERM
331 printf '' > .
/.tisrdonly
332 ${chmod} 0444 .
/.tisrdonly
333 if (printf 'no\n' > .
/.tisrdonly
) >/dev
/null
2>&1 &&
334 test -s .
/.tisrdonly
; then
339 ${rm} -f .
/.tisrdonly
340 trap '' EXIT HUP INT TERM
344 export UTF8_LOCALE HONOURS_READONLY
347 TESTS_PERFORMED
=0 TESTS_OK
=0 TESTS_FAILED
=0 TESTS_SKIPPED
=0
348 JOBS
=0 JOBLIST
= JOBDESC
= JOBREAPER
= JOBSYNC
=
350 COLOR_ERR_ON
= COLOR_ERR_OFF
=
351 COLOR_WARN_ON
= COLOR_WARN_OFF
=
352 COLOR_OK_ON
= COLOR_OK_OFF
=
357 [ -z "${MAILX_CC_TEST_NO_CLEANUP}" ] &&
358 ${rm} -rf ./t.*.d ./t.*.io ./t.*.result
361 trap "exit 1" HUP INT QUIT TERM
364 if [ -n "${NOJOBS}" ]; then
368 # The user desired variant
369 if ( echo "${MAKEFLAGS}" |
${grep} -- -j ) >/dev
/null
2>&1; then
370 i
=`echo "${MAKEFLAGS}" |
371 ${sed} -e 's/^.*-j[ ]*\([0-9]\{1,\}\).*$/\1/'`
372 if ( echo "${i}" |
grep -q -e '^[0-9]\{1,\}$' ); then
373 printf 'Job number derived from MAKEFLAGS: %s\n' ${i}
375 [ "${MAXJOBS}" -eq 0 ] && MAXJOBS
=1
380 # The actual hardware
381 printf 'all:\n' > t.mk.io
382 if ( ${MAKE} -j 10 -f t.mk.io
) >/dev
/null
2>&1; then
383 if command -v nproc
>/dev
/null
2>&1; then
384 i
=`nproc 2>/dev/null`
385 [ ${?} -eq 0 ] && MAXJOBS
=${i}
387 i
=`getconf _NPROCESSORS_ONLN 2>/dev/null`
389 if [ ${j} -ne 0 ]; then
390 i
=`getconf NPROCESSORS_ONLN 2>/dev/null`
393 if [ ${j} -ne 0 ]; then
395 if command -v kstat
>/dev
/null
2>&1; then
396 i
=`PERL5OPT= kstat -p cpu | ${awk} '
398 {if($2 > no) max = $2; next}
404 if [ ${j} -eq 0 ] && [ -n "${i}" ]; then
405 printf 'Job number derived from CPU number: %s\n' ${i}
409 [ "${MAXJOBS}" -eq 0 ] && MAXJOBS
=1
415 ( sleep .1 ) >/dev
/null
2>&1 && sleep_subsecond
=1 || sleep_subsecond
=
417 printf 'Starting job reaper (timeout of %s seconds)\n' ${JOBWAIT}
421 # There were problems when using monitor mode with mksh
422 i
=`env -i ${SHELL} -c 'echo $KSH_VERSION'`
423 if [ -n "${i}" ]; then
424 if [ "${i}" != "${i#*MIRBSD}" ]; then
429 if [ -n "${JOBMON}" ]; then
430 ( set -m ) </dev
/null
>/dev
/null
2>&1 || JOBMON
=
432 printf >&2 '%s! $JOBMON: $SHELL %s incapable, disabled!%s\n' \
433 "${COLOR_ERR_ON}" "${SHELL}" "${COLOR_ERR_OFF}"
434 printf >&2 '%s! No process groups available, killed tests may '\
435 'leave process "zombies"!%s\n' \
436 "${COLOR_ERR_ON}" "${COLOR_ERR_OFF}"
445 trap 'i=1' USR1
# "reaper is up"
446 ( # .. which is actually a notify timer only
449 trap '' EXIT HUP QUIT CHLD
452 [ -n "${sleeper}" ] && kill -TERM ${sleeper} >/dev/null 2>&1
456 [ -n "${sleeper}" ] && kill -TERM ${sleeper} >/dev/null 2>&1
460 [ -n "${sleeper}" ] && kill -TERM ${sleeper} >/dev/null 2>&1
461 echo "Stopping job reaper"
465 # traps are setup, notify parent that we are up and running
466 kill -USR1 ${parent} >/dev
/null
2>&1
470 </dev
/null
${cat} >/dev
/null
475 [ "${int}${hot}" = 01 ] && kill -USR1 ${parent} >/dev/null 2>&1
477 ) </dev/null >/dev/null 2>&1 &
481 if [ ${?} -eq 0 ]; then
483 if [ -n "${i}" ]; then
487 printf '..%s waiting for job reaper to come up\n' "${j}"
495 printf >&2 '%s! Cannot start the wild job reaper!%s\n' \
496 "${COLOR_ERR_ON}" "${COLOR_ERR_OFF}"
500 [ -n "${JOBREAPER}" ] && kill -TERM ${JOBREAPER} >/dev/null 2>&1
502 if [ ${JOBS} -gt 0 ]; then
503 echo 'Cleaning up running jobs'
511 if [ -n "${CHECK}" ] && [ -n "${SKIPTEST}" ]; then
517 while [ ${#} -gt 0 ]; do
518 if [ "${1}" != "${j}" ]; then
519 SKIPTEST="${SKIPTEST} ${1}"
520 elif [ -z "${k}" ]; then
526 [ -n "${k}" ] && return
530 if [ ${MAXJOBS} -gt 1 ]; then
531 # We are spawning multiple jobs..
532 [ ${JOBS} -eq 0 ] && printf '...'
534 printf ' [%s=%s]' ${JOBS} "${1}"
537 # Assume problems exist, do not let user keep hanging on terminal
538 if [ -n "${RUN_TEST}" ]; then
539 printf '... [%s]\n' "${1}"
543 [ -n "${JOBMON}" ] && set -m >/dev/null 2>&1
544 ( # Place the job in its own directory to ease file management
545 trap '' EXIT HUP INT QUIT TERM USR1 USR2
546 ${mkdir} t.${JOBS}.d && cd t.${JOBS}.d &&
547 eval t_${1} ${JOBS} ${1} &&
548 ${rm} -f ../t.${JOBS}.id
549 ) > t.${JOBS}.io </dev/null & # 2>&1 </dev/null &
551 [ -n "${JOBMON}" ] && set +m >/dev/null 2>&1
552 JOBLIST="${JOBLIST} ${i}"
553 printf '%s\n%s\n' ${i} ${1} > t.${JOBS}.id
555 # ..until we should sync or reach the maximum concurrent number
556 [ ${JOBS} -lt ${MAXJOBS} ] && return
562 if [ ${JOBS} -eq 0 ]; then
563 [ -n "${TEST_ANY}" ] && printf '\n'
567 [ -z "${JOBSYNC}" ] && [ ${#} -eq 0 ] && return
569 [ ${MAXJOBS} -ne 1 ] && printf ' .. waiting\n'
571 if [ -n "${JOBREAPER}" ]; then
574 trap 'timeout=1' USR1
575 kill -USR1 ${JOBREAPER} >/dev/null 2>&1
578 while [ -z "${timeout}" ]; do
581 while [ ${i} -lt ${JOBS} ]; do
583 [ -f t.${i}.id ] || continue
587 [ -n "${alldone}" ] && break
589 if [ -z "${sleep_subsecond}" ]; then
590 loops=`add ${loops} 1`
591 [ ${loops} -lt 111 ] && continue
599 kill -USR2 ${JOBREAPER} >/dev/null 2>&1
602 [ -n "${timeout}" ] && jtimeout
605 # Now collect the zombies
609 # Update global counters
611 while [ ${i} -lt ${JOBS} ]; do
614 [ -s t.${i}.io ] && ${cat} t.${i}.io
615 if [ -n "${DUMPERR}" ] && [ -s ./t.${i}.d/${ERR} ]; then
616 printf '%s [Debug/Devel: nullified errors]\n' "${COLOR_ERR_ON}"
618 printf ' %s\n' "${l}"
619 done < t.
${i}.d
/${ERR}
620 printf '%s' "${COLOR_ERR_OFF}"
623 if [ -f t.
${i}.id
]; then
624 { read pid
; read desc
; } < t.
${i}.id
625 desc
=${desc#${desc%%[! ]*}}
626 desc
=${desc%${desc##*[! ]}}
627 [ -s t.
${i}.io
] && printf >&2 '\n'
628 printf >&2 '%s!! Timeout: reaped job %s [%s]%s\n' \
629 "${COLOR_ERR_ON}" ${i} "${desc}" "${COLOR_ERR_OFF}"
630 TESTS_FAILED
=`add ${TESTS_FAILED} 1`
631 elif [ -s t.
${i}.result
]; then
632 read es tp to tf ts
< t.
${i}.result
633 TESTS_PERFORMED
=`add ${TESTS_PERFORMED} ${tp}`
634 TESTS_OK
=`add ${TESTS_OK} ${to}`
635 TESTS_FAILED
=`add ${TESTS_FAILED} ${tf}`
636 TESTS_SKIPPED
=`add ${TESTS_SKIPPED} ${ts}`
637 [ "${es}" != 0 ] && ESTAT
=${es}
639 TESTS_FAILED
=`add ${TESTS_FAILED} 1`
644 [ -z "${MAILX_CC_TEST_NO_CLEANUP}" ] &&
645 ${rm} -rf .
/t.
*.d .
/t.
*.id .
/t.
*.io t.
*.result
652 while [ ${i} -lt ${JOBS} ]; do
654 if [ -f t.
${i}.id
] &&
655 read pid
< t.
${i}.id
>/dev
/null
2>&1 &&
656 kill -0 ${pid} >/dev
/null
2>&1; then
658 [ -n "${JOBMON}" ] && j
=-${j}
659 kill -KILL ${j} >/dev
/null
2>&1
667 # echoes, checks, etc. {{{
671 ESTAT
=0 TESTS_PERFORMED
=0 TESTS_OK
=0 TESTS_FAILED
=0 TESTS_SKIPPED
=0 \
672 TEST_NAME
=${1} TEST_ANY
=
674 printf '%s[%s]%s\n' "" "${TEST_NAME}" ""
678 [ -n "${TEST_ANY}" ] && printf '\n'
680 printf '%s %s %s %s %s\n' \
682 ${TESTS_PERFORMED} ${TESTS_OK} ${TESTS_FAILED} ${TESTS_SKIPPED} \
687 [ -n "${TEST_ANY}" ] && __i__
=' ' || __i__
=
688 printf "${__i__}"'%s' "${*}"
693 [ -n "${TEST_ANY}" ] && __i__
=' ' || __i__
=
694 printf "${__i__}"'%s%s:ok%s' "${COLOR_OK_ON}" "${*}" "${COLOR_OK_OFF}"
704 [ -n "${TEST_ANY}" ] && __i__
="\n" || __i__
=
705 printf "${__i__}"'%sERROR: %s%s\n' \
706 "${COLOR_ERR_ON}" "${*}" "${COLOR_ERR_OFF}"
711 [ -n "${TEST_ANY}" ] && __i__
=' ' || __i__
=
712 printf "${__i__}"'%s%s%s' "${COLOR_WARN_ON}" "${*}" "${COLOR_WARN_OFF}"
717 [ -n "${TEST_ANY}" ] && __i__
=' ' || __i__
=
718 printf "${__i__}"'%s%s[skip]%s' \
719 "${COLOR_WARN_ON}" "${*}" "${COLOR_WARN_OFF}"
721 TESTS_SKIPPED
=`add ${TESTS_SKIPPED} 1`
725 restat
=${?} tid=${1} eestat=${2} f=${3} s=${4} optmode=${5}
727 TESTS_PERFORMED
=`add ${TESTS_PERFORMED} 1`
732 [ "$eestat" = - ] ||
exit 200
734 [ -f "${f}" ] && break
735 t_echowarn
"[${tid}:async=wait]"
743 check__bad
= check__runx
=
745 if [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ]; then
747 t_echoerr
"${tid}: bad-status: ${restat} != ${eestat}"
751 csum
="`${cksum} < "${f}" | ${sed} -e 's/[ ]\{1,\}/ /g'`"
752 if [ "${csum}" = "${s}" ]; then
754 check__runx
=${DEVELDIFF}
757 t_echoerr
"${tid}: checksum mismatch (got ${csum})"
758 check__bad
=1 check__runx
=1
761 if [ -z "${check__bad}" ]; then
762 TESTS_OK
=`add ${TESTS_OK} 1`
764 TESTS_FAILED
=`add ${TESTS_FAILED} 1`
767 if [ -n "${CHECK}${RUN_TEST}" ]; then
768 x
="t.${TEST_NAME}-${tid}"
769 if [ -n "${RUN_TEST}" ] ||
770 [ -n "${check__runx}" -a -n "${GIT_REPO}" ]; then
771 ${cp} -f "${f}" ../"${x}"
774 if [ -n "${check__runx}" ] && [ -n "${GIT_REPO}" ] &&
775 command -v diff >/dev/null 2>&1; then
777 if (git rev-parse --verify $y) >/dev/null 2>&1; then :; else
778 y=refs/remotes/origin/test-out
779 (git rev-parse --verify $y) >/dev/null 2>&1 || y=
781 if [ -n "${y}" ]; then
782 if GIT_CONFIG=/dev/null git show "${y}":"${x}" > \
783 ../"${x}".old 2>/dev/null; then
784 diff -ru ../"${x}".old ../"${x}" > ../"${x}".diff
785 if [ ${?} -eq 0 ]; then
786 [ -z "${MAILX_CC_TEST_NO_CLEANUP}" ] &&
787 ${rm} -f ../"${x}" ../"${x}".old ../"${x}".
diff
788 elif [ -n "${MAILX_CC_ALL_TESTS_DUMPERR}" ]; then
790 printf 'ERROR-DIFF %s\n' "${l}"
791 done < ..
/"${x}".
diff
794 t_echo0err
"${tid}: misses [test-out] template"
802 # $1=test name [$2=status]
804 [ ${#} -gt 1 ] && __qm__
=${2}
806 TESTS_PERFORMED
=`add ${TESTS_PERFORMED} 1`
808 if [ ${__qm__} -ne 0 ]; then
810 t_echoerr
"${1}: unexpected non-0 exit status: ${__qm__}"
811 TESTS_FAILED
=`add ${TESTS_FAILED} 1`
814 TESTS_OK
=`add ${TESTS_OK} 1`
819 # $1=test name [$2=status]
821 [ ${#} -gt 1 ] && __qm__
=${2}
822 [ ${#} -gt 2 ] && __expect__
=${3} || __expect__
=
824 TESTS_PERFORMED
=`add ${TESTS_PERFORMED} 1`
826 if [ ${__qm__} -eq 0 ]; then
828 t_echoerr
"${1}: unexpected 0 exit status: ${__qm__}"
829 TESTS_FAILED
=`add ${TESTS_FAILED} 1`
830 elif [ -n "${__expect__}" ] && [ ${__expect__} -ne ${__qm__} ]; then
832 t_echoerr "${1}: unexpected exit status: ${__qm__} != ${__expected__}"
833 TESTS_FAILED=`add ${TESTS_FAILED} 1`
836 TESTS_OK=`add ${TESTS_OK} 1`
842 [ -n "${NOCOLOUR}" ] && return
843 [ -n "${MAILX_CC_TEST_NO_COLOUR}" ] && return
844 # We do not want color for "make test > .LOG
"!
845 if command -v stty >/dev/null 2>&1 && command -v tput >/dev/null 2>&1 &&
846 (<&1 >/dev/null stty -a) 2>/dev/null; then
847 { sgr0=`tput sgr0`; } 2>/dev/null
848 [ $? -eq 0 ] || return
849 { saf1=`tput setaf 1`; } 2>/dev/null
850 [ $? -eq 0 ] || return
851 { saf2=`tput setaf 2`; } 2>/dev/null
852 [ $? -eq 0 ] || return
853 { saf3=`tput setaf 3`; } 2>/dev/null
854 [ $? -eq 0 ] || return
855 { b=`tput bold`; } 2>/dev/null
856 [ $? -eq 0 ] || return
858 COLOR_ERR_ON=${saf1}${b} COLOR_ERR_OFF=${sgr0}
859 COLOR_WARN_ON=${saf3}${b} COLOR_WARN_OFF=${sgr0}
860 COLOR_OK_ON=${saf2} COLOR_OK_OFF=${sgr0}
861 unset saf1 saf2 saf3 b
865 if ( [ "$
((1 + 1))" = 2 ] ) >/dev/null 2>&1; then
867 echo "$
((${1} + ${2}))"
871 ${awk} 'BEGIN{print '${1}' + '${2}'}'
875 if ( [ "$
((2 % 3))" = 2 ] ) >/dev/null 2>&1; then
877 echo "$
((${1} % ${2}))"
881 ${awk} 'BEGIN{print '${1}' % '${2}'}'
886 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
887 ${grep} +${1}, ) >/dev/null 2>&1
891 # Absolute Basics {{{
892 t_X_Y_opt_input_go_stack() {
895 ${cat} <<- '__EOT' > "${BODY}"
903 echo "define mac1
{";\
904 echo " echo mac1-1 via1 \
$0";\
906 echo " echo mac1-2
";\
908 echo " echo mac1-3
";\
911 echo "define mac2
{";\
912 echo " echo mac2-1 via1 \
$0";\
914 echo " echo mac2-2
";\
920 echo echo 1-1-1 via1 \
$0;\
932 # The -X option supports multiline arguments, and those can internally use
933 # reverse solidus newline escaping. And all -X options are joined...
935 < "${BODY}" ${MAILX} ${ARGS} \
950 echo "define mac1 {";\
951 echo " echo mac1-1 via2 \$0";\
953 echo " echo mac1-2";\
955 echo " echo mac1-3";\
958 echo "define mac2 {";\
959 echo " echo mac2-1 via2 \$0";\
961 echo " echo mac2-2";\
967 echo echo 1-1-1 via2 \$0;\
981 check
1 0 "${MBOX}" '1786542668 416'
983 # The -Y option supports multiline arguments, and those can internally use
984 # reverse solidus newline escaping.
986 < "${BODY}" ${MAILX} ${ARGS} \
1003 echo "define mac1
{";\
1004 echo " echo mac1-1 via2 \
$0";\
1006 echo " echo mac1-2
";\
1008 echo " echo mac1-3
";\
1011 echo "define mac2
{";\
1012 echo " echo mac2-1 via2 \
$0";\
1014 echo " echo mac2-2
";\
1020 echo echo 1-1-1 via2 \
$0;\
1033 -Y 'echo LAST_Y' > "${MBOX}"
1035 check 2 0 "${MBOX}" '1845176711 440'
1037 # Compose mode, too!
1038 </dev/null ${MAILX} ${ARGS} \
1039 -X 'echo X before compose mode' \
1040 -Y '~s Subject via -Y' \
1041 -Y 'Body via -Y' -. ./.tybox > "${MBOX}" 2>&1
1042 check 3 0 ./.tybox '264636255 125'
1043 check 4 - "${MBOX}" '467429373 22'
1045 ${cat} <<-_EOT | ${MAILX} ${ARGS} -t \
1046 -X 'echo X before compose mode' \
1047 -Y '~s Subject via -Y' \
1048 -Y 'Additional body via -Y' -. ./.tybox > "${MBOX}" 2>&1
1050 subject:diet not to be seen!
1054 check 5 0 ./.tybox '3313167452 299'
1055 check 6 - "${MBOX}" '467429373 22'
1058 printf 'this body via stdin pipe.\n' | ${MAILX} ${NOBATCH_ARGS} \
1059 -X 'echo X before compose mode' \
1060 -Y '~s Subject via -Y (not!)' \
1061 -Y 'Additional body via -Y, nobatch mode' -. ./.tybox > "${MBOX}" 2>&1
1062 check 7 0 ./.tybox '1561798488 476'
1063 check 8 - "${MBOX}" '467429373 22'
1065 printf 'this body via stdin pipe.\n' | ${MAILX} ${ARGS} \
1066 -X 'echo X before compose mode' \
1067 -Y '~s Subject via -Y' \
1068 -Y 'Additional body via -Y, batch mode' -. ./.tybox > "${MBOX}" 2>&1
1069 check 9 0 ./.tybox '3245082485 650'
1070 check 10 - "${MBOX}" '467429373 22'
1072 # Test for [8412796a] (n_cmd_arg_parse(): FIX token error -> crash, e.g.
1073 # "-RX 'bind;echo $?' -Xx".., 2018-08-02)
1074 ${MAILX} ${ARGS} -RX'call;echo $?' -Xx > ./.tall 2>&1
1075 ${MAILX} ${ARGS} -RX'call ;echo $?' -Xx >> ./.tall 2>&1
1076 ${MAILX} ${ARGS} -RX'call ;echo $?' -Xx >> ./.tall 2>&1
1077 ${MAILX} ${ARGS} -RX'call ;echo $?' -Xx >> ./.tall 2>&1
1078 check cmdline 0 ./.tall '1867586969 8'
1086 if have_feat uistrings; then :; else
1087 t_echoskip '[!UISTRINGS]'
1092 ${cat} <<- '__EOT' > "${BODY}"
1098 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
1099 -X'echo one' -X' echos nono ' -X'echo two' \
1101 check 1 0 "${MBOX}" '2700500141 51'
1103 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
1105 check
2 0 "${MBOX}" '2700500141 51'
1107 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Snomemdebug \
1109 check 3 0 "${MBOX}" '2700500141 51'
1113 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1114 -X'echo one' -X' echos nono ' -X'echo two' \
1116 check 4 1 "${MBOX}" '4096689457 47'
1118 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
1120 check
5 1 "${MBOX}" '4096689457 47'
1122 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
1124 check 6 1 "${MBOX}" '1669262132 170'
1126 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Sposix -Snomemdebug \
1128 check
7 1 "${MBOX}" '1669262132 170'
1130 ## Repeat 4-7 with ignerr set
1132 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
1134 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1135 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
1137 check 8 0 "${BODY}" '2700500141 51'
1139 </dev/null ${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
1141 check
9 0 "${BODY}" '2700500141 51'
1143 </dev
/null MAILRC
="${MBOX}" ${MAILX} ${ARGS} -:u -Serrexit -Snomemdebug \
1145 check 10 0 "${BODY}" '2700500141 51'
1147 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u
-Sposix -Snomemdebug \
1149 check
11 0 "${BODY}" '2700500141 51'
1151 # Ensure "good-injection" in a deeper indirection does not cause trouble
1152 # This actually only works with MLE and HISTORY, and TODO needs a pseudo TTY
1153 # interaction so that we DO initialize our line editor...
1154 ${cat} <<- '__EOT' > "${BODY}"
1165 printf 'source %s\ncall x\necho au' "${BODY}" |
1166 ${MAILX} ${ARGS} -Snomemdebug -Sxarg=errexit > "${MBOX}" 2>&1
1167 check 12 1 "${MBOX}" '2908921993 44'
1169 printf 'source %s\nset on-history-addition=oha\ncall x\necho au' "${BODY}" |
1170 ${MAILX} ${ARGS} -Snomemdebug -Sxarg=errexit > "${MBOX}" 2>&1
1171 check 13 1 "${MBOX}" '2908921993 44'
1173 printf 'source %s\ncall x\necho au' "${BODY}" |
1174 ${MAILX} ${ARGS} -Snomemdebug -Sxarg=nowhere > "${MBOX}" 2>&1
1175 check 14 0 "${MBOX}" '2049365617 47'
1183 if have_feat uistrings; then :; else
1184 t_echoskip '[!UISTRINGS]'
1189 ${cat} <<- '__EOT' > "${BODY}"
1195 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
1196 -Y'echo one' -Y' echos nono ' -Y'echo two' \
1198 check 1 0 "${MBOX}" '2700500141 51'
1200 </dev/null ${MAILX} ${ARGS} -Y'source '"${BODY}" -Snomemdebug \
1202 check 2 0 "${MBOX}" '2700500141 51'
1206 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1207 -Y'echo one' -Y' echos nono ' -Y'echo two' \
1209 check 3 1 "${MBOX}" '4096689457 47'
1211 </dev/null ${MAILX} ${ARGS} -Y'source '"${BODY}" -Serrexit -Snomemdebug \
1213 check 4 1 "${MBOX}" '4096689457 47'
1215 ## Repeat 3-4 with ignerr set
1217 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
1219 </dev/null ${MAILX} ${ARGS} -Serrexit -Snomemdebug \
1220 -Y'echo one' -Y'ignerr echos nono ' -Y'echo two' \
1222 check 5 0 "${BODY}" '2700500141 51'
1224 </dev/null ${MAILX} ${ARGS} -Y'source '"${MBOX}" -Serrexit -Snomemdebug \
1226 check 6 0 "${BODY}" '2700500141 51'
1236 # Test basic assumption
1237 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} \
1238 -X'echo asksub<$asksub> dietcurd<$dietcurd>' \
1239 -Xx > "${MBOX}" 2>&1
1240 check 1 0 "${MBOX}" '270686329 21'
1243 ${cat} <<- '__EOT' > "${BODY}"
1244 echo asksub<$asksub>
1246 echo asksub<$asksub>
1248 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1249 -Snoasksub -Sasksub -Snoasksub \
1250 -X'echo asksub<$asksub>' -X'set asksub' -X'echo asksub<$asksub>' \
1251 -Xx > "${MBOX}" 2>&1
1252 check
2 0 "${MBOX}" '3182942628 37'
1254 ${cat} <<- '__EOT' > "${BODY}"
1255 echo asksub<$asksub>
1257 echo asksub<$asksub>
1259 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1260 -Snoasksub -Sasksub \
1261 -X'echo asksub<$asksub>' -X'unset asksub' -X'echo asksub<$asksub>' \
1262 -Xx > "${MBOX}" 2>&1
1263 check
3 0 "${MBOX}" '2006554293 39'
1266 ${cat} <<- '__EOT' > "${BODY}"
1267 echo dietcurd<$dietcurd>
1269 echo dietcurd<$dietcurd>
1271 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1272 -Sdietcurd=strawberry
-Snodietcurd -Sdietcurd=vanilla \
1273 -X'echo dietcurd<$dietcurd>' -X'unset dietcurd' \
1274 -X'echo dietcurd<$dietcurd>' \
1275 -Xx > "${MBOX}" 2>&1
1276 check
4 0 "${MBOX}" '1985768109 65'
1278 ${cat} <<- '__EOT' > "${BODY}"
1279 echo dietcurd<$dietcurd>
1281 echo dietcurd<$dietcurd>
1283 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1284 -Sdietcurd=strawberry
-Snodietcurd \
1285 -X'echo dietcurd<$dietcurd>' -X'set dietcurd=vanilla' \
1286 -X'echo dietcurd<$dietcurd>' \
1287 -Xx > "${MBOX}" 2>&1
1288 check
5 0 "${MBOX}" '151574279 51'
1290 # TODO once we have a detached one with env=1..
1291 if [ -n "`</dev/null ${MAILX} ${ARGS} -X'!echo \$TERM' -Xx`" ]; then
1292 t_echoskip
's_freeze-{6,7}:[shell sets $TERM]'
1294 ${cat} <<- '__EOT' > "${BODY}"
1295 !echo "shell says TERM<$TERM>"
1297 !echo "shell says TERM<$TERM>"
1299 !echo "shell says TERM<$TERM>"
1301 !echo "shell says TERM<$TERM>"
1303 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1304 -STERM=strawberry
-SnoTERM -STERM=vanilla \
1305 -X'echo mail<$TERM>' -X'unset TERM' \
1306 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
1307 -Xx > "${MBOX}" 2>&1
1308 check
6 0 "${MBOX}" '1211476036 167'
1310 ${cat} <<- '__EOT' > "${BODY}"
1311 !echo "shell says TERM<$TERM>"
1313 !echo "shell says TERM<$TERM>"
1315 !echo "shell says TERM<$TERM>"
1317 !echo "shell says TERM<$TERM>"
1319 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u \
1320 -STERM=strawberry
-SnoTERM \
1321 -X'echo TERM<$TERM>' -X'set TERM=vanilla' \
1322 -X'!echo "shell says TERM<$TERM>"' -X'echo TERM<$TERM>' \
1323 -Xx > "${MBOX}" 2>&1
1324 check
7 0 "${MBOX}" '3365080441 132'
1334 t__gen_msg subject f-batch-order
> "${MBOX}"
1336 # This would exit 64 (EX_USAGE) from ? to [fbddb3b3] (FIX: -f: add
1337 # n_PO_f_FLAG to avoid that command line order matters)
1338 </dev
/null
${MAILX} ${NOBATCH_ARGS} -R -f -# \
1339 -Y 'echo du;h;echo da;x' "${MBOX}" >.
/.tall
2>&1
1340 check
1 0 .
/.tall
'1690247457 86'
1342 # And this ever worked (hopefully)
1343 </dev
/null
${MAILX} ${NOBATCH_ARGS} -R -# -f \
1344 -Y 'echo du;h;echo da;x' "${MBOX}" >.
/.tall
2>&1
1345 check
2 0 .
/.tall
'1690247457 86'
1350 t_input_inject_semicolon_seq
() {
1353 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1355 echon '(mydeepmac)';
1358 echon this_is_mymac;call mydeepmac;echon ';';
1360 echon one';';call mymac;echon two";";call mymac;echo three$';';
1362 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
1364 echon one';';call mymac;echon two";";call mymac;echo three$';';
1367 check 1 0 "${MBOX}" '512117110 140'
1375 ${cat} <<- '__EOT' > "${BODY}"
1394 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
1395 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
1396 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
1398 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
1399 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
1421 echo a$
'b\U000000'ds
1422 echo a$
'b\U0000000'dt
1423 echo a$
'b\U00000000'du
1433 if [ -z "${UTF8_LOCALE}" ]; then
1434 t_echoskip
'wysh-unicode:[no UTF-8 locale]'
1436 < "${BODY}" DIET
=CURD TIED
= \
1437 LC_ALL
=${UTF8_LOCALE} ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1438 check unicode
0 "${MBOX}" '475805847 317'
1441 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1442 check c 0 "${MBOX}" '1473887148 321'
1444 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1445 wysh
set mager
='\hey\'
1447 wysh set mager="\hey\\"
1449 wysh set mager=$'\hey
\\'
1452 check 3 0 "${MBOX}" '1289698238 69'
1460 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1461 commandalias echo echo hoho
1465 commandalias XxX XxXx
1466 commandalias XxXx XxXxX
1467 commandalias XxXxX XxXxXx
1468 commandalias XxXxXx echo huhu
1469 commandalias XxXxXxX echo huhu
1471 commandalias XxXxXx XxXxXxX
1474 commandalias XxXxXx echo huhu
1478 check 1 0 "${MBOX}" '1638809585 36'
1486 # In POSIX C181 standard order
1487 </dev/null ${MAILX} ${ARGS} \
1488 -Y 'echon alias
/a\
; ? a
; echon group
/g\
; ?g
' \
1489 -Y 'echon alternates
/alt\
; ? alt
' \
1490 -Y 'echon chdir
/ch\
; ? ch
' \
1491 -Y 'echon copy
/c\
; ? c
; echon Copy
/C\
; ?C
' \
1492 -Y 'echon delete
/d\
; ? d
' \
1493 -Y 'echon discard
/di\
; ? di
; echon ignore
/ig\
; ?ig
' \
1494 -Y 'echon echo
/ec\
; ? ec
' \
1495 -Y 'echon edit
/e\
; ? e
' \
1496 -Y 'echon exit
/ex\
; ? ex
; echon xit
/x\
; ?x
' \
1497 -Y 'echon file
/fi\
; ?
fi; echon folder
/fold\
; ?
fold' \
1498 -Y 'echon followup
/fo\
; ? fo
; echon Followup
/F\
; ?F
' \
1499 -Y 'echon from
/f\
; ? f
' \
1500 -Y 'echon headers
/h\
; ? h
' \
1501 -Y 'echon help
/hel\
; ? hel
' \
1502 -Y 'echon hold
/ho\
; ? ho
; echon preserve
/pre\
; ? pre
' \
1503 -Y 'echon if
/i\
; ? i
; echon else
/el\
; ? el
; echon endif
/en\
; ? en
' \
1504 -Y 'echon list
/l\
; ? l
' \
1505 -Y 'echon mail
/m\
; ? m
' \
1506 -Y 'echon mbox
/mb\
; ? mb
' \
1507 -Y 'echon next
/n\
; ? n
' \
1508 -Y 'echon pipe
/pi\
; ? pi
' \
1509 -Y 'echon Print
/P\
; ? P
; echon Type
/T\
; ? T
' \
1510 -Y 'echon print
/p\
; ? p
; echon type
/t\
; ? t
' \
1511 -Y 'echon quit
/q\
; ? q
' \
1512 -Y 'echon Reply
/R\
; ? R
' \
1513 -Y 'echon reply
/r\
; ? r
' \
1514 -Y 'echon retain
/ret\
; ? ret
' \
1515 -Y 'echon save
/s\
; ? s
; echon Save
/S\
; ? S
' \
1516 -Y 'echon set
/se\
; ? se
' \
1517 -Y 'echon shell
/sh\
; ? sh
' \
1518 -Y 'echon size
/si\
; ? si
' \
1519 -Y 'echon source
/so\
; ? so
' \
1520 -Y 'echon touch
/tou\
; ? tou
' \
1521 -Y 'echon unalias
/una\
; ? una
' \
1522 -Y 'echon undelete
/u\
; ? u
' \
1523 -Y 'echon unset
/uns\
; ? uns
' \
1524 -Y 'echon visual
/v\
; ? v
' \
1525 -Y 'echon write
/w\
; ? w
' \
1526 | ${sed} -e 's
/:.
*$
//' > "${MBOX}"
1527 check 1 0 "${MBOX}" '1012680481 968'
1537 # XXX the first needs to be checked, it is quite dumb as such
1538 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1539 commandalias x echo '$?
/$^ERRNAME
'
1552 shcodec e a$'b
'c$'d
'
1554 shcodec d a$'b
'c$'d
'
1568 # same but with vput
1569 commandalias y echo '$?
/$^ERRNAME
$res'
1570 vput shcodec res e abcd
1574 vput shcodec res d abcd
1578 vput shcodec res e a'b
'c'd
'
1582 vput shcodec res d a'b
'c'd
'
1586 vput shcodec res e a"b"c"d"
1590 vput shcodec res d a"b"c"d"
1594 vput shcodec res e a$'b
'c$'d
'
1598 vput shcodec res d a$'b
'c$'d
'
1602 vput shcodec res e 'abcd
'
1606 vput shcodec res d 'abcd
'
1610 vput shcodec res e "abcd"
1614 vput shcodec res d "abcd"
1618 vput shcodec res e $'abcd
'
1622 vput shcodec res d $'abcd
'
1627 vput shcodec res e a b\ c d
1631 vput shcodec res d a b\ c d
1633 vput shcodec res e ab cd
1637 vput shcodec res d 'ab
cd'
1639 vput shcodec res e a 'b c
' d
1643 vput shcodec res d a 'b c
' d
1645 vput shcodec res e a "b c" d
1649 vput shcodec res d a "b c" d
1651 vput shcodec res e a $'b c
' d
1655 vput shcodec res d a $'b c
' d
1658 vput shcodec res e 'a$
`"\'
1662 vput shcodec res d 'a$`"\'
1664 vput shcodec res e "a\$\
`'\"\\"
1668 vput shcodec res d "a\$\`'\"\\"
1670 vput shcodec res e $'a\$
`\'\"\\'
1674 vput shcodec res d $'a\$`\'\"\\'
1676 vput shcodec res e $'a\$
`\'"\\'
1680 vput shcodec res d $'a\$`\'"\\'
1684 vput shcodec res e a${diet}c
1688 eval vput shcodec res e a${diet}c
1692 vput shcodec res e "a
${diet}c
"
1696 eval vput shcodec res e "a
${diet}c
"
1701 check 1 0 "${MBOX}" '3316745312 1241'
1703 if [ -z "${UTF8_LOCALE}" ]; then
1704 t_echoskip 'unicode:[no UTF-8 locale]'
1705 elif have_feat multibyte-charsets; then
1706 ${cat} <<- '__EOT' | LC_ALL=${UTF8_LOCALE} \
1707 ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
1711 shcodec d $'t\u00E4st'
1714 shcodec d $'a\u054Dc'
1717 shcodec d $'a\U0001D542c'
1719 check unicode 0 "${MBOX}" '1175985867 77'
1721 t_echoskip 'unicode:[!MULTIBYTE-CHARSETS]'
1730 # v15compat: old and new tests share the same result files!
1731 # v15compat: i.e., just throw away -old tests one day
1733 # Nestable conditions test
1734 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1756 if $dietcurd == 'yoho'
1761 if $dietcurd ==?
'Yoho'
1766 if $dietcurd == 'Yoho'
1771 if $dietcurd != 'yoho'
1776 if $dietcurd !=?
case 'Yoho'
1781 if $dietcurd != 'Yoho'
1842 if $dietcurd == 'yohu'
1844 elif $dietcurd == 'yoha'
1846 elif $dietcurd == 'yohe'
1848 elif $dietcurd == 'yoho'
1850 if $dietcurd == 'yohu'
1852 elif $dietcurd == 'yoha'
1854 elif $dietcurd == 'yohe'
1856 elif $dietcurd == 'yoho'
1858 if $dietcurd == 'yohu'
1860 elif $dietcurd == 'yoha'
1862 elif $dietcurd == 'yohe'
1864 elif $dietcurd == 'yoho'
1920 if $dietcurd ==?
case aBC
1925 if $dietcurd >=?ca AbC
1930 if $dietcurd <=? ABc
1935 if $dietcurd >=?
case abd
1940 if $dietcurd <=? abb
1968 if $dietcurd =%?
case aB
2013 set diet
=abc curd
=abc
2019 set diet
=abc curd
=abcd
2025 # 1. Shitty grouping capabilities as of today
2026 unset diet curd ndefined
2027 if [ [ false
] ||
[ false
] ||
[ true
] ] && \
2028 [ [ false
] ||
[ true
] ] && \
2034 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
2039 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
2044 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
2049 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
2054 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
2055 && [ no
] ||
[ yes ]
2060 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2065 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
2070 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
2075 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2080 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
2085 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
2090 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
2095 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
2100 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
2105 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
2111 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
2117 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
2122 # 2. Shitty grouping capabilities as of today
2123 unset diet curd ndefined
2124 if [ false || false || true
] && [ false || true
] && yes
2129 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
2134 if [ 1 ||
0 ||
0 ||
0 ]
2139 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
2144 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
2149 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
2154 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
2159 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
2164 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
2169 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
2174 if 1 ||
0 ||
0 ||
0 && 0
2179 if 1 ||
0 ||
0 ||
0 && 1
2184 if 0 ||
0 ||
0 ||
1 && 0
2189 if 0 ||
0 ||
0 ||
1 && 1
2194 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
2199 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
2205 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
2210 if $diet == 'yo' && $curd == 'ho' && $ndefined
2216 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
2221 if $diet == 'yo' && $curd == 'ho' && $ndefined
2226 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
2231 # Some more en-braced variables
2233 if ${diet} == ${curd}
2238 if ${diet} != ${curd}
2254 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
2259 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
2264 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2269 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
2274 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
2279 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2284 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
2289 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
2294 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
2300 if ! 0 && ! ! 1 && ! ! ! 0 && 3
2305 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
2310 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
2315 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
2320 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
2325 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
2330 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
2335 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
2340 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
2347 check normal-old
0 "${MBOX}" '1688759742 719' # pre v15compat
2349 if have_feat regex
; then
2350 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
2352 if $dietcurd =~ '^yo.*'
2357 if $dietcurd =~ '^Yo.*'
2362 if $dietcurd =~?case '^Yo.*'
2367 if $dietcurd =~ '^yOho.+'
2372 if $dietcurd !~? '.*Ho$'
2377 if $dietcurd !~ '.+yohO$'
2382 if [ $dietcurd !~?cas '.+yoho$' ]
2387 if ! [ $dietcurd =~?case '.+yoho$' ]
2392 if ! ! [ $dietcurd !~? '.+yoho$' ]
2397 if ! [ ! [ $dietcurd !~? '.+yoho$' ] ]
2402 if [ ! [ ! [ $dietcurd !~? '.+yoho$' ] ] ]
2407 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
2412 if ! ! ! $dietcurd !~ '.+yoho$'
2417 if ! ! ! $dietcurd =~ '.+yoho$'
2422 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
2427 set diet=abc curd='^abc$'
2433 set diet=abc curd='^abcd$'
2441 check regex-old 0 "${MBOX}" '1115671789 95' # pre v15compat
2443 t_echoskip 'regex-old:[no regex option]'
2448 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Sv15-compat=X > "${MBOX}"
2449 \
if -N xyz
; echo 1.err-1
; \
2450 \
elif ! -Z xyz
;echo 1.err-2
;\
2451 \
elif -n "$xyz" ; echo 1.err-3
; \
2452 \
elif ! -z "$xyz" ; echo 1.err-4
; \
2456 \
if ! -N xyz
; echo 2.err-1
; \
2457 \
elif -Z xyz
;echo 2.err-2
;\
2458 \
elif -n "$xyz" ; echo 2.err-3
; \
2459 \
elif ! -z "$xyz" ; echo 2.err-4
; \
2463 \
if ! -N xyz
; echo 3.err-1
; \
2464 \
elif -Z xyz
;echo 3.err-2
;\
2465 \
elif ! -n "$xyz";echo 3.err-3
;\
2466 \
elif -z "$xyz";echo 3.err-4
;\
2469 \
if $xyz != notempty
;echo 4.err-1
;else;echo 4.ok
;\end
2470 \
if $xyz == notempty
;echo 5.ok
;else;echo 5.err-1
;\end
2473 check NnZz_whiteout
0 "${MBOX}" '4280687462 25'
2475 # TODO t_ifelse: individual tests as for NnZz_whiteout
2476 # Nestable conditions test
2477 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Sv15-compat=x > "${MBOX}"
2488 if [ "$dietcurd" != "" ]
2494 if $'\$dietcurd' != ""
2499 if "$dietcurd" == 'yoho'
2504 if $'\$dietcurd' ==? 'Yoho'
2509 if $dietcurd == 'Yoho'
2514 if $dietcurd != 'yoho'
2519 if $dietcurd !=?case 'Yoho'
2524 if $dietcurd != 'Yoho'
2585 if $dietcurd == 'yohu'
2587 elif $dietcurd == 'yoha'
2589 elif $dietcurd == 'yohe'
2591 elif $dietcurd == 'yoho'
2593 if $dietcurd == 'yohu'
2595 elif $dietcurd == 'yoha'
2597 elif $dietcurd == 'yohe'
2599 elif $dietcurd == 'yoho'
2601 if $dietcurd == 'yohu'
2603 elif $dietcurd == 'yoha'
2605 elif $dietcurd == 'yohe'
2607 elif $dietcurd == 'yoho'
2647 if $dietcurd -ge?satu -0xFFFFFFFFFFFFFFFF1
2663 if $dietcurd ==?case aBC
2668 if $dietcurd >=?ca AbC
2673 if $dietcurd <=? ABc
2678 if $dietcurd >=?case abd
2683 if $dietcurd <=? abb
2711 if $dietcurd =%?case aB
2756 set diet='ab c' curd='ab c'
2757 if "$diet" == "$curd"
2762 set diet='ab c' curd='ab cd'
2763 if "$diet" != "$curd"
2768 # 1. Shitty grouping capabilities as of today
2769 unset diet curd ndefined
2770 if [ [ false ] || [ false ] || [ true ] ] && \
2771 [ [ false ] || [ true ] ] && \
2777 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
2782 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
2787 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
2792 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
2797 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
2798 && [ no ] || [ yes ]
2803 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2808 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
2813 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
2818 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
2823 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
2828 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
2833 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
2838 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
2843 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
2848 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
2854 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && \
2855 [ -N ndefined || -n "$ndefined" || \
2856 ! -Z ndefined || ! -z "$ndefined" ]
2862 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && \
2863 -N ndefined && ! -n "$ndefined" && \
2864 ! -Z ndefined && -z "$ndefined"
2869 # 2. Shitty grouping capabilities as of today
2870 unset diet curd ndefined
2871 if [ false || false || true ] && [ false || true ] && yes
2876 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
2881 if [ 1 || 0 || 0 || 0 ]
2886 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
2891 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
2896 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
2901 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
2906 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
2911 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
2916 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
2921 if 1 || 0 || 0 || 0 && 0
2926 if 1 || 0 || 0 || 0 && 1
2931 if 0 || 0 || 0 || 1 && 0
2936 if 0 || 0 || 0 || 1 && 1
2941 if 0 || 0 || 0 || 1 && 0 || 1 && 0
2946 if 0 || 0 || 0 || 1 && 0 || 1 && 1
2952 if [ $diet == 'yo' && $curd == 'ho' ] && \
2953 [ -N ndefined || -n "$ndefined" || \
2954 ! -Z ndefined || ! -z "$ndefined" ]
2959 if [ $diet == 'yo' && $curd == 'ho' && \
2960 [ [ -N ndefined || -n "$ndefined" || \
2961 ! -Z ndefined || ! -z "$ndefined" ] ] ]
2967 if [ $diet == 'yo' && $curd == 'ho' ] && \
2968 -N ndefined && ! -n "$ndefined" && \
2969 ! -Z ndefined && -z "$ndefined"
2974 if $diet == 'yo' && $curd == 'ho' && ! -Z ndefined
2979 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && -N ndefined ] ] ] ] ] ]
2984 # Some more en-braced variables
2986 if ${diet} == ${curd}
2991 if "${diet}" != "${curd}"
3007 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
3012 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
3017 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
3022 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
3027 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
3032 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
3037 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
3042 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
3047 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
3053 if ! 0 && ! ! 1 && ! ! ! 0 && 3
3058 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
3063 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
3068 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
3073 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
3078 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
3083 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
3088 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
3093 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
3100 check normal 0 "${MBOX}" '1688759742 719'
3102 if have_feat regex; then
3103 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Sv15-compat=X > "${MBOX}"
3105 if $dietcurd =~
'^yo.*'
3110 if "$dietcurd" =~
'^Yo.*'
3115 if $dietcurd =~?
case '^Yo.*'
3120 if $dietcurd =~
'^yOho.+'
3125 if $dietcurd !~?
'.*Ho$'
3130 if $dietcurd !~
'.+yohO$'
3135 if [ $dietcurd !~?cas
'.+yoho$' ]
3140 if ! [ "$dietcurd" =~?
case '.+yoho$' ]
3145 if ! ! [ $
'\$dietcurd' !~?
'.+yoho$' ]
3150 if ! [ ! [ $dietcurd !~?
'.+yoho$' ] ]
3155 if [ ! [ ! [ $dietcurd !~?
'.+yoho$' ] ] ]
3160 if ! [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
3165 if ! ! ! $dietcurd !~
'.+yoho$'
3170 if ! ! ! $dietcurd =~
'.+yoho$'
3175 if ! [ ! ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
3180 set diet
=abc curd
='^abc$'
3186 set diet
=abc curd
='^abcd$'
3187 if "$diet" !~ $
'\$curd'
3194 check regex
0 "${MBOX}" '1115671789 95'
3196 t_echoskip
'regex:[!REGEX]'
3205 # Nestable conditions test
3206 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3221 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
3226 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
3227 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
3236 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
3238 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
3247 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
3254 wysh set y=$1; shift; eval localopts $y; localopts $1; shift
3261 echo ----- $1: $2 -> $3 -> $4
3269 call llx 'call off' on on on
3270 call llx 'call off' off on on
3271 call llx 'call off' on off on
3272 call llx 'call off' on off off
3273 localopts call-fixate on
3274 call llx 'call-fixate on' on on on
3275 call llx 'call-fixate on' off on on
3276 call llx 'call-fixate on' on off on
3277 call llx 'call-fixate on' on off off
3278 unset x;localopts call on
3279 call llx 'call on' on on on
3280 call llx 'call on' off on on
3281 call llx 'call on' on off on
3282 call llx 'call on' on off off
3287 check 1 0 "${MBOX}" '4016155249 1246'
3295 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3323 echo ------- global-1 du
=$du
3325 echo ------- global-2 du
=$du
3328 echo ------- global-3 du
=$du
3330 echo ------- global-4 du
=$du
3332 echo ------- global-5 du
=$du
3334 check
1 0 "${MBOX}" '2411598140 641'
3337 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3339 echo z-1: x=$x y=$y z=$z crt=$crt
3340 local set z=1 y=2 crt=10
3341 echo z-2: x=$x y=$y z=$z crt=$crt
3344 echo y-1: x=$x y=$y z=$z crt=$crt
3345 local set x=2 y=1 crt=5
3346 echo y-2: x=$x y=$y z=$z crt=$crt
3348 echo y-3: x=$x y=$y z=$z crt=$crt
3351 echo x-1: x=$x y=$y z=$z crt=$crt
3353 echo x-2: x=$x y=$y z=$z crt=$crt
3355 echo x-3: x=$x y=$y z=$z crt=$crt
3358 echo global-1: x=$x y=$y z=$z crt=$crt
3360 echo global-2: x=$x y=$y z=$z crt=$crt
3362 check 2 0 "${MBOX}" '2560788669 216'
3370 ${cat} <<- '__EOT' | EK1=EV1 EK2=EV2 ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3371 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3372 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3373 varshow EK1 EK2 EK3 EK4 NEK5
3375 echo environ
set EK3 EK4
, set NEK5
3376 environ
set EK3
=EV3 EK4
=EV4
3378 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3379 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3380 varshow EK1 EK2 EK3 EK4 NEK5
3382 echo removing NEK5 EK3
3385 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3386 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3387 varshow EK1 EK2 EK3 EK4 NEK5
3389 echo changing EK1
, EK4
3390 set EK1
=EV1_CHANGED EK4
=EV4_CHANGED
3391 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3392 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3393 varshow EK1 EK2 EK3 EK4 NEK5
3395 echo linking EK4
, rechanging EK1
, EK4
3398 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3399 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3400 varshow EK1 EK2 EK3 EK4 NEK5
3404 echo "we: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3405 !echo "shell: EK1<$EK1> EK2<$EK2> EK3<$EK3> EK4<$EK4> NEK5<$NEK5>"
3406 varshow EK1 EK2 EK3 EK4 NEK5
3409 check
1 0 "${MBOX}" '1685686686 1342'
3415 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3417 echo '-------> L4 (environ unlink EK1, own localopts)'
3420 set LK1=LK1_L4 EK1=EK1_L4
3421 echo "we
: L4
: LK1
<$LK1> EK1
<$EK1>"
3422 !echo "shell
: L4
: LK1
<$LK1> EK1
<$EK1>"
3428 set LK1=LK1_L3 EK1=EK1_L3
3429 echo "we
: L3-pre
: LK1
<$LK1> EK1
<$EK1>"
3430 !echo "shell
: L3-pre
: LK1
<$LK1> EK1
<$EK1>"
3433 echo "we
: L3-post
: LK1
<$LK1> EK1
<$EK1>"
3434 !echo "shell
: L3-post
: LK1
<$LK1> EK1
<$EK1>"
3440 set LK1=LK1_L2 EK1=EK1_L2
3441 echo "we
: L2-pre
: LK1
<$LK1> EK1
<$EK1>"
3442 !echo "shell
: L2-pre
: LK1
<$LK1> EK1
<$EK1>"
3445 echo "we
: L2-post
: LK1
<$LK1> EK1
<$EK1>"
3446 !echo "shell
: L2-post
: LK1
<$LK1> EK1
<$EK1>"
3451 echo '-------> L1 (environ link EK1; localopts call-fixate)'
3452 localopts call-fixate yes
3453 set LK1=LK1_L1 EK1=EK1_L1
3455 echo "we
: L1-pre
: LK1
<$LK1> EK1
<$EK1>"
3456 !echo "shell
: L1-pre
: LK1
<$LK1> EK1
<$EK1>"
3459 echo "we
: L1-post
: LK1
<$LK1> EK1
<$EK1>"
3460 !echo "shell
: L1-post
: LK1
<$LK1> EK1
<$EK1>"
3464 echo "we
: outer-pre
: LK1
<$LK1> EK1
<$EK1>"
3465 !echo "shell
: outer-pre
: LK1
<$LK1> EK1
<$EK1>"
3468 echo "we
: outer-post
: LK1
<$LK1> EK1
<$EK1>"
3469 !echo "shell
: outer-post
: LK1
<$LK1> EK1
<$EK1>"
3473 check 2 0 "${MBOX}" '1903030743 1131'
3478 t_macro_param_shift() {
3481 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
3484 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3489 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3490 if [ $# > 1 ] || [ $ignerr == '' ]
3495 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3497 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3501 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
3506 call t2 1 you get four args
3507 echo t1.1: $?';' ignerr ($ignerr) should not exist
3508 call t2 1 you get 'three args'
3509 echo t1.2: $?';' ignerr ($ignerr) should not exist
3510 call t2 1 you 'get two args'
3511 echo t1.3: $?';' ignerr ($ignerr) should not exist
3512 call t2 1 'you get one arg'
3513 echo t1.4: $?';' ignerr ($ignerr) should not exist
3514 ignerr call t2 '' 'you get one arg'
3515 echo t1.5: $?';' ignerr ($ignerr) should not exist
3520 check 1 0 "${MBOX}" '1402489146 1682'
3528 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3529 commandalias x
echo '$?/$^ERRNAME $res'
3530 vput addrcodec res e
1 <doog@def
>
3532 eval vput addrcodec res d
$res
3534 vput addrcodec res e
2 .
<doog@def
>
3536 eval vput addrcodec res d
$res
3538 vput addrcodec res e
3 Sauer Dr.
<doog@def
>
3540 eval vput addrcodec res d
$res
3542 vput addrcodec res e
3.50 Sauer
(Ma
) Dr.
<doog@def
>
3544 eval vput addrcodec res d
$res
3546 vput addrcodec res e
3.51 Sauer
(Ma
) "Dr." <doog@def
>
3548 eval vput addrcodec res d
$res
3551 vput addrcodec res
+e
4 Sauer
(Ma
) Dr.
<doog@def
>
3553 eval vput addrcodec res d
$res
3555 vput addrcodec res
+e
5 Sauer
(Ma
) Braten Dr.
<doog@def
>
3557 eval vput addrcodec res d
$res
3559 vput addrcodec res
+e
6 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
>
3561 eval vput addrcodec res d
$res
3563 vput addrcodec res
+e
7 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
)
3565 eval vput addrcodec res d
$res
3567 vput addrcodec res
+e
8 \
3568 Dr. Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
) Boom. Boom
3570 eval vput addrcodec res d
$res
3572 vput addrcodec res
+e
9 Dr.Sauer
(Ma
)Braten Dr.
(Heu
) <doog@def
>
3574 eval vput addrcodec res d
$res
3576 vput addrcodec res
+e
10 (Ma
)Braten Dr.
(Heu
) <doog@def
>
3578 eval vput addrcodec res d
$res
3580 vput addrcodec res
+e
11 (Ma
)Braten Dr
"." (Heu
) <doog@def
>
3582 eval vput addrcodec res d
$res
3584 vput addrcodec res
+e
12 Dr. Sauer
(Ma
) Braten Dr.
(u
) <doog@def
>
3586 eval vput addrcodec res d
$res
3588 vput addrcodec res
+e
13(Ma
)Braten Dr.
(Heu
) <doog@def
>
3590 eval vput addrcodec res d
$res
3592 vput addrcodec res
+e
14 Hey
, Du
<doog@def
> Wie
() findet Dr. das?
()
3594 eval vput addrcodec res d
$res
3596 vput addrcodec res
+e
15 \
3597 Hey
, Du
<doog@def
> Wie
() findet
"" Dr.
"" das?
()
3599 eval vput addrcodec res d
$res
3601 vput addrcodec res
+e
16 \
3602 "Hey," "Du" <doog@def
> "Wie()" findet
"" Dr.
"" das?
()
3604 eval vput addrcodec res d
$res
3606 vput addrcodec res
+e
17 \
3607 "Hey" Du
<doog@def
> "Wie() findet " " Dr. """ das?
()
3609 eval vput addrcodec res d
$res
3611 vput addrcodec res
+e
18 \
3612 <doog@def
> "Hey" Du
"Wie() findet " " Dr. """ das?
()
3614 eval vput addrcodec res d
$res
3616 vput addrcodec res
+e
19 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
3618 eval vput addrcodec res d
$res
3621 vput addrcodec res
++e
20 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
3623 vput addrcodec res
++e
21 Hey\
,\"" <doog@def> "Wie
()" findet \" Dr. \" das?
3625 eval vput addrcodec res d $res
3628 vput addrcodec res \
3629 +++e 22 Hey\\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
3631 eval vput addrcodec res d $res
3634 vput addrcodec res s \
3635 "23 Hey
\\,\\\" \"Wie
" () "\" findet
\\\" Dr.
\\\" das?
" <doog@def>
3638 # Fix for [f3852f88]
3639 vput addrcodec res ++e <from2@exam.ple> 100 (comment) "Quot
(e
)d
"
3641 eval vput addrcodec res d $res
3643 vput addrcodec res e <from2@exam.ple> 100 (comment) "Quot
(e
)d
"
3645 eval vput addrcodec res d $res
3649 check 1 0 "${MBOX}" '1047317989 2612'
3651 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3652 commandalias x
echo '$?/$^ERRNAME $res'
3654 mlsubscribe isa2@list
3656 vput addrcodec res skin Hey
\\,\" <isa0@list
> "Wie()" find \" Dr.
\" das?
3658 vput addrcodec res skinlist Hey
\\,\" <isa0@list
> "Wie()" find \" Dr.
\" das?
3660 vput addrcodec res skin Hey
\\,\" <isa1@list
> "Wie()" find \" Dr.
\" das?
3662 vput addrcodec res skinlist Hey
\\,\" <isa1@list
> "Wie()" find \" Dr.
\" das?
3664 vput addrcodec res skin Hey
\\,\" <isa2@list
> "Wie()" find \" Dr.
\" das?
3666 vput addrcodec res skinlist Hey
\\,\" <isa2@list
> "Wie()" find \" Dr.
\" das?
3670 check
2 0 "${MBOX}" '1391779299 104'
3672 if have_feat idna
; then
3673 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} ${ADDARG_UNI} > "${MBOX}" 2>&1
3674 commandalias x echo '$?/$^ERRNAME $res'
3675 vput addrcodec res e (heu) <du@blödiän> "stroh
" du
3677 eval vput addrcodec res d $res
3679 vput addrcodec res e <du@blödiän> du
3681 eval vput addrcodec res d $res
3683 vput addrcodec res e du <du@blödiän>
3685 eval vput addrcodec res d $res
3687 vput addrcodec res e <du@blödiän>
3689 eval vput addrcodec res d $res
3691 vput addrcodec res e du@blödiän
3693 eval vput addrcodec res d $res
3697 check idna 0 "${MBOX}" '498775983 326'
3699 t_echoskip 'idna:[!IDNA]'
3708 if have_feat cmd-csop; then :; else
3709 t_echoskip '[!CMD_CSOP]'
3714 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3715 commandalias x
echo '$?/$^ERRNAME :$res:'
3717 vput csop res
find you y
;x
3718 vput csop res
find you o
;x
3719 vput csop res
find you u
;x
3720 vput csop res
find you yo
;x
3721 vput csop res
find you ou
;x
3722 vput csop res
find you you
;x
3724 vput csop res
find you Y
;x
3725 vput csop res
find? you Y
;x
3726 vput csop res
find?
case you O
;x
3727 vput csop res
find? you U
;x
3728 vput csop res
find?ca you yO
;x
3729 vput csop res
find? you oU
;x
3730 vput csop res
find? you YoU
;x
3732 vput csop res
find 'bananarama' 'nana';x
3733 vput csop res
find 'bananarama' 'bana';x
3734 vput csop res
find 'bananarama' 'Bana';x
3735 vput csop res
find 'bananarama' 'rama';x
3737 vput csop res
find?
'bananarama' 'nana';x
3738 vput csop res
find?
'bananarama' 'bana';x
3739 vput csop res
find?
'bananarama' 'Bana';x
3740 vput csop res
find?
'bananarama' 'rama';x
3742 vput csop res substring
'bananarama' 1;x
3743 vput csop res substring
'bananarama' 3;x
3744 vput csop res substring
'bananarama' 5;x
3745 vput csop res substring
'bananarama' 7;x
3746 vput csop res substring
'bananarama' 9;x
3747 vput csop res substring
'bananarama' 10;x
3748 vput csop res substring
'bananarama' 1 3;x
3749 vput csop res substring
'bananarama' 3 3;x
3750 vput csop res substring
'bananarama' 5 3;x
3751 vput csop res substring
'bananarama' 7 3;x
3752 vput csop res substring
'bananarama' 9 3;x
3753 vput csop res substring
'bananarama' 10 3;x
3755 vput csop res substring
'bananarama' -1;x
3756 vput csop res substring
'bananarama' -3;x
3757 vput csop res substring
'bananarama' -5;x
3758 vput csop res substring
'bananarama' -7;x
3759 vput csop res substring
'bananarama' -9;x
3760 vput csop res substring
'bananarama' -10;x
3761 vput csop res substring
'bananarama' 1 -3;x
3762 vput csop res substring
'bananarama' 3 -3;x
3763 vput csop res substring
'bananarama' 5 -3;x
3764 vput csop res substring
'bananarama' 7 -3;x
3765 vput csop res substring
'bananarama' 9 -3;x
3766 vput csop res substring
'bananarama' 10 -3;x
3768 vput csop res trim
'Cocoon Cocoon';x
3769 vput csop res trim
' Cocoon Cocoon ';x
3770 vput csop res trim-front
'Cocoon Cocoon';x
3771 vput csop res trim-front
' Cocoon Cocoon ';x
3772 vput csop res trim-end
'Cocoon Cocoon';x
3773 vput csop res trim-end
' Cocoon Cocoon ';x
3776 check
1 0 "${MBOX}" '1892119538 755'
3784 if have_feat cmd-vexpr
; then :; else
3785 t_echoskip
'[!CMD_VEXPR]'
3790 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>>${ERR}
3791 commandalias x
echo '$?/$^ERRNAME $res'
3793 vput vexpr res
= 9223372036854775807;x
3794 vput vexpr res
= 9223372036854775808;x
3795 vput vexpr res
= u9223372036854775808
;x
3796 vput vexpr res
=?
9223372036854775808;x
3797 vput vexpr res
= -9223372036854775808;x
3798 vput vexpr res
= -9223372036854775809;x
3799 vput vexpr res
=?saturated
-9223372036854775809;x
3800 vput vexpr res
= U9223372036854775809
;x
3803 0b0111111111111111111111111111111111111111111111111111111111111111
;x
3805 S0b1000000000000000000000000000000000000000000000000000000000000000
;x
3807 S0b1000000000000000000000000000000000000000000000000000000000000000
;x
3809 U0b1000000000000000000000000000000000000000000000000000000000000000
;x
3811 0b1000000000000000000000000000000000000000000000000000000000000000
;x
3813 0b1000000000000000000000000000000000000000000000000000000000000000
;x
3815 -0b1000000000000000000000000000000000000000000000000000000000000000;x
3817 S0b1000000000000000000000000000000000000000000000000000000000000001
;x
3819 S0b1000000000000000000000000000000000000000000000000000000000000001
;x
3821 -0b1000000000000000000000000000000000000000000000000000000000000001;x
3823 U0b1000000000000000000000000000000000000000000000000000000000000001
;x
3825 vput vexpr res
= 0777777777777777777777;x
3826 vput vexpr res
= S01000000000000000000000
;x
3827 vput vexpr res
=? S01000000000000000000000
;x
3828 vput vexpr res
= U01000000000000000000000
;x
3829 vput vexpr res
= 01000000000000000000000;x
3830 vput vexpr res
=?satur
01000000000000000000000;x
3831 vput vexpr res
= -01000000000000000000000;x
3832 vput vexpr res
= S01000000000000000000001
;x
3833 vput vexpr res
=?sat S01000000000000000000001
;x
3834 vput vexpr res
= -01000000000000000000001;x
3835 vput vexpr res
= U01000000000000000000001
;x
3837 vput vexpr res
= 0x7FFFFFFFFFFFFFFF;x
3838 vput vexpr res
= S0x8000000000000000
;x
3839 vput vexpr res
=? S0x8000000000000000
;x
3840 vput vexpr res
= U0x8000000000000000
;x
3841 vput vexpr res
= 0x8000000000000000;x
3842 vput vexpr res
=?
0x8000000000000000;x
3843 vput vexpr res
= -0x8000000000000000;x
3844 vput vexpr res
= S0x8000000000000001
;x
3845 vput vexpr res
=? S0x8000000000000001
;x
3846 vput vexpr res
= -0x8000000000000001;x
3847 vput vexpr res
= u0x8000000000000001
;x
3848 vput vexpr res
= 9223372036854775809;x
3849 vput vexpr res
=?
9223372036854775809;x
3850 vput vexpr res
= u9223372036854775809
;x
3852 vput vexpr res ~
0;x
3853 vput vexpr res ~
1;x
3854 vput vexpr res ~
-1;x
3856 vput vexpr res
- 0;x
3857 vput vexpr res
- 1;x
3858 vput vexpr res
- -1;x
3859 vput vexpr res
- -0xAFFE;x
3860 vput vexpr res
- 0xAFFE;x
3861 vput vexpr res
- u0x8000000000000001
;x
3862 vput vexpr res
- 0x8000000000000001;x
3863 vput vexpr res
- 0x8000000000000001;x
3864 vput vexpr res
- 9223372036854775809;x
3865 vput vexpr res
-?
9223372036854775809;x
3867 vput vexpr res
+ 0;x
3868 vput vexpr res
+ 1;x
3869 vput vexpr res
+ -1;x
3870 vput vexpr res
+ -0xAFFE;x
3871 vput vexpr res
+ 0xAFFE;x
3872 vput vexpr res
+ u0x8000000000000001
;x
3873 vput vexpr res
+ 0x8000000000000001;x
3874 vput vexpr res
+ 9223372036854775809;x
3875 vput vexpr res
+?
9223372036854775809;x
3877 vput vexpr res
+ 0 0;x
3878 vput vexpr res
+ 0 1;x
3879 vput vexpr res
+ 1 1;x
3881 vput vexpr res
+ 9223372036854775807 0;x
3882 vput vexpr res
+ 9223372036854775807 1;x
3883 vput vexpr res
+?
9223372036854775807 1;x
3884 vput vexpr res
+ 0 9223372036854775807;x
3885 vput vexpr res
+ 1 9223372036854775807;x
3886 vput vexpr res
+?
1 9223372036854775807;x
3888 vput vexpr res
+ -9223372036854775808 0;x
3889 vput vexpr res
+ -9223372036854775808 -1;x
3890 vput vexpr res
+?
-9223372036854775808 -1;x
3891 vput vexpr res
+ 0 -9223372036854775808;x
3892 vput vexpr res
+ -1 -9223372036854775808;x
3893 vput vexpr res
+?
-1 -9223372036854775808;x
3895 vput vexpr res
- 0 0;x
3896 vput vexpr res
- 0 1;x
3897 vput vexpr res
- 1 1;x
3899 vput vexpr res
- 9223372036854775807 0;x
3900 vput vexpr res
- 9223372036854775807 -1;x
3901 vput vexpr res
-?
9223372036854775807 -1;x
3902 vput vexpr res
- 0 9223372036854775807;x
3903 vput vexpr res
- -1 9223372036854775807;x
3904 vput vexpr res
- -2 9223372036854775807;x
3905 vput vexpr res
-?
-2 9223372036854775807;x
3907 vput vexpr res
- -9223372036854775808 +0;x
3908 vput vexpr res
- -9223372036854775808 +1;x
3909 vput vexpr res
-?
-9223372036854775808 +1;x
3910 vput vexpr res
- 0 -9223372036854775808;x
3911 vput vexpr res
- +1 -9223372036854775808;x
3912 vput vexpr res
-?
+1 -9223372036854775808;x
3914 vput vexpr res
+ -13 -2;x
3915 vput vexpr res
- 0 0;x
3916 vput vexpr res
- 0 1;x
3917 vput vexpr res
- 1 1;x
3918 vput vexpr res
- -13 -2;x
3920 vput vexpr res
* 0 0;x
3921 vput vexpr res
* 0 1;x
3922 vput vexpr res
* 1 1;x
3923 vput vexpr res
* -13 -2;x
3925 vput vexpr res
/ 0 0;x
3926 vput vexpr res
/ 0 1;x
3927 vput vexpr res
/ 1 1;x
3928 vput vexpr res
/ -13 -2;x
3930 vput vexpr res
% 0 0;x
3931 vput vexpr res
% 0 1;x
3932 vput vexpr res
% 1 1;x
3933 vput vexpr res
% -13 -2;x
3935 vput vexpr res pbase
10 u0x8000000000000001
;x
3936 vput vexpr res pbase
16 0x8000000000000001;x
3937 vput vexpr res pbase
16 s0x8000000000000001
;x
3938 vput vexpr res pbase
16 u0x8000000000000001
;x
3939 vput vexpr res pbase
36 0x8000000000000001;x
3940 vput vexpr res pbase
36 u0x8000000000000001
;x
3943 check numeric
0 "${MBOX}" '163128733 2519'
3945 if have_feat regex
; then
3946 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
3947 commandalias x echo '$?/$^ERRNAME :$res:'
3949 vput vexpr res regex you y;x
3950 vput vexpr res regex you o;x
3951 vput vexpr res regex you u;x
3952 vput vexpr res regex you yo;x
3953 vput vexpr res regex you ou;x
3954 vput vexpr res regex you you;x
3956 vput vexpr res regex you Y;x
3957 vput vexpr res regex? you Y;x
3958 vput vexpr res regex? you O;x
3959 vput vexpr res regex? you U;x
3960 vput vexpr res regex? you yO;x
3961 vput vexpr res regex? you oU;x
3962 vput vexpr res regex? you YoU;x
3964 vput vexpr res regex 'bananarama' 'nana';x
3965 vput vexpr res regex 'bananarama' 'bana';x
3966 vput vexpr res regex 'bananarama' 'Bana';x
3967 vput vexpr res regex 'bananarama' 'rama';x
3969 vput vexpr res regex? 'bananarama' 'nana';x
3970 vput vexpr res regex? 'bananarama' 'bana';x
3971 vput vexpr res regex? 'bananarama' 'Bana';x
3972 vput vexpr res regex? 'bananarama' 'rama';x
3974 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}';x
3975 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2';x
3976 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0';x
3977 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0';x
3979 vput vexpr res regex? 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}';x
3980 vput vexpr res regex? 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2';x
3981 vput vexpr res regex? 'bananarama' 'Bana(.+)' '\$1\$0';x
3982 vput vexpr res regex? 'bananarama' '(.+)rama' '\$1\$0';x
3984 vput vexpr res regex 'banana' '(club )?(.*)(nana)(.*)' \
3985 '\$1\${2}\$4\${3}rama';x
3986 vput vexpr res regex 'Banana' '(club )?(.*)(nana)(.*)' \
3987 '\$1\$2\${2}\$2\$4\${3}rama';x
3988 vput vexpr res regex 'Club banana' '(club )?(.*)(nana)(.*)' \
3989 '\$1\${2}\$4\${3}rama';x
3993 check regex 0 "${MBOX}" '2831099111 542'
3995 t_echoskip 'regex:[!REGEX]'
4004 if have_feat cmd-vexpr; then :; else
4005 t_echoskip '[!CMD_VEXPR]'
4010 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
4015 vput vexpr j
'&' $i 7
4021 vput vexpr j
'&' $i 7
4027 echo ! The end
for $1
4031 # Transport $?/$! up the call chain
4037 wysh
set i
=$? j
=$
! k
=$^ERRNAME
4041 echo ! The end
for $1
4042 return $i $^ERR-BUSY
4046 # Up and down it goes
4053 vput vexpr k
- $1 $2
4057 echo "# <$i/$j> .. "
4061 eval echon
"<\$1=\$i/\$^ERRNAME-$j "
4064 echo ! The end
for $1=$i/$2
4068 return $i $^ERR-BUSY
4074 call w1
0; echo ?
=$?
!=$
!; echo -----;
4075 call w2
0; echo ?
=$?
!=$^ERRNAME
; echo -----;
4076 call w3
0 1; echo ?
=$?
!=$^ERRNAME
; echo -----;
4079 check
1 0 "${MBOX}" '1572045517 5922'
4087 if have_feat cmd-vexpr
; then :; else
4088 t_echoskip
'[!CMD_VEXPR]'
4093 ${cat} <<- '__EOT' | \
4094 ${MAILX} ${ARGS} -Snomemdebug \
4095 -Smax=${LOOPS_MAX} \
4100 if [ $i -le "$max" ]
4101 vput vexpr j '&' $i 7
4107 echo ! The end for $1/$2
4109 return $i $^ERR-BUSY
4120 echo ?=$? !=$^ERRNAME
4123 echo ?=$? !=$^ERRNAME
4125 echo ?=$? !=$^ERRNAME
4129 if [ ${LOOPS_MAX} -eq ${LOOPS_BIG} ]; then
4130 check_ex0 1-${LOOPS_BIG} ${i}
4131 check
1-${LOOPS_BIG} - "${MBOX}" '1069764187 47161'
4133 check_ex0
1-${LOOPS_SMALL} ${i}
4134 check
1-${LOOPS_SMALL} - "${MBOX}" '859201011 3894'
4139 if have_feat uistrings
; then
4140 ${cat} <<- '__EOT' > "${BODY}"
4145 vput vexpr j '&' $i 7
4151 echo ! The end for $1
4154 echo would be err with errexit
4163 echo zwei, ?=$? !=$!
4164 localopts yes; set errexit
4166 echo drei, ?=$? !=$^ERRNAME
4168 echo vier, ?=$? !=$^ERRNAME, this is an error
4171 echo outer 1, ?=$? !=$^ERRNAME
4173 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
4175 echo outer 3, ?=$? !=$^ERRNAME
4176 echo this is definitely an error
4179 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' \
4180 -Snomemdebug > "${MBOX}" 2>&1
4181 check 2 0 "${MBOX}" '4036613316 4184'
4183 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' \
4184 -Snomemdebug > "${MBOX}" 2>&1
4185 check 3 1 "${MBOX}" '3179757785 2787'
4187 t_echoskip '2-3:[!UISTRINGS]'
4196 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
4197 vpospar set hey, "'you ", world!
4198 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4199 vput vpospar x quote; echo x<$x>
4200 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4201 vput vpospar y quote;echo y<$y>
4202 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4203 eval vpospar set ${y};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4204 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4207 echo infun2:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4208 vput vpospar z quote;echo infun2:z<$z>
4212 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4213 vput vpospar y quote;echo infun:y<$y>
4214 eval vpospar set ${x};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4215 vpospar clear;echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4217 echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4218 eval vpospar set ${y};echo infun:$?/$^ERRNAME/$#:$*/"$@"/<$1><$2><$3><$4>
4221 call infun This "in a" fun
4222 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4223 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4225 check 1 0 "${MBOX}" '155175639 866'
4228 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
4230 echo ifs<$ifs> ifs-ws<$ifs-ws>
4231 vpospar set hey, "'you ", world!
4232 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4233 vput vpospar x quote; echo x<$x>
4234 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4235 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4238 echo ifs<$ifs> ifs-ws<$ifs-ws>
4239 vpospar set hey, "'you ", world!
4240 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4242 vput vpospar x quote; echo x<$x>
4243 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4244 eval vpospar set ${x};\
4245 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4248 echo ifs<$ifs> ifs-ws<$ifs-ws>
4249 vpospar set hey, "'you ", world!
4250 unset ifs; echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4252 vput vpospar x quote; echo x<$x>
4253 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4254 eval vpospar set ${x};\
4255 unset ifs;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
4257 check ifs 0 "${MBOX}" '2015927702 706'
4265 ${cat} > ./.t.sh <<- '___'; ${cat} > ./.t.rc <<- '___'
4268 printf " (1/$#: <$1>)"
4270 if [ $# -gt 0 ]; then
4284 printf yyy;yyy 'xxx' "b\$'\t'u ' "
4285 printf xxx;xxx arg ,b u.
4286 printf xxx;xxx arg , .
4287 printf xxx;xxx arg ,ball.
4293 echon " (1/$#: <$1>)"
4308 echon yyy;call yyy '\call xxx' "b\$'\t'u ' "
4309 echon xxx;call xxx arg ,b u.
4310 echon xxx;call xxx arg , .
4311 echon xxx;call xxx arg ,ball.
4314 ${MAILX} ${ARGS} -X'source ./.t.rc' -Xx > "${MBOX}" 2>&1
4315 check 1 0 "${MBOX}" '41566293 164'
4317 #${SHELL} ./.t.sh > ./.tshout 2>&1
4318 #check disproof-1 0 ./.tshout '41566293 164'
4326 ${cat} <<- '__EOT' > .tin
4327 hey1, "'you ", world!
4328 hey2, "'you ", bugs bunny!
4333 ${cat} <<- '__EOT' |\
4334 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
4335 commandalias x echo '$?/$^ERRNAME / <$a><$b><$c>'
4340 unset a b c;read a b c;x
4341 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
4343 check 1 0 "${MBOX}" '1527910147 173'
4345 ${cat} <<- '__EOT' > .tin2
4346 hey2.0,:"'you ",:world!:mars.:
4347 hey2.1,:"'you ",:world!
4348 hey2.2,:"'you ",:bugs bunny!
4354 ${cat} <<- '__EOT' |\
4355 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
4356 commandalias x echo '$?/$^ERRNAME / <$a><$b><$c>'
4364 unset a b c;read a b c;x
4366 readctl remove 6;echo readctl remove:$?/$^ERRNAME
4368 check ifs 0 "${MBOX}" '890153490 298'
4370 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
4371 commandalias x echo '$?/$^ERRNAME / <$d>'
4374 wysh set d;readall d;x
4375 readctl create .tin2
4377 wysh set d;readall d;x
4378 readctl remove .tin;echo $?/$^ERRNAME;\
4379 readctl remove .tin2;echo $?/$^ERRNAME
4380 echo '### now with empty lines'
4381 ! printf 'one line\n\ntwo line\n\n' > ./.temptynl
4382 readctl create .temptynl;echo $?/$^ERRNAME
4384 readctl remove .temptynl;echo $?/$^ERRNAME
4386 check readall 0 "${MBOX}" '4113506527 405'
4391 t_readsh() { # TODO not enough
4394 ${cat} <<- '__EOT' > .tin
4395 from@exam.ple ' diet spliced <from@exam.ple> ' 'a'
4396 from@exam.ple ' diet spliced <from@exam.ple> ' 'a'
4397 from@exam.ple ' diet spliced <from@exam.ple> ''a'
4398 from@exam.ple' diet spliced <from@exam.ple> ''a'
4401 ${cat} <<- '__EOT' |\
4402 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
4403 commandalias x echo '$?/$^ERRNAME / <$a><$b><$c>'
4408 unset a b c;read a b c;x
4409 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
4411 check 1 0 "${MBOX}" '2955084684 291'
4419 t__x1_msg > ./.tmbox
4422 </dev/null ${MAILX} ${ARGS} -Rf -Y '# Do not care much on error UISTRINGS
4425 \echo --- $?/$^ERRNAME, 2
4427 \echo --- $?/$^ERRNAME, 3
4428 \if "$features" !% +uistrings,
4429 \echoerr reproducible_build: Invalid field name cannot be ignored: ba:l
4431 \headerpick type ignore \
4432 from_ mail-followup-to in-reply-to DATE MESSAGE-ID STATUS ba:l
4433 \echo --- $?/$^ERRNAME, 4
4434 \if "$features" !% +uistrings,
4435 \echo "#headerpick type retain currently covers no fields"
4438 \echo --- $?/$^ERRNAME, 5
4440 \echo --- $?/$^ERRNAME, 6
4441 \unheaderpick type ignore from_ DATE STATUS
4442 \echo --- $?/$^ERRNAME, 7
4443 \if "$features" !% +uistrings,
4444 \echo "#headerpick type retain currently covers no fields"
4447 \echo --- $?/$^ERRNAME, 8
4449 \echo --- $?/$^ERRNAME, 9
4450 \if "$features" =% +uistrings,
4451 \unheaderpick type ignore from_ ba:l
4452 \wysh set x=$? y=$^ERRNAME
4454 \echoerr reproducible_build: Field not ignored: from_
4455 \echoerr reproducible_build: Field not ignored: ba:l
4459 \unheaderpick type ignore *
4460 \echo --- $?/$^ERRNAME, 11
4461 \if "$features" !% +uistrings,
4462 \echo "#headerpick type retain currently covers no fields"
4463 \echo "#headerpick type ignore currently covers no fields"
4466 \echo --- $?/$^ERRNAME, 12
4468 \echo --- $?/$^ERRNAME, 13 ---
4469 # ' ./.tmbox >./.tall 2>&1
4470 check 1 0 ./.tall '2481904228 2273'
4473 if have_feat uistrings; then
4474 have_feat regex && i='3515512395 2378' || i='4201290332 2378'
4475 </dev/null ${MAILX} ${ARGS} -Y '#
4476 \headerpick type retain \
4477 bcc cc date from sender subject to \
4478 message-id mail-followup-to reply-to user-agent
4479 \echo --- $?/$^ERRNAME, 1
4480 \headerpick forward retain \
4481 cc date from message-id list-id sender subject to \
4482 mail-followup-to reply-to
4483 \echo --- $?/$^ERRNAME, 2
4484 \headerpick save ignore ^Original-.*$ ^X-.*$ ^DKIM.*$
4485 \echo --- $?/$^ERRNAME, 3
4486 \headerpick top retain To Cc
4487 \echo --- $?/$^ERRNAME, 4 ---
4489 \echo --- $?/$^ERRNAME, 5
4491 \echo --- $?/$^ERRNAME, 6
4493 \echo --- $?/$^ERRNAME, 7
4495 \echo --- $?/$^ERRNAME, 8
4497 \echo --- $?/$^ERRNAME, 9 ---
4498 \unheaderpick type retain message-id mail-followup-to reply-to user-agent
4499 \echo --- $?/$^ERRNAME, 10
4500 \unheaderpick save ignore ^X-.*$ ^DKIM.*$
4501 \echo --- $?/$^ERRNAME, 11
4502 \unheaderpick forward retain *
4503 \echo --- $?/$^ERRNAME, 12 ---
4505 \echo --- $?/$^ERRNAME, 13
4507 \echo --- $?/$^ERRNAME, 14
4509 \echo --- $?/$^ERRNAME, 15 --
4510 \unheaderpick type retain *
4511 \echo --- $?/$^ERRNAME, 16
4512 \unheaderpick forward retain *
4513 \echo --- $?/$^ERRNAME, 17
4514 \unheaderpick save ignore *
4515 \echo --- $?/$^ERRNAME, 18
4516 \unheaderpick top retain *
4517 \echo --- $?/$^ERRNAME, 19 --
4519 \echo --- $?/$^ERRNAME, 20
4521 check 2 0 ./.tall "${i}"
4523 t_echoskip '2:[!UISTRINGS]'
4530 # Send/RFC absolute basics {{{
4531 t_can_send_rfc() { # {{{
4534 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s Sub.1 \
4537 check 1 0 "${MBOX}" '550126528 126'
4538 check 1-err - .terr
'4294967295 0'
4540 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -s Sub
.2 \
4541 -b bcc@no
.1 -b bcc@no
.2 -b bcc@no
.3 \
4542 -c cc@no
.1 -c cc@no
.2 -c cc@no
.3 \
4543 to@no
.1 to@no
.2 to@no
.3 \
4545 check
2 0 "${MBOX}" '3259888945 324'
4546 check
2-err - .terr
'4294967295 0'
4548 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -s Sub
.2no \
4549 -b bcc@no
.1\ \ bcc@no
.2 -b bcc@no
.3 \
4550 -c cc@no
.1,cc@no
.2 -c cc@no
.3 \
4551 to@no
.1,to@no
.2 to@no
.3 \
4553 check
2no
4 "${MBOX}" '3350946897 468'
4554 if have_feat uistrings
; then
4555 check
2no-err
- .terr
'3397557940 190'
4557 check
2no-err
- .terr
'4294967295 0'
4560 # XXX NOTE we cannot test "cc@no1 <cc@no.2>" because our stupid parser
4561 # XXX would not treat that as a list but look for "," as a separator
4562 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sfullnames -s Sub
.3 \
4563 -T 'bcc?single: bcc@no.1, <bcc@no.2>' -T bcc
:\ bcc@no
.3 \
4564 -T cc?si\ \
:\ \
'cc@no.1, <cc@no.2>' -T cc
:\ cc@no
.3 \
4565 -T to?
:\ to@no
.1,'<to@no.2>' -T to
:\ to@no
.3 \
4567 check
3 0 "${MBOX}" '1453534480 678'
4568 check
3-err - .terr
'4294967295 0'
4570 </dev
/null
${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sfullnames -s Sub
.4 \
4571 -T 'bcc: bcc@no.1, <bcc@no.2>' -T bcc
:\ bcc@no
.3 \
4572 -T cc
:\
'cc@no.1, <cc@no.2>' -T cc\ \
:\ \ cc@no
.3 \
4573 -T to\
:to@no
.1,'<to@no.2>' -T to
:\ to@no
.3 \
4575 check
4 0 "${MBOX}" '535767201 882'
4576 check
4-err - .terr
'4294967295 0'
4578 # Two test with a file-based MTA
4579 "${cat}" <<-_EOT > .tmta.sh
4581 (echo 'From reproducible_build Wed Oct 2 01:50:07 1996' &&
4582 "${cat}" && echo pardauz && echo) > "${MBOX}"
4584 ${chmod} 0755 .tmta.sh
4586 </dev
/null
${MAILX} ${ARGS} -Smta=.
/.tmta.sh
-s Sub.mta-1 \
4587 receiver@number
.1 > .
/.terr
2>&1
4588 check
5 0 "${MBOX}" '2384401657 138'
4589 check
5-err - .terr
'4294967295 0'
4591 </dev
/null
${MAILX} ${ARGS} -Smta=file://.
/.tmta.sh
-s Sub.mta-2 \
4592 receiver@number
.1 > .
/.terr
2>&1
4593 check
6 0 "${MBOX}" '3006460737 138'
4594 check
6-err - .terr
'4294967295 0'
4597 </dev
/null
${MAILX} ${ARGS} -Smta=test \
4606 check
7 0 .
/.tall
'951018449 138'
4608 ## *record*, *outfolder*, with and without *mta-bcc-ok*
4610 xfolder
=`${pwd}`/.tfolder
4612 "${cat}" <<-_EOT > .tmta.sh
4614 (echo 'From reproducible_build Wed Oct 2 01:50:07 1996' &&
4615 "${cat}" && echo 'ARGS: '"\${@}" && echo) > "${MBOX}"
4617 ${chmod} 0755 .tmta.sh
4620 </dev
/null
${MAILX} ${ARGS} -Smta=./.tmta.sh -Sfolder="${xfolder}" \
4623 -b bcc@no.1 -b bcc@no.2 -b bcc@no.3 \
4624 -c cc@no.1 -c cc@no.2 -c cc@no.3 \
4625 to@no.1 to@no.2 to@no.3 \
4626 receiver@number.1 > ./.terr 2>&1
4631 check 8 0 "${MBOX}" '1365032629 292'
4632 check 8-1 - .terr '4294967295 0'
4634 t_it -Snomta-bcc-ok -Srecord=.trec9
4635 check 9 0 "${MBOX}" '1365032629 292'
4636 check 9-1 - .terr '4294967295 0'
4637 check 9-2 - ./.trec9 '160206230 221'
4639 t_it -Srecord=.trec10
4640 check 10 0 "${MBOX}" '3085765596 326'
4641 check 10-1 - .terr '4294967295 0'
4642 check 10-2 - ./.trec10 '160206230 221'
4644 t_it -Snomta-bcc-ok -Srecord=.trec11 -Soutfolder
4645 check 11 0 "${MBOX}" '1365032629 292'
4646 check 11-1 - .terr '4294967295 0'
4647 check 11-2 - ./.tfolder/.trec11 '160206230 221'
4648 # That is appends to an MBOX
4649 t_it -Srecord=.trec11 -Soutfolder
4650 check 12 0 "${MBOX}" '3085765596 326'
4651 check 12-1 - .terr '4294967295 0'
4652 check 12-2 - ./.tfolder/.trec11 '1618754846 442'
4656 ## From: and Sender:
4657 </dev/null ${MAILX} ${ARGS} -s ubject \
4658 -S from=a@b.org,b@b.org,c@c.org -S sender=a@b.org \
4659 to@exam.ple > "${MBOX}" 2>&1
4660 check 13 0 "${MBOX}" '143390417 169'
4662 # ..if From: is single mailbox and Sender: is same, no Sender:
4663 </dev/null ${MAILX} ${ARGS} -s ubject \
4664 -S from=a@b.org -S sender=a@b.org \
4665 to@exam.ple > "${MBOX}" 2>&1
4666 check 14 0 "${MBOX}" '1604962737 135'
4672 # Alternates and ML related address massage etc. somewhere else
4674 XARGS=${ARGS} # TODO v15-compat
4675 ARGS="${ARGS} -Sv15-compat=y
"
4677 t__gen_msg subject reply from 1 to 2 cc 2 > "${MBOX}"
4679 ## Base (does not test "recipient record
")
4681 </dev/null ${MAILX} ${ARGS} -Rf \
4686 set fullnames escape=!; '${1}'
4690 set recipients-in-cc nofullnames; '${1}'
4694 unset recipients-in-cc; '${1}'
4699 "${MBOX}" > ./.tall 2>&1
4704 check 1 0 ./.tall '4164251531 851'
4706 check 2 0 ./.tall '3034955332 591'
4707 t_it reply 'set flipr;'
4708 check 3 0 ./.tall '3034955332 591'
4709 t_it Reply 'set flipr;'
4710 check 4 0 ./.tall '4164251531 851'
4713 t__gen_msg subject reply-no-addr > ./.tnoaddr
4715 # MBOX will deduce addressee from From_ line..
4716 </dev/null ${MAILX} ${ARGS} -R -Sescape=! \
4718 File ./.tnoaddr; reply # Takes addressee from From_ line :(
4722 File '"${MBOX}"'; set ea=$expandaddr expandaddr=-all; reply
4725 echo 2:$?/$^ERRNAME; set expandaddr=$ea; reply 10 # BADMSG
4726 echo 3:$?/$^ERRNAME; reply # cannot test IO,NOTSUP,INVAL
4732 check 5 0 ./.tall '3088217220 382'
4733 if have_feat uistrings; then
4734 check 6 - ./.terr '2514745519 544'
4736 t_echoskip '6:[!UISTRINGS]'
4739 # ..but Maildir will not
4740 if have_feat maildir; then
4741 ${mkdir} -p .tdir .tdir/tmp .tdir/cur .tdir/new
4742 ${sed} 1d < ./.tnoaddr > .tdir/new/sillyname
4744 </dev/null ${MAILX} ${ARGS} -R -Sescape=! \
4750 File '"${MBOX}"'; set ea=$expandaddr expandaddr=-all; reply
4753 echo 2:$?/$^ERRNAME; set expandaddr=$ea; reply 10 # BADMSG
4754 echo 3:$?/$^ERRNAME;reply # cannot test IO,NOTSUP,INVAL
4760 check 7 0 ./.tall '3631170341 244'
4761 if have_feat uistrings; then
4762 check 8 - ./.terr '1074346767 629'
4764 t_echoskip '8:[!UISTRINGS]'
4768 ## Ensure action on multiple messages
4769 t__gen_msg subject reply2 from from2@exam.ple body body2 >> "${MBOX}"
4772 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! \
4779 echo 1:$?/$^ERRNAME; '${2}' 1 2
4784 "${MBOX}" > ./.tall 2>&1
4785 check ${3} 0 ./.tall '283309820 502'
4786 if [ ${#} -eq 4 ]; then
4788 check ${3}-1 - ./.tlst '1649520021 12'
4789 check ${3}-2 - ./from1 '1501109193 347'
4790 check ${3}-3 - ./from2 '2154231432 137'
4795 t_it respond Respond 10
4796 t_it followup Followup 11 yes
4797 ${rm} -f from1 from2
4799 ## *record*, *outfolder* (reuses $MBOX)
4803 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! -Sfolder=`${pwd}`/.tfolder \
4810 echo 1:$?/$^ERRNAME; '${2}' 1 2
4813 echo 2:$?/$^ERRNAME; set record=.trec'${4}'; '${1}' 1 2
4818 echo 3:$?/$^ERRNAME; '${2}' 1 2
4821 echo 4:$?/$^ERRNAME; set outfolder norecord
4827 echo 1:$?/$^ERRNAME; '${2}' 1 2
4830 echo 2:$?/$^ERRNAME; set record=.trec'${4}'; '${1}' 1 2
4835 echo 3:$?/$^ERRNAME; '${2}' 1 2
4840 "${MBOX}" > ./.tall 2>&1
4841 check ${3} 0 ./.tall '3410330303 2008'
4842 if [ ${#} -ne 5 ]; then
4843 check ${4} - ./.trec${4} '3044885336 484'
4844 check ${4}-1 - ./.tfolder/.trec${4} '3044885336 484'
4846 [ -f ./.trec${4} ]; check_exn0 ${4}
4848 check ${4}-1 - ./.tlst '1649520021 12'
4849 check ${4}-2 - ./from1 '2668975631 694'
4850 check ${4}-3 - ./from2 '225462887 274'
4851 [ -f ./.tfolder/.trec${4} ]; check_exn0 ${4}-4
4852 ( cd .tfolder && echo * > ./.tlst )
4853 check ${4}-5 - ./.tfolder/.tlst '1649520021 12'
4854 check ${4}-6 - ./.tfolder/from1 '2668975631 694'
4855 check ${4}-7 - ./.tfolder/from2 '225462887 274'
4859 t_it reply Reply 12 13
4860 t_it respond Respond 14 15
4861 t_it followup Followup 16 17 yes
4862 #${rm} -f from1 from2
4864 ## Quoting (if not cmd_escapes related)
4866 t__x2_msg > ./.tmbox
4869 set indentprefix=" |
" quote
4873 set quote=noheading quote-inject-head
4877 headerpick type retain cc date from message-id reply-to subject to
4882 set quote=allheaders
4886 set quote-inject-head=%% quote-inject-tail=%% quote=headers
4891 quote-inject-head='"\$
'"'\\
4892 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
4894 quote-inject-tail='"\$
'"'\\
4895 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
4900 set showname datefield=%%y nodatefield-markout-older indentprefix=\\ :
4904 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Rf \
4905 -Sescape=! -Sindentprefix=' >' \
4906 ./.tmbox >./.tall 2>&1
4908 ${cat} ./.tall >> "${MBOX}"
4909 check 18 - "${MBOX}" '385267528 3926'
4911 # quote-as-attachment, fullnames
4912 </dev/null ${MAILX} ${ARGS} -Rf \
4914 -S quote-as-attachment \
4915 -Y reply -Y yb1 -Y !. \
4916 -Y 'unset quote-as-attachment' \
4917 -Y 'reply;yb2' -Y !. \
4918 -Y 'set quote-as-attachment fullnames' \
4919 -Y ';reply;yb3' -Y !. \
4920 ./.tmbox >./.tall 2>&1
4921 check 19 0 ./.tall '2774517283 2571'
4923 # Moreover, quoting of several parts with all*
4924 t__gen_mimemsg from 'ex1@am.ple' subject for-repl > ./.tmbox
4925 check 20 0 ./.tmbox '1874764424 668'
4927 </dev/null ${MAILX} ${ARGS} -Rf \
4928 -Sescape=! -Sindentprefix=' |' \
4929 -Y 'set quote=allheaders' \
4931 -Y 'set quote=allbodies' \
4934 ./.tmbox >./.tall 2>&1
4935 check 21 0 ./.tall '946925637 1105'
4937 ARGS=${XARGS} # TODO v15-compat
4944 ARGS="${ARGS} -Sv15-compat=y
"
4946 t__gen_msg subject fwd1 body origb1 from 1 to 2 > "${MBOX}"
4947 t__gen_msg subject fwd2 body origb2 from 1 to 1 >> "${MBOX}"
4949 ## Base (does not test "recipient record
")
4951 </dev/null ${MAILX} ${ARGS} -Rf \
4952 -Y ${1}' . "du
<ex1@am.ple
>"
4955 echo 1:$?/$^ERRNAME; echoerr 1:done
4956 set fullnames escape=!
4957 '${1}' 1 "du
<ex2@am.ple
>"
4960 echo 2:$?/$^ERRNAME; echoerr 2:done
4962 set nofullnames ea=$expandaddr expandaddr=-all
4963 '${1}' ` "du
<ex3@am.ple
>"
4966 echo 3:$?/$^ERRNAME; echoerr 3:done
4968 '${1}' ` ex4-nono@am.ple ex4@am.ple # the first is a non-match msglist
4971 echo 4:$?/$^ERRNAME; echoerr 4:done
4972 '${1}' # TODO not yet possible b5 !.
4973 echo 5:$?/$^ERRNAME; echoerr 5:done
4975 '${1}' 1 2 ex6@am.ple
4980 echo 6:$?/$^ERRNAME; echoerr 6:done
4981 set forward-add-cc fullnames
4985 echo 7:$?/$^ERRNAME; echoerr 7:done
4990 echo 8:$?/$^ERRNAME; echoerr 8:done
4992 "${MBOX}" > ./.tall 2>./.terr
4997 check 1 0 ./.tall '2356713156 2219'
4998 if have_feat uistrings && have_feat docstrings; then
4999 check 2 - ./.terr '3273108824 335'
5001 t_echoskip '2:[!UISTRINGS]'
5005 check 3 0 ./.tall '2356713156 2219'
5006 if have_feat uistrings && have_feat docstrings; then
5007 check 4 - ./.terr '447176534 355'
5009 t_echoskip '4:[!UISTRINGS]'
5013 ## *record*, *outfolder* (reuses $MBOX)
5017 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! -Sfolder=`${pwd}`/.tfolder \
5022 echo 1:$?/$^ERRNAME; set record=.trec'${2}'; '${1}' 1 ex2@am.ple
5025 echo 2:$?/$^ERRNAME; set outfolder norecord; '${1}' 2 ex1@am.ple
5028 echo 3:$?/$^ERRNAME; set record=.trec'${2}'; '${1}' 2 ex2@am.ple
5033 "${MBOX}" > ./.tall 2>&1
5034 check ${2} 0 ./.tall '3180366037 1212'
5035 if [ ${#} -ne 4 ]; then
5036 check ${3}-1 - ./.trec${2} '1769129556 304'
5037 check ${3}-2 - ./.tfolder/.trec${2} '2335391111 284'
5039 [ -f ./.trec${2} ]; check_exn0 ${3}
5041 check ${3}-1 - ./.tlst '2020171298 8'
5042 check ${3}-2 - ./ex1 '1512529673 304'
5043 check ${3}-3 - ./ex2 '1769129556 304'
5044 [ -f ./.tfolder/.trec${2} ]; check_exn0 ${3}-4
5045 ( cd .tfolder && echo * > ./.tlst )
5046 check ${3}-5 - ./.tfolder/.tlst '2020171298 8'
5047 check ${3}-6 - ./.tfolder/ex1 '2016773910 284'
5048 check ${3}-7 - ./.tfolder/ex2 '2335391111 284'
5053 t_it Forward 7 8 yes
5056 ## Injections, headerpick selection
5058 t__x2_msg > ./.tmbox
5061 set quote=noheading forward-inject-head
5062 forward 1 ex1@am.ple
5065 headerpick forward retain cc from subject to
5066 forward 1 ex1@am.ple
5069 unheaderpick forward retain *
5070 forward 1 ex1@am.ple
5073 headerpick forward ignore in-reply-to reply-to message-id status
5074 set forward-inject-head=%% forward-inject-tail=%%
5075 forward 1 ex1@am.ple
5078 set forward-inject-head='"\$
'"'\\
5079 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
5081 forward-inject-tail='"\$
'"'\\
5082 (%%%%a
=%%a
%%%%d
=%%d
%%%%f
=%%f
%%%%i
=%%i
%%%%n
=%%n
%%%%r
=%%r
)\\
5084 forward 1 ex1@am.ple
5087 set showname datefield=%%y nodatefield-markout-older
5088 forward 1 ex1@am.ple
5091 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Rf \
5093 ./.tmbox >./.tall 2>&1
5095 ${cat} ./.tall >> "${MBOX}"
5096 check 9 - "${MBOX}" '2976943913 2916'
5098 # forward-as-attachment
5099 </dev/null ${MAILX} ${ARGS} -Rf \
5101 -S forward-inject-head=.head. \
5102 -S forward-inject-tail=.tail. \
5103 -S forward-as-attachment \
5104 -Y 'headerpick forward retain subject to from' \
5105 -Y 'forward ex1@am.ple' -Y b1 -Y !. \
5106 -Y 'unset forward-as-attachment' \
5107 -Y 'forward ex1@am.ple;b2' -Y !. \
5108 ./.tmbox >./.tall 2>&1
5109 check 10 0 ./.tall '799103633 1250'
5118 ARGS="${ARGS} -Sv15-compat=y
"
5120 t__gen_msg subject fwd1 body origb1 from 1 to 2 > "${MBOX}"
5121 t__gen_msg subject fwd2 body origb2 from 1 to 1 >> "${MBOX}"
5125 </dev/null ${MAILX} ${ARGS} -Rf \
5126 -Y ${1}' . "du
<ex1@am.ple
>"
5127 echo 1:$?/$^ERRNAME; echoerr 1:done
5128 set fullnames escape=!
5129 '${1}' 1 "du
, da
<ex2@am.ple
>"
5130 echo 2:$?/$^ERRNAME; echoerr 2:done
5132 set nofullnames ea=$expandaddr expandaddr=-all
5133 '${1}' ` "du
<ex3@am.ple
>"
5134 echo 3:$?/$^ERRNAME; echoerr 3:done
5136 '${1}' ` ex4-nono@am.ple ex4@am.ple # the first is a non-match msglist
5137 echo 4:$?/$^ERRNAME; echoerr 4:done
5138 '${1}' # TODO not yet possible b5 !.
5139 echo 5:$?/$^ERRNAME; echoerr 5:done
5141 '${1}' 1 2 ex6@am.ple
5142 echo 6:$?/$^ERRNAME; echoerr 6:done
5144 "${MBOX}" > ./.tall 2>./.terr
5149 check 1 0 ./.tall '1461006932 1305'
5150 if have_feat uistrings; then
5151 check 2 - ./.terr '138360532 210'
5153 t_echoskip '2:[!UISTRINGS]'
5157 check 3 0 ./.tall '3674535444 958'
5158 if have_feat uistrings; then
5159 check 4 - ./.terr '138360532 210'
5161 t_echoskip '4:[!UISTRINGS]'
5164 ## *record*, *outfolder* (reuses $MBOX)
5168 </dev/null ${MAILX} ${ARGS} -Rf -Sescape=! -Sfolder=`${pwd}`/.tfolder \
5170 set record=.trec'${2}'; '${1}' 1 ex1@am.ple
5171 echo 1:$?/$^ERRNAME; set record-resent; '${1}' 1 ex2@am.ple
5172 echo 2:$?/$^ERRNAME; set outfolder norecord-resent; '${1}' 2 ex1@am.ple
5173 echo 3:$?/$^ERRNAME; set record-resent; '${1}' 2 ex2@am.ple
5176 "${MBOX}" > ./.tall 2>&1
5178 if [ ${#} -ne 3 ]; then
5179 check ${2} - ./.tall '1711347390 992'
5180 check ${3}-1 - ./.trec${2} '2840978700 249'
5181 check ${3}-2 - ./.tfolder/.trec${2} '3219997964 229'
5183 check ${2} - ./.tall '1391418931 724'
5184 check ${3}-1 - ./.trec${2} '473817710 182'
5185 check ${3}-2 - ./.tfolder/.trec${2} '2174632404 162'
5201 t__gen_msg subject Copy1 from 1 to 1 body 'Body1' > "${MBOX}"
5202 t__gen_msg subject Copy2 from 1 to 1 body 'Body2' >> "${MBOX}"
5203 check 1 - "${MBOX}" '137107341 324' # for flag test
5206 </dev/null ${MAILX} ${ARGS} -f \
5215 copy .tf1 # no auto-advance
5224 !'"${chmod}"' 0444 .tf3
5228 "${MBOX}" > ./.tallx 2>./.terr
5231 if have_feat uistrings; then # TODO
5232 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5233 ${sed} '$d' < ./.tallx > ./.tall
5235 ${mv} ./.tallx ./.tall
5237 if [ -n "${HONOURS_READONLY}" ]; then
5238 n2_1=2-1 cs2_1='1913702840 1121'
5239 n2_4=2-4 cs2_4='3642131968 344'
5240 n2_5=2-5 cs2_5='2617612897 112'
5242 n2_1=2-1-nrdonly cs2_1='1962556153 1146'
5243 n2_4=2-4-nrdonly cs2_4='3733058190 688'
5244 n2_5=2-5-nrdonly cs2_5='3989834342 80'
5246 check ${n2_1} - ./.tall "${cs2_1}"
5247 check 2-2 - ./.tf1 '686654461 334'
5248 check 2-3 - ./.tf2 '1931512953 162'
5249 check ${n2_4} - ./.tf3 "${cs2_4}"
5250 if have_feat uistrings; then
5251 check ${n2_5} - ./.terr "${cs2_5}"
5253 t_echoskip '2-5:[!UISTRINGS]'
5257 check 3 - "${MBOX}" '1477662071 346'
5261 t__gen_msg subject Copy1 from 1 to 1 body 'Body1' > "${MBOX}"
5262 t__gen_msg subject Copy2 from 1 to 1 body 'Body2' >> "${MBOX}"
5263 t__gen_msg subject Copy3 from ex@am.ple to 1 body 'Body3' >> "${MBOX}"
5264 check ${1} - "${MBOX}" '2667292819 473' # for flag test
5266 </dev/null ${MAILX} ${ARGS} -f \
5285 "${MBOX}" > ./.tallx 2>&1
5291 if have_feat uistrings; then # TODO
5292 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5293 ${sed} '$d' < ./.tallx > ./.tall
5295 ${mv} ./.tallx ./.tall
5298 check 5-2 - ./.tlst '1058655452 9'
5299 check 5-3 - ./.tall '1543702808 1617'
5300 check 5-4 - ./from1 '1031912635 999'
5301 check 5-5 - ./ex '2400630246 149'
5302 ${rm} -f ./.tlst ./.tall ./from1 ./ex
5305 t_it 6 '#' 'set outfolder folder='"`${pwd}`"'/.tfolder'
5307 if have_feat uistrings; then # TODO
5308 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5309 ${sed} '$d' < ./.tallx > ./.tall
5311 ${mv} ./.tallx ./.tall
5313 echo * .tfolder/* > ./.tlst
5314 check 6-2 - ./.tlst '1865898363 29'
5315 ${cat} ./.tall >> ${ERR} #check 6-3 - ./.tall # TODO due to folder echoes
5316 check 6-4 - .tfolder/from1 '1031912635 999'
5317 check 6-5 - .tfolder/ex '2400630246 149'
5320 t__x2_msg > ./.tmbox
5326 headerpick save retain cc date from subject to
5329 unheaderpick save retain *
5332 headerpick save ignore status in-reply-to
5335 #' | ${MAILX} ${ARGS} -Rf ./.tmbox > ./.tall 2>&1
5341 check 7-1 - ./.tall '3805176908 152'
5342 check 7-2 - ./.tout '2447734879 1316'
5347 check 8-1 - ./.tall '1044700686 136'
5348 check 8-2 - ./mr2 '2447734879 1316'
5349 check 8-3 - ./.tlst '3190056903 4'
5357 t__gen_msg subject Save1 from 1 to 1 body 'Body1' > "${MBOX}"
5358 t__gen_msg subject Save2 from 1 to 1 body 'Body2' >> "${MBOX}"
5359 check 1 - "${MBOX}" '3634443864 324' # for flag test
5362 </dev/null ${MAILX} ${ARGS} -f \
5371 save .tf1 # no auto-advance
5380 !'"${chmod}"' 0444 .tf3
5384 "${MBOX}" > ./.tallx 2>./.terr
5387 if have_feat uistrings; then # TODO
5388 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5389 ${sed} '$d' < ./.tallx > ./.tall
5391 ${mv} ./.tallx ./.tall
5393 if [ -n "${HONOURS_READONLY}" ]; then
5394 n2_1=2-1 cs2_1='2335843514 1121'
5395 n2_4=2-4 cs2_4='970407001 344'
5396 n2_5=2-5 cs2_5='45116475 112'
5398 n2_1=2-1-nrdonly cs2_1='1736244784 1146'
5399 n2_4=2-4-nrdonly cs2_4='3903872811 688'
5400 n2_5=2-5-nrdonly cs2_5='720724138 80'
5402 check ${n2_1} - ./.tall "${cs2_1}"
5403 check 2-2 - ./.tf1 '2435434321 334'
5404 check 2-3 - ./.tf2 '920652966 162'
5405 check ${n2_4} - ./.tf3 "${cs2_4}"
5406 if have_feat uistrings; then
5407 check ${n2_5} - ./.terr "${cs2_5}"
5409 t_echoskip '2-5:[!UISTRINGS]'
5413 check 3 - "${MBOX}" '1219692400 346'
5417 t__gen_msg subject Save1 from 1 to 1 body 'Body1' > "${MBOX}"
5418 t__gen_msg subject Save2 from 1 to 1 body 'Body2' >> "${MBOX}"
5419 t__gen_msg subject Save3 from ex@am.ple to 1 body 'Body3' >> "${MBOX}"
5420 check ${1} - "${MBOX}" '1391391227 473' # for flag test
5422 </dev/null ${MAILX} ${ARGS} -f \
5441 "${MBOX}" > ./.tallx 2>&1
5447 if have_feat uistrings; then # TODO
5448 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5449 ${sed} '$d' < ./.tallx > ./.tall
5451 ${mv} ./.tallx ./.tall
5454 check 5-2 - ./.tlst '1058655452 9'
5455 check 5-3 - ./.tall '3418590770 1617'
5456 check 5-4 - ./from1 '1462882526 999'
5457 check 5-5 - ./ex '2153575326 149'
5458 ${rm} -f ./.tlst ./.tall ./from1 ./ex
5461 t_it 6 '#' 'set outfolder folder='"`${pwd}`"'/.tfolder'
5463 if have_feat uistrings; then # TODO
5464 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5465 ${sed} '$d' < ./.tallx > ./.tall
5467 ${mv} ./.tallx ./.tall
5469 echo * .tfolder/* > ./.tlst
5470 check 6-2 - ./.tlst '1865898363 29'
5471 ${cat} ./.tall >> ${ERR} #check 6-3 - ./.tall # TODO due to folder echoes
5472 check 6-4 - .tfolder/from1 '1462882526 999'
5473 check 6-5 - .tfolder/ex '2153575326 149'
5478 t__x2_msg > ./.tmbox
5479 check ${1} - ./.tmbox '561523988 397'
5482 [ ${#} -gt 2 ] && a='-S MBOX=./.tmboxx'
5483 [ ${#} -gt 3 ] && a="${a}"' -S inbox=./.tmbox'
5489 headerpick save retain cc date from subject to
5492 unheaderpick save retain *
5495 headerpick save ignore status in-reply-to
5498 #' | ${MAILX} ${ARGS} -f ${a} ./.tmbox > ./.tall 2>&1
5502 t_it 7 'save ./.tout'
5504 check 7-1 - ./.tall '4190949581 312'
5505 check 7-2 - ./.tout '2447734879 1316'
5506 check 7-3 - ./.tmbox '561523988 397'
5511 check 8-1 - ./.tall '2109832180 296'
5512 check 8-2 - ./mr2 '2447734879 1316'
5513 check 8-3 - ./.tlst '3190056903 4'
5514 check 8-3 - ./.tmbox '561523988 397'
5516 # saves in $MBOX without argument
5519 check 9-1 - ./.tall '652005824 320'
5520 check 9-2 - ./.tmboxx '2447734879 1316'
5521 check 9-3 - ./.tmbox '561523988 397'
5523 # and deletes if editing a primary mailbox
5525 t_it 10 save yes yes
5527 check 10-1 - ./.tall '652005824 320'
5528 check 10-2 - ./.tmboxx '2447734879 1316'
5529 [ -f ./.tmbox ]; check_exn0 10-3
5537 t__gen_msg subject Move1 from 1 to 1 body 'Body1' > "${MBOX}"
5538 t__gen_msg subject Move2 from 1 to 1 body 'Body2' >> "${MBOX}"
5539 check 1 - "${MBOX}" '2967134193 324' # for flag test
5542 </dev/null ${MAILX} ${ARGS} -f \
5551 !touch .tf2; '"${chmod}"' 0444 .tf2
5554 !'"${chmod}"' 0644 .tf2
5559 "${MBOX}" > ./.tallx 2>./.terr
5562 if have_feat uistrings; then # TODO
5563 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5564 ${sed} '$d' < ./.tallx > ./.tall
5566 ${mv} ./.tallx ./.tall
5568 if [ -n "${HONOURS_READONLY}" ]; then
5569 n2_1=2-1 cs2_1='1641443074 491'
5570 n2_4=2-4 cs2_4='602144474 155'
5572 n2_1=2-1-nrdonly cs2_1='3045412111 492'
5573 n2_4=2-4-nrdonly cs2_4='2197157669 201'
5575 check ${n2_1} - ./.tall "${cs2_1}"
5576 check 2-2 - ./.tf1 '1473857906 162'
5577 check 2-3 - ./.tf2 '331229810 162'
5578 if have_feat uistrings; then
5579 check ${n2_4} - ./.terr "${cs2_4}"
5581 t_echoskip '2-4:[!UISTRINGS]'
5585 check 3 - "${MBOX}" '4294967295 0'
5589 t__gen_msg subject Move1 from 1 to 1 body 'Body1' > "${MBOX}"
5590 t__gen_msg subject Move2 from 1 to 1 body 'Body2' >> "${MBOX}"
5591 t__gen_msg subject Move3 from ex@am.ple to 1 body 'Body3' >> "${MBOX}"
5592 check ${1} - "${MBOX}" '2826896131 473' # for flag test
5594 </dev/null ${MAILX} ${ARGS} -f \
5613 "${MBOX}" > ./.tallx 2>./.terr
5619 if have_feat uistrings; then # TODO
5620 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5621 ${sed} '$d' < ./.tallx > ./.tall
5623 ${mv} ./.tallx ./.tall
5626 check 5-2 - ./.tlst '1058655452 9'
5627 check 5-3 - ./.tall '419037676 870'
5628 if have_feat uistrings; then
5629 check 5-4 - ./.terr '1383646464 86'
5631 t_echoskip '5-4:[!UISTRINGS]'
5633 check 5-5 - ./from1 '3719268580 827'
5634 check 5-6 - ./ex '4262925856 149'
5635 ${rm} -f ./.tlst ./.tall ./.terr ./from1 ./ex
5638 t_it 6 '#' 'set outfolder folder='"`${pwd}`"'/.tfolder'
5640 if have_feat uistrings; then # TODO
5641 ${sed} -e '$bP' -e d -e :P < ./.tallx >> "${ERR}"
5642 ${sed} '$d' < ./.tallx > ./.tall
5644 ${mv} ./.tallx ./.tall
5646 echo * .tfolder/* > ./.tlst
5647 check 6-2 - ./.tlst '1865898363 29'
5648 ${cat} ./.tall >> ${ERR} #check 6-3 - ./.tall # TODO due to folder echoes
5649 check 6-4 - .tfolder/from1 '3719268580 827'
5650 check 6-5 - .tfolder/ex '4262925856 149'
5653 t__x2_msg > ./.tmbox
5659 headerpick save retain cc date from subject to
5662 unheaderpick save retain *
5665 headerpick save ignore status in-reply-to
5668 #' | ${MAILX} ${ARGS} -Rf ./.tmbox > ./.tall 2>&1
5674 check 7-1 - ./.tall '3805176908 152'
5675 check 7-2 - ./.tout '2447734879 1316'
5680 check 8-1 - ./.tall '1044700686 136'
5681 check 8-2 - ./mr2 '2447734879 1316'
5682 check 8-3 - ./.tlst '3190056903 4'
5692 while [ ${i} -lt 113 ]; do
5693 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
5694 "${MBOX}" "${i}" "${i}"
5697 ) | ${MAILX} ${ARGS} > .tall 2>&1
5698 check 1 0 "${MBOX}" '1785801373 13336'
5699 check 1-outerr - ./.tall '4294967295 0' # empty file
5701 printf 'File "%s
"\ncopy * "%s
"\nFile "%s
"\nfrom*' "${MBOX}" .tmbox1 .tmbox1 |
5702 ${MAILX} ${ARGS} -Sshowlast > .tall 2>&1
5703 check 2 0 .tall '3467540956 8991'
5705 printf 'File "%s
"\ncopy * "file://%s
"\nFile "file://%s
"\nfrom*' \
5706 "${MBOX}" .tmbox2 .tmbox2 | ${MAILX} ${ARGS} -Sshowlast > .tall
2>&1
5707 check
3 0 .tall
'2410946529 8998'
5709 # copy only the odd (but the first), move the even
5711 printf 'File "file://%s"\ncopy ' .tmbox2
5713 while [ ${i} -lt 113 ]; do
5717 printf 'file://%s\nFile "file://%s"\nfrom*' .tmbox3 .tmbox3
5718 ) |
${MAILX} ${ARGS} -Sshowlast > .tall
2>&1
5719 check
4 0 .tmbox3
'2554734733 6666'
5720 check
5 - .tall
'2062382804 4517'
5723 printf 'file "file://%s"\nmove ' .tmbox2
5725 while [ ${i} -lt 113 ]; do
5729 printf 'file://%s\nFile "file://%s"\nfrom*\nFile "file://%s"\nfrom*' \
5730 .tmbox3 .tmbox3 .tmbox2
5731 ) |
${MAILX} ${ARGS} -Sshowlast > .tall 2>>${ERR}
5732 check
6 0 .tmbox3
'1429216753 13336'
5733 if have_feat uistrings
; then
5734 ${sed} 2d
< .tall
> .tallx
5738 check
7 - .tallx
'169518319 13477'
5740 # Invalid MBOXes (after [f4db93b3])
5742 printf 'copy 1 ./.tinvmbox' |
${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
5743 check 8 0 .tinvmbox '2848412822 118'
5744 check 9 - ./.tall '461280182 33'
5746 echo ' ' > .tinvmbox
5747 printf 'copy 1 ./.tinvmbox' | ${MAILX} ${ARGS} -Rf "${MBOX}" > .tall
2>&1
5748 check
10 0 .tinvmbox
'624770486 120'
5749 check
11 - .
/.tall
'461280182 33'
5751 { echo; echo; } > .tinvmbox
# (not invalid)
5752 printf 'copy 1 ./.tinvmbox' |
${MAILX} ${ARGS} -Rf "${MBOX}" > .tall 2>&1
5753 check 12 0 .tinvmbox '1485640875 119'
5754 check 13 - ./.tall '461280182 33'
5756 # *mbox-rfc4155*, plus
5757 ${cat} <<-_EOT > ./.tinv1
5760 From MAILER-DAEMON-1 Wed Oct 2 01:50:07 1996
5761 Date: Wed, 02 Oct 1996 01:50:07 +0000
5763 Subject: Bad bad message 1
5765 From me to you, blinde Kuh!
5767 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
5768 Date: Wed, 02 Oct 1996 01:50:07 +0000
5770 Subject: Bad bad message 2
5772 From me to you, blindes Kalb!
5774 ${cp} ./.tinv1 ./.tinv2
5778 \\localopts yes; \\wysh set mbox-rfc4155;\\wysh File "${1}";\\
5779 \\eval copy * "${2}"
5781 call mboxfix ./.tinv1 ./.tok' | ${MAILX} ${ARGS} > .tall 2>&1
5783 ${cat} ./.tinv1 ./.tok >> .tall
5784 check 14 - ./.tall '739301109 616'
5787 'wysh file ./.tinv1 # ^From not repaired, but missing trailing NL is
5788 wysh File ./.tok # Just move away to nowhere
5790 wysh file ./.tinv2 # Fully repaired
5791 File ./.tok' | ${MAILX} ${ARGS} >>${ERR} 2>&1
5793 # Equal since [Auto-fix when MBOX had From_ errors on read (Dr. Werner
5795 check 15-1 - ./.tinv1 '4151504442 314'
5796 check 15-2 - ./.tinv2 '4151504442 314'
5798 # *mbox-fcc-and-pcc*
5799 ${cat} > ./.ttmpl <<-'_EOT'
5801 Bcc: | cat >> ./.tpcc1
5803 Subject: fcc and pcc, and *mbox-fcc-and-pcc*
5808 < ./.ttmpl ${MAILX} ${ARGS} -t > "${MBOX}" 2>&1
5809 check
16 0 "${MBOX}" '4294967295 0'
5810 check
17 - .
/.tfcc1
'2301294938 148'
5811 check
18 - .
/.tfcc2
'2301294938 148'
5812 check
19 - .
/.tpcc1
'2301294938 148'
5814 < .
/.ttmpl
${MAILX} ${ARGS} -t -Snombox-fcc-and-pcc > "${MBOX}" 2>&1
5815 check 20 0 "${MBOX}" '4294967295 0'
5816 check 21 - ./.tfcc1 '3629108107 98'
5817 check 22 - ./.tfcc2 '3629108107 98'
5818 check 23 - ./.tpcc1 '2373220256 246'
5820 # More invalid: since in "copy
* X
" messages will be copied in `sort' order,
5821 # reordering may happen, and before ([f5db11fe] (a_cwrite_save1(): FIX:
5822 # ensure pre-v15 MBOX separation "in between
" messages.., 2019-08-07) that
5823 # could still have created invalid MBOX files!
5824 ${cat} <<-_EOT > ./.tinv1
5827 From MAILER-DAEMON-4 Sun Oct 4 01:50:07 1998
5828 Date: Sun, 04 Oct 1998 01:50:07 +0000
5833 From MAILER-DAEMON-0 Fri Oct 28 21:02:21 2147483649
5834 Date: Nix, 01 Oct BAD 01:50:07 +0000
5839 From MAILER-DAEMON-3 Fri Oct 3 01:50:07 1997
5840 Date: Fri, 03 Oct 1997 01:50:07 +0000
5845 From MAILER-DAEMON-1 Sun Oct 1 01:50:07 1995
5846 Date: Sun, 01 Oct 1995 01:50:07 +0000
5852 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
5853 Date: Wed, 02 Oct 1996 01:50:07 +0000
5864 file ./.tinv1' | ${MAILX} ${ARGS} >>${ERR} 2>&1
5865 check 24 0 ./.tinv1 '104184185 560'
5866 check 25 - ./.tinv2 '853754737 510'
5874 if have_feat maildir; then :; else
5875 t_echoskip '[!MAILDIR]'
5882 while [ ${i} -lt 112 ]; do
5883 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
5884 "${MBOX}" "${i}" "${i}"
5887 ) | ${MAILX} ${ARGS}
5888 check 1 0 "${MBOX}" '2366902811 13332'
5894 ' "${MBOX}" .tmdir1 .tmdir1 |
5895 ${MAILX} ${ARGS} -Snewfolders=maildir -Sshowlast > .tlst
5896 check 2 0 .tlst '3442251309 8991'
5899 copy * "maildir
://%s
"
5902 ' "${MBOX}" .tmdir2 .tmdir2 |
5903 ${MAILX} ${ARGS} -Sshowlast > .tlst
5904 check 3 0 .tlst '3524806062 9001'
5906 printf 'File "maildir
://%s
"
5910 ' .tmdir2 .tmbox1 .tmbox1 |
5911 ${MAILX} ${ARGS} -Sshowlast > .tlst
5912 check 4 0 .tmbox1 '4096198846 12772'
5913 check 5 - .tlst '1262452287 8998'
5915 # only the odd (even)
5917 printf 'File "maildir
://%s
"
5920 while [ ${i} -lt 112 ]; do
5922 [ ${j} -eq 1 ] && printf '%s ' "${i}"
5929 ) | ${MAILX} ${ARGS} -Sshowlast > .tlst
5930 check 6 0 .tmbox2 '4228337024 6386'
5931 check 7 - .tlst '2078821439 4517'
5934 printf 'file "maildir
://%s
"
5937 while [ ${i} -lt 112 ]; do
5939 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
5947 ' .tmbox2 .tmbox2 .tmdir2
5948 ) |
${MAILX} ${ARGS} -Sshowlast > .tlst
5949 check
8 0 .tmbox2
'978751761 12656'
5950 ${sed} 2d
< .tlst
> .tlstx
5951 check
9 - .tlstx
'2172297531 13477'
5953 # More invalid: since in "copy * X" messages will be copied in `sort' order,
5954 # reordering may happen, and before ([f5db11fe] (a_cwrite_save1(): FIX:
5955 # ensure pre-v15 MBOX separation "in between" messages.., 2019-08-07) that
5956 # could still have created invalid MBOX files!
5957 ${cat} <<-_EOT > ./.tinv1
5960 From MAILER-DAEMON-4 Sun Oct 4 01:50:07 1998
5961 Date: Sun, 04 Oct 1998 01:50:07 +0000
5966 From MAILER-DAEMON-0 Fri Oct 28 21:02:21 2147483649
5967 Date: Nix, 01 Oct BAD 01:50:07 +0000
5972 From MAILER-DAEMON-3 Fri Oct 3 01:50:07 1997
5973 Date: Fri, 03 Oct 1997 01:50:07 +0000
5978 From MAILER-DAEMON-1 Sun Oct 1 01:50:07 1995
5979 Date: Sun, 01 Oct 1995 01:50:07 +0000
5985 From MAILER-DAEMON-2 Wed Oct 2 01:50:07 1996
5986 Date: Wed, 02 Oct 1996 01:50:07 +0000
5995 copy * maildir://./.tmdir10
5996 !{ for f in ./.tmdir10/new/*; do echo ===; %s $f; done; } > ./.t11
6000 ' "${cat}" | ${MAILX} ${ARGS} >>${ERR} 2>&1
6001 # Note that substdate() fixes all but one From_ line to $SOURCE_DATE_EPOCH!
6002 check 10 0 ./.t10warp '3551111321 502'
6003 check 11 - ./.t11 '642719592 302'
6009 # MIME and RFC basics {{{
6010 t_mime_if_not_ascii() {
6013 </dev/null ${MAILX} ${ARGS} -s Subject "${MBOX}" >> "${MBOX}" 2>&1
6014 check
1 0 "${MBOX}" '3647956381 106'
6016 </dev
/null
${MAILX} ${ARGS} -Scharset-7bit=not-ascii -s Subject "${MBOX}" \
6018 check 2 0 "${MBOX}" '3964303752 274'
6027 printf 'Hey, you.\nFrom me to you\nCiao\n' |
6028 ${MAILX} ${ARGS} -s Subject -Smime-encoding=8b "${MBOX}" \
6030 check
1 0 "${MBOX}" '3835153597 136'
6031 printf 'Hey, you.\n\nFrom me to you\nCiao.\n' |
6032 ${MAILX} ${ARGS} -s Subject -Smime-encoding=8b "${MBOX}" \
6034 check 2 0 "${MBOX}" '63875210 275'
6037 printf 'Hey, you.\n From me to you\nCiao\n' |
6038 ${MAILX} ${ARGS} -s Subject -Smime-encoding=qp "${MBOX}" \
6040 check
3 0 "${MBOX}" '465798521 412'
6041 printf 'Hey, you.\nFrom me to you\nCiao\n' |
6042 ${MAILX} ${ARGS} -s Subject -Smime-encoding=qp "${MBOX}" \
6044 check 4 0 "${MBOX}" '2075263697 655'
6047 printf 'Hey, you.\n From me to you\nCiao\n' |
6048 ${MAILX} ${ARGS} -s Subject -Smime-encoding=b64 "${MBOX}" \
6050 check
5 0 "${MBOX}" '601672771 792'
6051 printf 'Hey, you.\nFrom me to you\nCiao\n' |
6052 ${MAILX} ${ARGS} -s Subject -Smime-encoding=b64 "${MBOX}" \
6054 check 6 0 "${MBOX}" '3926760595 1034'
6059 t_xxxheads_rfc2047() {
6062 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
6063 -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̲' \
6065 check 1 0 "${MBOX}" '3422562347 371'
6067 # Single word (overlong line split -- bad standard! Requires injection of
6068 # artificial data!! But can be prevented by using RFC 2047 encoding)
6070 i=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_
"}'`
6071 echo | ${MAILX} ${ARGS} -s "${i}" "${MBOX}"
6072 check
2 0 "${MBOX}" '3317256266 1714'
6074 # Combination of encoded words, space and tabs of varying sort
6076 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
6077 -s "1Abrä Kaspas1 2Abra Katä b_kaspas2 \
6078 3Abrä Kaspas3 4Abrä Kaspas4 5Abrä Kaspas5 \
6079 6Abra Kaspas6 7Abrä Kaspas7 8Abra Kaspas8 \
6080 9Abra Kaspastäb4-3 10Abra Kaspas1 _ 11Abra Katäb1 \
6081 12Abra Kadabrä1 After Tab after Täb this is NUTS" \
6083 check
3 0 "${MBOX}" '786672837 587'
6085 # Overlong multibyte sequence that must be forcefully split
6086 # todo This works even before v15.0, but only by accident
6088 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
6089 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
6090 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
6091 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
6093 check
4 0 "${MBOX}" '2889557767 655'
6097 echo |
${MAILX} ${ARGS} \
6098 -s "1-1 B2 B3 B4 B5 B6 B\
6099 1-2 B2 B3 B4 B5 B6 B\
6100 1-3 B2 B3 B4 B5 B6 B\
6101 1-4 B2 B3 B4 B5 B6 B\
6102 1-5 B2 B3 B4 B5 B6 B\
6103 1-6 B2 B3 B4 B5 B6 " \
6105 check
5 0 "${MBOX}" '3135161683 293'
6107 # Leading and trailing WS
6109 echo |
${MAILX} ${ARGS} \
6110 -s " 2-1 B2 B3 B4 B5 B6 B\
6111 1-2 B2 B3 B4 B5 B6 B\
6112 1-3 B2 B3 B4 B5 B6 B\
6113 1-4 B2 B3 B4 B5 B6 " \
6115 check
6 0 "${MBOX}" '3221845405 232'
6117 # RFC 2047 in an address field! (Missing test caused v14.9.6!)
6119 echo "Dat Früchtchen riecht häußlich" |
6120 ${MAILX} ${ARGS} ${ADDARG_UNI} -Sfullnames -Smta=test://"$MBOX" \
6122 'Schnödes "Früchtchen" <do@du> (Hä!)'
6123 check
7 0 "${MBOX}" '3681801246 373'
6125 # RFC 2047 in an address field, and iconv involved
6126 if have_feat
iconv; then
6128 ${cat} > .
/.trebox
<<_EOT
6129 From zaza@exam.ple Fri Mar 2 21:31:56 2018
6130 Date: Fri, 2 Mar 2018 20:31:45 +0000
6131 From: z=?iso-8859-1?Q?=E1?=za <zaza@exam.ple>
6132 To: dude <dude@exam.ple>
6133 Subject: houston(...)
6134 Message-ID: <abra@1>
6136 Content-Type: text/plain; charset=iso-8859-1
6137 Content-Disposition: inline
6138 Content-Transfer-Encoding: 8bit
6141 echo reply |
${MAILX} ${ARGS} ${ADDARG_UNI} \
6142 -Sfullnames -Sreply-in-same-charset \
6143 -Smta=test://"$MBOX" -Rf .
/.trebox
6144 check
8 0 "${MBOX}" '3499372945 285'
6146 t_echoskip
'8:[!ICONV]'
6152 t_iconv_mbyte_base64
() { # TODO uses sed(1) and special *headline*!!
6155 if [ -n "${UTF8_LOCALE}" ] && have_feat multibyte-charsets
&&
6156 have_feat
iconv; then
6157 if (</dev
/null
iconv -f ascii
-t iso-2022-jp
) >/dev
/null
2>&1 ||
6158 (</dev
/null
iconv -f ascii
-t euc-jp
) >/dev
/null
2>&1; then
6161 t_echoskip
'[ICONV/iconv(1):missing conversion(s)]'
6166 t_echoskip
'[no UTF-8 locale or !MULTIBYTE-CHARSETS or !ICONV]'
6171 if (</dev
/null
iconv -f ascii
-t iso-2022-jp
) >/dev
/null
2>&1; then
6172 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6173 -Smta=test://"$MBOX" \
6174 -Sescape=! -Smime-encoding=base64
2>.
/.terr
6175 set ttycharset
=utf-8 sendcharsets
=iso-2022-jp
6177 !s Japanese from UTF-8 to ISO-2022-JP
6178 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの
1種をシジュウカラと呼ぶ。
6180 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6183 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6185 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの
1種をシジュウカラと呼ぶ。
6188 set ttycharset
=iso-2022-jp charset-7bit
=iso-2022-jp sendcharsets
=utf-8
6190 !s Japanese from ISO-2022-JP to UTF-8
, eh
, no
, also ISO-2022-JP
6191 \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
6193 \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
6196 \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
6198 \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
6201 # May not presume iconv output as long as roundtrip possible [489a7122]
6203 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
6204 < "${MBOX}" > ./.tcksum
6205 check 1 - ./.tcksum '3314001564 516'
6206 check 2 - ./.terr '4294967295 0'
6208 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
6209 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6210 -S headline="%>%a%m %-18f %-16d %i%-s" \
6211 -Rf "${MBOX}" >./.tlog 2>&1
6212 check 3 0 ./.twrite '1259742080 686'
6213 #check 4 - ./.tlog '3214068822 2123'
6214 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
6215 check 4 - ./.txlog '4083300132 2030'
6217 t_echoskip '1-4:[ICONV/iconv(1):ISO-2022-JP unsupported]'
6220 if (</dev/null iconv -f ascii -t euc-jp) >/dev/null 2>&1; then
6221 ${rm} -f "${MBOX}" ./.twrite
6222 ${cat} <<-'_EOT' | LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6223 -Smta=test://"$MBOX" \
6224 -Sescape=! -Smime-encoding=base64 2>./.terr
6225 set ttycharset=utf-8 sendcharsets=euc-jp
6227 !s Japanese from UTF-8 to EUC-JP
6228 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
6230 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6233 カンムリガラ(学名Parus cristatus)は、スズメ目シジュウカラ科に分類される鳥類の一種。
6235 シジュウカラ科(シジュウカラか、学名 Paridae)は、鳥類スズメ目の科である。シジュウカラ(四十雀)と総称されるが、狭義にはこの1種をシジュウカラと呼ぶ。
6238 set ttycharset=EUC-JP sendcharsets=utf-8
6240 !s Japanese from EUC-JP to UTF-8
6241 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
6243 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
6246 ¥«¥ó¥à¥ê¥¬¥é¡Ê³Ø̾Parus cristatus¡Ë¤Ï¡¢¥¹¥º¥áÌÜ¥·¥¸¥å¥¦¥«¥é²Ê¤ËʬÎव¤ì¤ëÄ»Îà¤Î°ì¼ï¡£
6248 ¥·¥¸¥å¥¦¥«¥é²Ê¡Ê¥·¥¸¥å¥¦¥«¥é¤«¡¢³Ø̾ Paridae¡Ë¤Ï¡¢Ä»Îॹ¥º¥áÌܤβʤǤ¢¤ë¡£¥·¥¸¥å¥¦¥«¥é¡Ê»Í½½¿ý¡Ë¤ÈÁí¾Î¤µ¤ì¤ë¤¬¡¢¶¹µÁ¤Ë¤Ï¤³¤Î1¼ï¤ò¥·¥¸¥å¥¦¥«¥é¤È¸Æ¤Ö¡£
6252 ${awk} 'BEGIN{h=1}/^$/{++h;next}{if(h % 2 == 1)print}' \
6253 < "${MBOX}" > ./.tcksum
6254 check 5 - ./.tcksum '1754179361 469'
6255 check 6 - ./.terr '4294967295 0'
6257 printf 'eval f 1; eval write ./.twrite; eval type 1; eval type 2\n' |
6258 LC_ALL=${UTF8_LOCALE} ${MAILX} ${ARGS} \
6259 -S headline="%>%a%m %-18f %-16d %i%-s" \
6260 -Rf "${MBOX}" >./.tlog 2>&1
6261 check 7 0 ./.twrite '1259742080 686'
6262 #check 8 - ./.tlog '2506063395 2075'
6263 ${sed} -e '/^\[-- M/d' < ./.tlog > ./.txlog
6264 check 8 - ./.txlog '3192017734 1983'
6266 t_echoskip '5-8:[ICONV/iconv(1):EUC-JP unsupported]'
6272 t_iconv_mainbody() {
6275 if [ -n "${UTF8_LOCALE}" ] && have_feat iconv; then :; else
6276 t_echoskip '[no UTF-8 locale or !ICONV]'
6281 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=test://"$MBOX" \
6282 -S charset-7bit=us-ascii -S charset-8bit=utf-8 \
6283 -s '–' over-the@rain.bow 2>./.terr
6284 check 1 0 "${MBOX}" '3559538297 250'
6285 check 2 - ./.terr '4294967295 0'
6287 printf '–' | ${MAILX} ${ARGS} ${ADDARG_UNI} -Smta=test://"$MBOX" \
6288 -S charset-7bit=us-ascii -S charset-8bit=us-ascii \
6289 -s '–' over-the@rain.bow 2>./.terr
6291 check 3 - "${MBOX}" '3559538297 250'
6292 if have_feat uistrings; then
6293 check 4 - ./.terr '271380835 121'
6295 t_echoskip '4:[!UISTRINGS]'
6298 # The different iconv(3) implementations use different replacement sequence
6299 # types (character-wise, byte-wise, and the character(s) used differ)
6300 i="${MAILX_ICONV_MODE}"
6301 if [ -n "${i}" ]; then
6302 printf 'p\nx\n' | ${MAILX} ${ARGS} -Rf "${MBOX}" >./.tout 2>./.terr
6304 check_ex0 5-1-estat ${j}
6305 check 5-1 - ./.terr '4294967295 0'
6306 if [ ${i} -eq 13 ]; then
6307 check 5-2 - ./.tout '189327996 283' # XXX old (before test MTA)
6308 elif [ ${i} -eq 12 ]; then
6309 check 5-3 - ./.tout '1959197095 283' # XXX old (before test MTA)
6310 elif [ ${i} -eq 3 ]; then
6311 check 5-4 - ./.tout '3544755786 278'
6313 check 5-5 - ./.tout '2381160335 278'
6316 t_echoskip '5:[test unsupported]'
6322 t_binary_mainbody() {
6325 printf 'abra\0\nka\r\ndabra' |
6326 ${MAILX} ${ARGS} ${ADDARG_UNI} -s 'binary with carriage-return!' \
6328 check 1 0 "${MBOX}" '1629827 239'
6329 check 2 - ./.terr '4294967295 0'
6331 printf 'p\necho\necho writing now\nwrite ./.twrite\n' |
6332 ${MAILX} ${ARGS} -Rf \
6333 -Spipe-application/octet-stream="?* ${cat} > ./.tcat" \
6334 "${MBOX}" >./.tall 2>&1
6335 check 3 0 ./.tall '733582513 319'
6336 check 4 - ./.tcat '3817108933 15'
6337 check 5 - ./.twrite '3817108933 15'
6342 t_mime_force_sendout() {
6345 if have_feat iconv; then :; else
6346 t_echoskip '[!ICONV]'
6351 printf '\150\303\274' > ./.tmba
6352 printf 'ha' > ./.tsba
6353 printf '' > "${MBOX}"
6355 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6357 over-the@rain.bow 2>>${ERR}
6358 check 1 4 "${MBOX}" '4294967295 0'
6360 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6361 -s go -Smime-force-sendout \
6362 over-the@rain.bow 2>>${ERR}
6363 check 2 0 "${MBOX}" '1866273282 219'
6365 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6367 -a ./.tmba over-the@rain.bow 2>>${ERR}
6368 check 3 4 "${MBOX}" '1866273282 219'
6370 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6371 -s go -Smime-force-sendout \
6372 -a ./.tmba over-the@rain.bow 2>>${ERR}
6373 check 4 0 "${MBOX}" '644433809 880'
6375 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6377 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6378 check 5 4 "${MBOX}" '644433809 880'
6380 printf ha | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6381 -s go -Smime-force-sendout \
6382 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6383 check 6 0 "${MBOX}" '3172365123 1729'
6385 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6387 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6388 check 7 4 "${MBOX}" '3172365123 1729'
6390 printf '\150\303\244' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6391 -s go -Smime-force-sendout \
6392 -a ./.tsba -a ./.tmba over-the@rain.bow 2>>${ERR}
6393 check 8 0 "${MBOX}" '4002905306 2565'
6398 t_C_opt_customhdr() {
6402 ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6403 -C 'C-One : Custom One Body' \
6404 -C 'C-Two:CustomTwoBody' \
6405 -C 'C-Three: CustomThreeBody ' \
6406 -S customhdr='chdr1: chdr1 body, chdr2:chdr2 body, chdr3: chdr3 body ' \
6407 this-goes@nowhere >./.tall 2>&1
6409 ${cat} ./.tall >> "${MBOX}"
6410 check 1 0 "${MBOX}" '2535463301 238'
6413 printf 'm this-goes@nowhere\nbody\n!.
6415 m this-goes2@nowhere\nbody2\n!.
6416 set customhdr=%ccustom1 : custom1 body%c
6417 m this-goes3@nowhere\nbody3\n!.
6418 set customhdr=%ccustom1 : custom1\\, body , \\
6419 custom2: custom2 body , custom-3 : custom3 body ,\\
6420 custom-4:custom4-body %c
6421 m this-goes4@nowhere\nbody4\n!.
6423 ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
6424 -C 'C-One : Custom One Body' \
6425 -C 'C-Two:CustomTwoBody' \
6426 -C 'C-Three: CustomThreeBody ' \
6427 -C ' C-Four:CustomFourBody ' \
6428 -C 'C-Five:CustomFiveBody' \
6429 -S customhdr='ch1: b1 , ch2:b2, ch3:b3 ,ch4:b4, ch5: b5 ' \
6432 ${cat} ./.tall >> "${MBOX}"
6433 check 2 0 "${MBOX}" '544085062 1086'
6439 # Operational basics with trivial tests {{{
6443 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" > ./.tall 2>&1
6445 alias a1 ex2@a1.ple "EX3 <ex3@a1.ple>"
6447 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
6449 alias a4 a5 ex1@a4.ple
6451 alias a6 a7 ex1@a6.ple
6465 check 1 0 "${MBOX}" '139467786 277'
6466 check 2 - .tall '1598893942 133'
6468 if have_feat uistrings; then
6469 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6470 commandalias x echo '$?/$^ERRNAME'
6472 alias a:bra! ha@m beb@ra ha@m '' zeb@ra ha@m; x
6474 alias ha@m ham-expansion ha@m '';x
6476 alias beb@ra ceb@ra beb@ra1;x
6478 alias ceb@ra ceb@ra1;x
6496 \alias noexpa@and this@error1;x
6497 \alias ha@m '\noexp@and' expa@and \\noexp@and2;x
6500 \alias noexpa@and2 this@error2;x
6501 \alias expa1@and this@error3;x
6502 \alias expa@and \\expa1@and;x
6507 check 3 0 "${MBOX}" '1513155156 796'
6509 t_echoskip '3:[!UISTRINGS]'
6512 # TODO t_alias: n_ALIAS_MAXEXP is compile-time constant,
6513 # TODO need to somehow provide its contents to the test, then test
6521 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6522 commandalias x echo '$?/$^ERRNAME'
6524 charsetalias latin1 latin15;x
6525 charsetalias latin1;x
6526 charsetalias - latin1;x
6528 charsetalias cp1252 latin1 latin15 utf8 utf8 utf16;x
6529 charsetalias cp1252;x
6530 charsetalias latin15;x
6533 charsetalias - cp1252;x
6534 charsetalias - latin15;x
6535 charsetalias - utf8;x
6537 charsetalias latin1;x
6538 charsetalias - latin1;x
6539 uncharsetalias latin15;x
6540 charsetalias latin1;x
6541 charsetalias - latin1;x
6543 check 1 0 "${MBOX}" '3551595280 433'
6551 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6552 commandalias x echo '$?/$^ERRNAME'
6554 shortcut file1 expansion-of-file1;x
6555 shortcut file2 expansion-of-file2;x
6556 shortcut file3 expansion-of-file3;x
6557 shortcut file4 'expansion of file4' 'file 5' 'expansion of file5';x
6567 check 1 0 "${MBOX}" '1970515669 430'
6575 if have_feat netrc; then :; else
6576 t_echoskip '[!NETRC]'
6582 machine x.local login a1 machine x.local login a2 password p2
6583 machine x.local login a3 password "p 3"
6590 machine *.x.local login a2 password p2-any!
6591 machine y.local login ausr password apass
6595 # and unused default
6596 default login defacc password defpass
6598 ${chmod} 0600 ./.tnetrc
6600 printf 'netrc;echo =$?;netrc c;echo =$?;netr loa;echo =$?;netr s;echo =$?' |
6601 NETRC=./.tnetrc ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6602 check 1 0 "${MBOX}" '2911708535 542'
6604 have_feat uistrings && i='3076722625 893' || i='3808149439 645'
6610 echo ==(re)load cache
6611 netrc load;echo $?/$^ERRNAME
6613 netrc loo a1@x.local
6614 netrc loo a2@x.local
6615 netrc loo a3@x.local
6616 netrc loo a4@x.local
6618 netrc clear;echo $?/$^ERRNAME
6620 netrc loo a2@pop.x.local
6621 netrc loo a2@imap.x.local
6622 netrc loo a2@smtp.x.local
6624 netrc loo a2@nono.smtp.x.local
6625 echo ==[usr@]unknown-host
6627 netrc loo defacc@a.local
6628 netrc loo a1@a.local
6629 ' | NETRC=./.tnetrc ${MAILX} ${ARGS} > "${MBOX}" 2>&1
6630 check 2 0 "${MBOX}" "${i}"
6636 # Operational basics with easy tests {{{
6639 # MTA alias specific part in t_mta_aliases()
6640 # This only tests from command line, rest later on (iff any)
6643 if have_feat uistrings; then :; else
6644 t_echoskip '[!UISTRINGS]'
6649 echo "${cat}" > ./.tcat
6650 ${chmod} 0755 ./.tcat
6653 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6654 -X'alias talias talias@exam.ple' \
6655 './.tfile' ' | ./.tcat > ./.tpipe' 'talias' 'taddr@exam.ple' \
6657 check 1 4 "${MBOX}" '1216011460 138'
6658 check 2 - .tall '4169590008 162'
6661 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6663 -X'alias talias talias@exam.ple' \
6664 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6666 check 3 0 "${MBOX}" '847567042 276'
6667 check 4 - .tall '4294967295 0'
6668 check 5 - .tfile '1216011460 138'
6669 check 6 - .tpipe '1216011460 138'
6672 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6673 -Sexpandaddr=-all,+file,+pipe,+name,+addr \
6674 -X'alias talias talias@exam.ple' \
6675 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6677 check 7 0 "${MBOX}" '3682360102 414'
6678 check 8 - .tall '4294967295 0'
6679 check 9 - .tfile '847567042 276'
6680 check 10 - .tpipe '1216011460 138'
6683 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6684 -Sexpandaddr=-all,+file,-file,+pipe,+name,+addr \
6685 -X'alias talias talias@exam.ple' \
6686 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6688 check 11 4 "${MBOX}" '1010907786 552'
6689 check 12 - .tall '673208446 70'
6690 check 13 - .tfile '847567042 276'
6691 check 14 - .tpipe '1216011460 138'
6693 printf '' > ./.tpipe
6694 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6695 -Sexpandaddr=fail,-all,+file,-file,+pipe,+name,+addr \
6696 -X'alias talias talias@exam.ple' \
6697 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6699 check 15 4 "${MBOX}" '1010907786 552'
6700 check 16 - .tall '3280630252 179'
6701 check 17 - .tfile '847567042 276'
6702 check 18 - .tpipe '4294967295 0'
6705 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6706 -Sexpandaddr=-all,+file,+pipe,-pipe,+name,+addr \
6707 -X'alias talias talias@exam.ple' \
6708 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6710 check 19 4 "${MBOX}" '3359494254 690'
6711 check 20 - .tall '4052857227 91'
6712 check 21 - .tfile '3682360102 414'
6713 check 22 - .tpipe '4294967295 0'
6715 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6716 -Sexpandaddr=fail,-all,+file,+pipe,-pipe,+name,+addr \
6717 -X'alias talias talias@exam.ple' \
6718 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6720 check 23 4 "${MBOX}" '3359494254 690'
6721 check 24 - .tall '2168069102 200'
6722 check 25 - .tfile '3682360102 414'
6723 check 26 - .tpipe '4294967295 0'
6726 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6727 -Sexpandaddr=-all,+file,+pipe,+name,-name,+addr \
6728 -X'alias talias talias@exam.ple' \
6729 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6731 check 27 0 "${MBOX}" '3735108703 828'
6732 check 28 - .tall '4294967295 0'
6733 check 29 - .tfile '1010907786 552'
6734 check 30 - .tpipe '1216011460 138'
6736 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6737 -Sexpandaddr=-all,+file,+pipe,+name,-name,+addr \
6738 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6740 check 31 4 "${MBOX}" '4225234603 949'
6741 check 32 - .tall '3486613973 73'
6742 check 33 - .tfile '452731060 673'
6743 check 34 - .tpipe '1905076731 121'
6745 printf '' > ./.tpipe
6746 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6747 -Sexpandaddr=fail,-all,+file,+pipe,+name,-name,+addr \
6748 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6750 check 35 4 "${MBOX}" '4225234603 949'
6751 check 36 - .tall '3032065285 182'
6752 check 37 - .tfile '452731060 673'
6753 check 38 - .tpipe '4294967295 0'
6756 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6757 -Sexpandaddr=-all,+file,+pipe,+name,+addr,-addr \
6758 -X'alias talias talias@exam.ple' \
6759 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6761 check 39 4 "${MBOX}" '4225234603 949'
6762 check 40 - .tall '3863610168 169'
6763 check 41 - .tfile '1975297706 775'
6764 check 42 - .tpipe '130065764 102'
6766 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6767 -Sexpandaddr=-all,+file,+pipe,+name,+addr,-addr \
6768 -Sadd-file-recipients \
6769 -X'alias talias talias@exam.ple' \
6770 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6772 check 43 4 "${MBOX}" '4225234603 949'
6773 check 44 - .tall '3863610168 169'
6774 check 45 - .tfile '3291831864 911'
6775 check 46 - .tpipe '4072000848 136'
6777 printf '' > ./.tpipe
6778 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6779 -Sexpandaddr=fail,-all,+file,+pipe,+name,+addr,-addr \
6780 -Sadd-file-recipients \
6781 -X'alias talias talias@exam.ple' \
6782 './.tfile' ' | ./.tcat >./.tpipe' 'talias' 'taddr@exam.ple' \
6784 check 47 4 "${MBOX}" '4225234603 949'
6785 check 48 - .tall '851041772 278'
6786 check 49 - .tfile '3291831864 911'
6787 check 50 - .tpipe '4294967295 0'
6790 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6791 -Sexpandaddr=-all,+addr \
6792 'taddr@exam.ple' 'this@@c.example' \
6794 check 51 4 "${MBOX}" '473729143 1070'
6795 check 52 - .tall '2646392129 66'
6797 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6798 -Sexpandaddr=-all,failinvaddr \
6799 'taddr@exam.ple' 'this@@c.example' \
6801 check 53 4 "${MBOX}" '473729143 1070'
6802 check 54 - .tall '887391555 175'
6805 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6806 -Sthis=taddr@exam.ple -Sexpandaddr \
6807 -c '\$this' -b '\$this' '\$this' \
6809 check 55 4 "${MBOX}" '473729143 1070'
6810 check 56 - .tall '1144578880 139'
6812 </dev/null ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -ssub \
6813 -Sthis=taddr@exam.ple -Sexpandaddr=shquote \
6814 -c '\$this' -b '\$this' '\$this' \
6816 check 57 0 "${MBOX}" '398243793 1191'
6817 check 58 - .tall '4294967295 0'
6820 printf '' > "${MBOX}"
6822 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6823 -Sadd-file-recipients \
6824 -Sexpandaddr=-all,+fcc \
6829 check 59 0 "${MBOX}" '4294967295 0'
6830 check 60 - .tall '4294967295 0'
6831 check 61 - .tfile1 '1067276522 124'
6832 check 62 - .tfile2 '1067276522 124'
6834 printf '' > "${MBOX}"
6836 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6837 -Sadd-file-recipients \
6838 -Sexpandaddr=-all,+file \
6843 check 63 0 "${MBOX}" '4294967295 0'
6844 check 64 - .tall '4294967295 0'
6845 check 65 - .tfile1 '2677253527 248'
6846 check 66 - .tfile2 '2677253527 248'
6848 printf '' > "${MBOX}"
6850 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6851 -Sadd-file-recipients \
6852 -Sexpandaddr=-all,+file,-fcc \
6857 check 67 0 "${MBOX}" '4294967295 0'
6858 check 68 - .tall '4294967295 0'
6859 check 69 - .tfile1 '3493511004 372'
6860 check 70 - .tfile2 '3493511004 372'
6862 printf '' > "${MBOX}"
6864 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6865 -Sadd-file-recipients \
6866 -Sexpandaddr=-all,+fcc,-file \
6871 check 71 4 "${MBOX}" '4294967295 0'
6872 check 72 - .tall '203687556 223'
6873 check 73 - .tfile1 '3493511004 372'
6874 check 74 - .tfile2 '3493511004 372'
6876 printf '' > "${MBOX}"
6878 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6879 -Sadd-file-recipients \
6880 -Sexpandaddr=-all,fail,+addr \
6886 check 75 4 "${MBOX}" '4294967295 0'
6887 check 76 - .tall '4060426468 247'
6888 check 77 - .tfile1 '3493511004 372'
6889 check 78 - .tfile2 '3493511004 372'
6892 printf '' > "${MBOX}"
6894 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6895 -Sexpandaddr=fail,domaincheck \
6899 check 79 0 "${MBOX}" '171635532 120'
6900 check 80 - .tall '4294967295 0'
6903 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6904 -Sexpandaddr=domaincheck \
6906 To: one@localhost , Hey two <two@exam.ple>, Trouble <three@tro.uble>
6908 check 81 4 "${MBOX}" '2659464839 240'
6909 check 82 - .tall '1119895397 158'
6912 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6913 -Sexpandaddr=fail,domaincheck \
6915 To: one@localhost , Hey two <two@exam.ple>, Trouble <three@tro.uble>
6917 check 83 4 "${MBOX}" '2659464839 240'
6918 check 84 - .tall '1577313789 267'
6921 ${MAILX} ${ARGS} -Snoexpandaddr -Smta=test://"$MBOX" -t -ssub \
6922 -Sexpandaddr=fail,domaincheck \
6923 -Sexpandaddr-domaincheck=exam.ple,tro.uble \
6925 To: one@localhost , Hey two <two@exam.ple>, Trouble <three@tro.uble>
6927 check 85 0 "${MBOX}" '1670655701 410'
6928 check 86 - .tall '4294967295 0'
6934 # after: t_expandaddr
6937 if have_feat mta-aliases; then :; else
6938 t_echoskip '[!MTA_ALIASES]'
6943 ${cat} > ./.tali <<- '__EOT'
6949 ex2@a1.ple, <ex3@a1.ple> ,
6951 a2: ex1@a2.ple , ex2@a2.ple,a2_2
6952 a2_2:ex3@a2.ple,ex4@a2.ple
6965 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6966 -Smta-aliases=./.tali \
6967 -b a3 -c a2 a1 > ./.tall 2>&1
6968 check 1 0 "${MBOX}" '1172368381 238'
6969 check 2 - .tall '4294967295 0'
6971 ## xxx The following are actually *expandaddr* tests!!
6973 # May not send plain names over SMTP!
6975 if have_feat smtp; then
6976 echo | ${MAILX} ${ARGS} \
6977 -Smta=smtp://laber.backe -Ssmtp-auth=none \
6978 -Smta-aliases=./.tali \
6979 -b a3 -c a2 a1 > ./.tall 2>&1
6981 check 4 - "${MBOX}" '1172368381 238'
6984 if [ -n "${mtaali}" ] && have_feat uistrings; then
6985 check 5 - .tall '771616226 179'
6987 t_echoskip '5:[!SMTP/!UISTRINGS]'
6990 # xxx for false-positive SMTP test we would need some mocking
6991 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
6992 -Sexpandaddr=fail,-name \
6993 -Smta-aliases=./.tali \
6994 -b a3 -c a2 a1 > ./.tall 2>&1
6996 check 7 - "${MBOX}" '1172368381 238'
6997 if have_feat uistrings; then
6998 check 8 - .tall '2834389894 178'
7000 t_echoskip '8:[!UISTRINGS]'
7003 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
7004 -Sexpandaddr=-name \
7005 -Smta-aliases=./.tali \
7006 -b a3 -c a2 a1 > ./.tall 2>&1
7007 check 9 4 "${MBOX}" '2322273994 472'
7008 if have_feat uistrings; then
7009 check 10 - .tall '2136559508 69'
7011 t_echoskip '10:[!UISTRINGS]'
7014 echo 'a9:nine@nine.nine' >> ./.tali
7016 echo | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
7017 -Sexpandaddr=fail,-name \
7018 -Smta-aliases=./.tali \
7019 -b a3 -c a2 a1 > ./.tall 2>&1
7020 check 11 0 "${MBOX}" '2422268299 722'
7021 check 12 - .tall '4294967295 0'
7024 set expandaddr=-name
7028 !^header insert bcc a3
7034 !^header insert bcc a3
7037 echo and, once again, check that cache is updated
7038 # Enclose one pipe in quotes: immense stress for our stupid address parser:(
7039 !echo "a10:./.tf1,|%s>./.tp1,\\"|%s > ./.tp2\\",./.tf2" >> ./.tali
7044 !^header insert bcc a3
7047 echo trigger happiness
7051 !^header insert bcc "a3 a10"
7054 ' "${cat}" "${cat}" | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
7055 -Smta-aliases=./.tali \
7057 check 13 0 "${MBOX}" '550955032 1469'
7058 if have_feat uistrings; then
7059 check 14 - .tall '1795496020 473'
7061 t_echoskip '14:[!UISTRINGS]'
7063 check 15 - .tf1 '3056269950 249'
7064 check 16 - .tp1 '3056269950 249'
7065 check 17 - .tp2 '3056269950 249'
7066 check 18 - .tf2 '3056269950 249'
7068 # TODO t_mta_aliases: n_ALIAS_MAXEXP is compile-time constant,
7069 # TODO need to somehow provide its contents to the test, then test
7077 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ %s\n~.\n' \
7078 "${TOPDIR}snailmail.jpg" | ${MAILX} ${ARGS} -Smta=test://"$MBOX"
7079 check 1 0 "${MBOX}" '1314354444 13536'
7081 if (echo | gzip -c) >/dev/null 2>&1; then
7083 printf 'File "%s"\ncopy 1 ./.t.mbox.gz\ncopy 2 ./.t.mbox.gz' \
7084 "${MBOX}" | ${MAILX} ${ARGS} \
7085 -X'filetype gz gzip\ -dc gzip\ -c'
7086 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
7087 ${MAILX} ${ARGS} -X'filetype gz gzip\ -dc gzip\ -c'
7089 check 2 - ./.t.mbox '1314354444 13536'
7090 check 3 - ./.t.out '635961640 103'
7092 t_echoskip '2:[missing gzip(1)]'
7093 t_echoskip '3:[missing gzip(1)]'
7098 printf 'File "%s"\ncopy 1 ./.t.mbox.gz
7104 -X'filetype gz gzip\ -dc gzip\ -c' \
7105 -X'filetype mbox.gz "${sed} 1,3d|${cat}" \
7106 "echo eins;echo zwei;echo und mit ${sed} bist Du dabei;${cat}"'
7107 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
7109 -X'filetype gz gzip\ -dc gzip\ -c' \
7110 -X'filetype mbox.gz "${sed} 1,3d|${cat}" kill\ 0'
7112 check 4 - ./.t.mbox '2687765142 27092'
7113 check 5 - ./.t.out '2230192693 173'
7122 ${MAILX} ${ARGS} -ef ./.t.mbox
7123 echo ${?} > "${MBOX}"
7125 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
7126 ${MAILX} ${ARGS} -Smta=test://./.t.mbox
7127 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
7128 ${MAILX} ${ARGS} -Smta=test://./.t.mbox
7130 ${MAILX} ${ARGS} -ef ./.t.mbox 2>> "${MBOX}"
7131 echo ${?} >> "${MBOX}"
7132 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox 2>> "${MBOX}"
7133 echo ${?} >> "${MBOX}"
7134 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox 2>> "${MBOX}"
7135 echo ${?} >> "${MBOX}"
7136 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox 2>> "${MBOX}"
7137 echo ${?} >> "${MBOX}"
7138 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox 2>> "${MBOX}"
7139 echo ${?} >> "${MBOX}"
7140 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox 2>> "${MBOX}"
7141 echo ${?} >> "${MBOX}"
7142 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox 2>> "${MBOX}"
7143 echo ${?} >> "${MBOX}"
7145 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}" 2>&1
7146 echo ${?} >> "${MBOX}"
7147 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}" 2>&1
7148 echo ${?} >> "${MBOX}"
7149 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}" 2>&1
7150 echo ${?} >> "${MBOX}"
7151 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}" 2>&1
7152 echo ${?} >> "${MBOX}"
7153 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}" 2>&1
7154 echo ${?} >> "${MBOX}"
7155 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}" 2>&1
7156 echo ${?} >> "${MBOX}"
7157 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>>${ERR}
7158 echo ${?} >> "${MBOX}"
7160 check 1 - "${MBOX}" '1369201287 670'
7164 printf 'm me1@exam.ple\n~s subject cab\nLine 1.\n~.\n' |
7165 ${MAILX} ${ARGS} -Smta=test://./.t.mbox \
7166 -r '' -X 'wysh set from=pony1@$LOGNAME'
7167 printf 'm me2@exam.ple\n~s subject bac\nLine 12.\n~.\n' |
7168 ${MAILX} ${ARGS} -Smta=test://./.t.mbox \
7169 -r '' -X 'wysh set from=pony2@$LOGNAME'
7170 printf 'm me3@exam.ple\n~s subject abc\nLine 123.\n~.\n' |
7171 ${MAILX} ${ARGS} -Smta=test://./.t.mbox \
7172 -r '' -X 'wysh set from=pony3@$LOGNAME'
7174 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7175 echo fh-test size; set autosort=size showname showto
7176 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7177 check 2 0 "${MBOX}" '4286438644 413'
7179 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7180 echo fh-test subject; set autosort=subject showname showto
7181 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7182 check 3 0 "${MBOX}" '3208053922 416'
7184 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7185 echo fh-test from; set autosort=from showto
7186 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7187 check 4 0 "${MBOX}" '4209767839 413'
7189 ${MAILX} ${ARGS} -S folder-hook=fh-test -X 'define fh-test {
7190 echo fh-test to; set autosort=to showto
7191 }' -fH ./.t.mbox > "${MBOX}" 2>&1
7192 check 5 0 "${MBOX}" '2785342736 411'
7198 # Simple, if we need more here, place in a later vim fold!
7201 # Three tests for MIME encoding and (a bit) content classification.
7202 # At the same time testing -q FILE, < FILE and -t FILE
7203 t__put_body > ./.tin
7205 < ./.tin ${MAILX} ${ARGS} ${ADDARG_UNI} \
7206 -a ./.tin -s "`t__put_subject
`" "${MBOX}"
7207 check 1 0 "${MBOX}" '1088822685 6642'
7210 < /dev/null ${MAILX} ${ARGS} ${ADDARG_UNI} \
7211 -a ./.tin -s "`t__put_subject
`" -q ./.tin "${MBOX}"
7212 check 2 0 "${MBOX}" '1088822685 6642'
7215 ( echo "To: ${MBOX}" && echo "Subject: `t__put_subject
`" && echo &&
7217 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a ./.tin -t
7218 check 3 0 "${MBOX}" '1088822685 6642'
7220 # Check comments in the header
7222 ${cat} <<-_EOT | ${MAILX} ${ARGS} -Snodot -t "${MBOX}"
7225 # Noch ein Kommentar
7227 # Nachgestelltes Kommentar
7231 check 4 0 "${MBOX}" '4161555890 124'
7234 printf '' > "${MBOX}"
7235 ( echo 'To?single : ./.tout1 .tout2 ' &&
7236 echo 'CC: ./.tcc1 ./.tcc2' &&
7237 echo 'BcC?sin : ./.tbcc1 .tbcc2 ' &&
7238 echo 'To? : ./.tout3 .tout4 ' &&
7241 ) | ${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -t -Smta=test://"$MBOX"
7242 check 5 0 './.tout1 .tout2' '2948857341 94'
7243 check 6 - ./.tcc1 '2948857341 94'
7244 check 7 - ./.tcc2 '2948857341 94'
7245 check 8 - './.tbcc1 .tbcc2' '2948857341 94'
7246 check 9 - './.tout3 .tout4' '2948857341 94'
7247 check 10 - "${MBOX}" '4294967295 0'
7252 t_message_injections() {
7253 # Simple, if we need more here, place in a later vim fold!
7256 echo mysig > ./.tmysig
7258 echo some-body | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
7259 -Smessage-inject-head=head-inject \
7260 -Smessage-inject-tail="`${cat} .
/.tmysig
`"'\ntail-inject' \
7261 ex@am.ple > ./.tall 2>&1
7262 check 1 0 "${MBOX}" '701778583 143'
7263 check 2 - .tall '4294967295 0' # empty file
7266 ${cat} <<-_EOT > ./.template
7270 Subject: This subject is
7272 Body, body, body me.
7274 < ./.template ${MAILX} ${ARGS} -t -Smta=test://"$MBOX" \
7275 -Smessage-inject-head=head-inject \
7276 -Smessage-inject-tail="`${cat} .
/.tmysig
`\n"'tail-inject' \
7278 check 3 0 "${MBOX}" '2189109479 207'
7279 check 4 - .tall '4294967295 0' # empty file
7285 # TODO More should be in compose mode stuff aka digmsg
7288 ${cat} <<-_EOT > ./.tx
7289 From steffen Sun Feb 18 02:48:40 2018
7290 Date: Sun, 18 Feb 2018 02:48:40 +0100
7293 User-Agent: s-nail v14.9.7
7296 From steffen Sun Feb 18 02:48:42 2018
7297 Date: Sun, 18 Feb 2018 02:48:42 +0100
7300 User-Agent: s-nail v14.9.7
7305 printf 'att2-1\natt2-2\natt2-4\n' > ./'.t 2'
7306 printf 'att3-1\natt3-2\natt3-4\n' > ./.t3
7307 printf 'att4-1\natt4-2\natt4-4\n' > './.t 4'
7310 '!@ ./.t3 "./.t 4" ""
7318 | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" \
7319 -a ./.t1 -a './.t 2' \
7320 -s attachment-test \
7321 ex@am.ple > ./.tall 2>&1
7322 check 1 0 "${MBOX}" '2484200149 644'
7323 if have_feat uistrings; then
7324 check 2 - .tall '1928331872 720'
7326 t_echoskip '2:[!UISTRINGS]'
7332 !s This the subject is
7333 !@ ./.t3 "#2" "./.t 4" "#1" ""
7343 !@ ./.t3 "#2" "./.t 4" "#1" ""
7351 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
7360 !@ ./.t3 "" "#2" "" "./.t 4" "" "#1" ""
7374 | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Rf ./.tx \
7376 check 3 0 "${MBOX}" '3637385058 2335'
7377 if have_feat uistrings; then
7378 check 4 - .tall '2526106274 1910'
7380 t_echoskip '4:[!UISTRINGS]'
7409 | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Rf ./.tx \
7411 check 5 0 "${MBOX}" '1604688179 2316'
7412 if have_feat uistrings; then
7413 check 6 - .tall '1210753005 508'
7415 t_echoskip '6:[!UISTRINGS]'
7421 </dev/null ${MAILX} ${ARGS} -Smta=test \
7422 -Sstealthmua=noagent -Shostname \
7423 -a ./.t1 -a './.t 2' \
7424 -a ./.t3 -a './.t 4' \
7426 ex@am.ple > ./.tall 2>&1
7427 check 7 0 .tall '1003537919 1262'
7430 </dev/null ${MAILX} ${ARGS} -Smta=test -Sttycharset=utf8 \
7431 -a ./.t1=ascii -a './.t 2'=LATin1 \
7432 -a ./.t3=UTF-8 -a './.t 4'=- \
7434 ex@am.ple > ./.tall 2>&1
7435 check 8 0 .tall '361641281 921'
7437 # input+output charset, no iconv
7438 </dev/null ${MAILX} ${ARGS} -Smta=test \
7439 -a ./.t1=ascii#- -a './.t 2'=LATin1#- \
7440 -a ./.t3=UTF-8#- -a './.t 4'=utf8#- \
7442 ex@am.ple > ./.tall 2>&1
7443 check 9 0 .tall '1357456844 933'
7445 if have_feat iconv; then
7446 printf 'ein \303\244ffchen und ein pferd\n' > .t10-f1
7447 if (< .t10-f1 iconv -f ascii -t utf8) >/dev/null 2>&1; then
7448 </dev/null ${MAILX} ${ARGS} --set mta=test \
7449 --set stealthmua=noagent --set hostname \
7450 --attach ./.t1=-#utf8 \
7451 --attach ./.t10-f1=utf8#latin1 \
7453 ex@am.ple > ./.tall 2>&1
7454 check 10 0 .tall '1257664842 877'
7456 t_echoskip '10:[ICONV/iconv(1):missing conversion(1)]'
7459 t_echoskip '10:[!ICONV]'
7466 # (after attachments)
7470 mkdir ./.ttt || exit 1
7474 : > 'diet\ is \curd.txt'
7475 : > 'diet "is" curd.txt'
7477 : > 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
7478 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
7479 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
7480 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
7482 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
7483 -a "./.ttt/ma'ger.txt" -a "./.ttt/mä'ger.txt" \
7484 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is" curd.txt' \
7485 -a ./.ttt/höde-tröge.txt \
7486 -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 \
7487 -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 \
7488 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
7489 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
7491 check 1 0 "${MBOX}" '3720896054 3088'
7493 # `resend
' test, reusing $MBOX
7494 printf "Resend ./.t2\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
7495 check 2 0 ./.t2 '3720896054 3088'
7497 printf "resend ./.t3\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
7498 check 3 0 ./.t3 '3979736592 3133'
7500 # And a primitive test for reading messages with invalid parameters
7501 ${cat} <<-_EOT > ./.tinv
7502 From a@b.invalid Wed May 15 12:43:00 2018
7504 Content-Type: multipart/mixed; boundary="1"
7506 This is a multi-part message in MIME format.
7508 Content-Type: text/plain; charset=UTF-8
7509 Content-Transfer-Encoding: quoted-printable
7513 Content-Type: text/plain; name*17="na"; name*18="me-c-t"
7514 Content-Transfer-Encoding: 7bit
7515 Content-Disposition: inline
7520 From a@b.invalid Wed May 15 12:43:00 2018
7522 Content-Type: multipart/mixed; boundary="2"
7524 This is a multi-part message in MIME format.
7526 Content-Type: text/plain; charset=UTF-8
7527 Content-Transfer-Encoding: quoted-printable
7531 Content-Type: text/plain; name*17="na"; name*18="me-c-t"
7532 Content-Transfer-Encoding: 7bit
7533 Content-Disposition: inline;
7535 filename*998999999999999999999999999999="me-c-d"
7540 From a@b.invalid Wed May 15 12:43:00 2018
7542 Content-Type: multipart/mixed; boundary="3"
7544 This is a multi-part message in MIME format.
7546 Content-Type: text/plain; charset=UTF-8
7547 Content-Transfer-Encoding: quoted-printable
7551 Content-Type: text/plain; name*17="na"; name*18="me-c-t"
7552 Content-Transfer-Encoding: 7bit
7553 Content-Disposition: inline;
7554 filename*0="na"; filename*998="me-c-d"
7561 \\headerpick
type ignore Content-Type Content-Disposition
7564 ' | ${MAILX} ${ARGS} -Rf ./.tinv > ./.tall 2> ./.terr
7565 check 4 0 ./.tall '4094731083 905'
7566 if have_feat uistrings && have_feat iconv; then
7567 check 5 - ./.terr '3713266499 473'
7569 t_echoskip '5:[!UISTRINGS or
!ICONV
]'
7575 t_mime_types_load_control() {
7578 if have_feat uistrings; then :; else
7579 t_echoskip '[!UISTRINGS
]'
7584 ${cat} <<-_EOT > ./.tmts1
7585 ? application/mathml+xml mathml
7587 ${cat} <<-_EOT > ./.tmts2
7588 ? x-conference/x-cooltalk ice
7590 ? application/aga-aga aga
7593 ${cat} <<-_EOT > ./.tmts1.mathml
7594 <head>nonsense ML</head>
7596 ${cat} <<-_EOT > ./.tmts2.ice
7599 printf 'of
which the c
\x01rack is coming soon
' > ./.tmtsx.doom
7600 printf 'of
which the c
\x01rack is coming soon
' > ./.tmtsx.aga
7614 ' "${MBOX}" "${MBOX}" |
7616 -Smimetypes-load-control=f=./.tmts1,f=./.tmts2 \
7619 ${cat} "${MBOX}" >> ./.tout
7620 check 1 - ./.tout '2128819500 2441'
7622 echo type | ${MAILX} ${ARGS} -R \
7623 -Smimetypes-load-control=f=./.tmts1,f=./.tmts3 \
7624 -f "${MBOX}" >> ./.tout 2>&1
7625 check 2 0 ./.tout '1125106528 3642'
7631 # Around state machine, after basics {{{
7635 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" > ./.tall 2>&1
7636 commandalias x echo '$?
/$^ERRNAME
'
7637 commandalias y echo '$?
/$^ERRNAME
<$rv>'
7640 alternates a1@b1 a2@b2 a3@b3;x
7642 vput alternates rv;y
7646 vput alternates rv;y
7648 vput alternates rv;y
7650 vput alternates rv;y
7654 alternates a1@b1 a2@b2 a3@b3
7656 vput alternates rv;y
7658 vput alternates rv;y
7660 vput alternates rv;y
7663 alternates a1@b1 a2@b2 a3@b3
7665 vput alternates rv;y
7667 vput alternates rv;y
7669 vput alternates rv;y
7673 alternates a1@b1 a2@b2 a3@b3
7675 vput alternates rv;y
7679 alternates a1@b1 a1@c1 a1@d1 a2@b2 a3@b3 a3@c3 a3@d3
7681 ~s all alternates, only a1@b1 remains
7683 ~b a3@b3 a3@c3 a3@d3
7692 alternates a1@b1 a1@c1 a2@b2 a3@b3
7694 ~s a1@b1 a1@d1, and a3@c3 a3@d3 remain
7696 ~b a3@b3 a3@c3 a3@d3
7703 alternates a1@b1 a2@b2 a3; set allnet
7705 ~s all alternates via allnet, only a1@b1 remains
7707 ~b a3@b3 a3@c3 a3@d3
7716 vput alternates rv;y
7718 vput alternates rv;y
7720 vput alternates rv;y
7722 vput alternates rv;y
7725 vput alternates rv;y
7729 alternates a1@b1 a2@b2;x
7730 vput alternates rv;y
7731 alternates a3@b3 a4@b4;x
7732 vput alternates rv;y
7735 check 1 0 "${MBOX}" '3901995195 542'
7736 if have_feat uistrings; then
7737 check 2 - .tall '1878598364 505'
7739 t_echoskip '2:[!UISTRINGS
]'
7742 # Automatic alternates, also from command line (freezing etc.)
7744 ${cat} <<- __EOT > ./.tin
7745 From trouble-report@desy Wed Jun 6 20:19:28 2018
7746 Date: Wed, 06 Jun 2018 19:58:02 +0200
7747 From: a@b.org, b@b.org, c@c.org
7750 Cc: a@b.org, c@c.org
7752 Message-ID: <20180606175802.dw-cn%a@b.org>
7762 !^header remove subject
7763 !^header insert to b@b.org
7764 !^header insert cc
"a@b.org b@b.org c@c.org"
7767 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
7768 -S from=a@b.org,b@b.org,c@c.org -S sender=a@b.org \
7769 -Rf ./.tin > ./.tall 2>&1
7770 check 3 0 "${MBOX}" '3184203976 265'
7771 check 4 - .tall '3604001424 44'
7775 set from
=a@b.org
,b@b.org
,c@c.org sender
=a@b.org
7779 !^header remove subject
7780 !^header insert to b@b.org
7781 !^header insert cc
"a@b.org b@b.org c@c.org"
7784 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! \
7785 -Rf ./.tin > ./.tall 2>&1
7786 check 5 0 "${MBOX}" '98184290 530'
7787 check 6 - .tall '3604001424 44'
7789 # And more, with/out -r (and that Sender: vanishs as necessary)
7790 # TODO -r should be the Sender:, which should automatically propagate to
7791 # TODO From: if possible and/or necessary. It should be possible to
7792 # TODO suppres -r stuff from From: and Sender:, but fallback to special -r
7793 # TODO arg as appropriate.
7794 # TODO For now we are a bit messy
7797 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s '-Sfrom + -r ++ test' \
7798 -c a@b.example -c b@b.example -c c@c.example \
7799 -S from=a@b.example,b@b.example,c@c.example \
7800 -S sender=a@b.example \
7801 -r a@b.example b@b.example ./.tout >./.tall 2>&1
7802 check 7 0 "${MBOX}" '4275947318 181'
7803 check 8 - .tout '4275947318 181'
7804 check 9 - .tall '4294967295 0'
7806 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s '-Sfrom + -r ++ test' \
7807 -c a@b.example -c b@b.example -c c@c.example \
7808 -S from=a@b.example,b@b.example,c@c.example \
7809 -S sender=a2@b.example \
7810 -r a@b.example b@b.example ./.tout >./.tall 2>&1
7811 check 10 0 "${MBOX}" '1189494079 383'
7812 check 11 - .tout '1189494079 383'
7813 check 12 - .tall '4294967295 0'
7815 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" -s '-Sfrom + -r ++ test' \
7816 -c a@b.example -c b@b.example -c c@c.example \
7817 -S from=a@b.example,b@b.example,c@c.example \
7818 -S sender=a@b.example \
7819 b@b.example >./.tall 2>&1
7820 check 13 0 "${MBOX}" '2253033142 610'
7821 check 14 - .tall '4294967295 0'
7827 # quote and cmd escapes because this (since Mail times) is worked in the
7828 # big collect() monster of functions
7831 echo 'included
file' > ./.ttxt
7832 { t__x1_msg && t__x2_msg && t__x3_msg &&
7833 t__gen_msg from 'ex4@am.ple
' subject sub4 &&
7834 t__gen_msg from 'eximan
<ex5@am.ple
>' subject sub5 &&
7835 t__gen_mimemsg from 'ex6@am.ple
' subject sub6; } > ./.tmbox
7836 check 1 - ./.tmbox '517368276 2182'
7838 # ~@ is tested with other attachment stuff, ~^ is in compose_edits + digmsg
7840 set Sign
=SignVar sign
=signvar DEAD
=.
/.ttxt
7841 set forward-inject-head quote-inject-head
7842 headerpick
type retain Subject
7843 headerpick forward retain Subject To
7845 !!1 Not escaped. And shell
test last
, right before
!..
7847 !: echo 2 only echoed via colon
7848 !:echo 2:$?
/$^ERRNAME
7849 !_
echo 3 only echoed via underscore
7850 !:echo 3:$?
/$^ERRNAME
7852 !:echo 4:$?
/$^ERRNAME
7853 !<! echo 5 shell
echo included
7854 !:echo 5:$?
/$^ERRNAME
7855 !|
echo 6 pipecmd-pre
; cat; echo 6 pipecmd-post
7856 !:echo 6:$?
/$^ERRNAME
7857 7 and
8 are ~A and ~a
:
7859 !:echo 7:$?
/$^ERRNAME
7861 !:echo 8:$?
/$^ERRNAME
7862 !b
9 added ~b cc
<ex1@am.ple
>
7863 !:echo 9:$?
/$^ERRNAME
7864 !c
10 added ~c c
<ex2@am.ple
>
7865 !:echo 10:$?
/$^ERRNAME
7868 !:echo 11:$?
/$^ERRNAME
7871 !:echo 12:$?
/$^ERRNAME
7874 !:echo 13:$?
/$^ERRNAME
7876 !:echo 13-1:$?
/$^ERRNAME
; set posix
7877 14: ~f
(headerpick
: subject
)
7879 !:echo 14:$?
/$^ERRNAME
; unset posix forward-inject-head quote-inject-head
7880 14.1: ~f
(!posix
: injections
; headerpick
: subject to
)
7882 !:echo 14.1:$?
/$^ERRNAME
; set forward-add-cc
7883 14.2: ~f
(!posix
: headerpick
: subject to
; forward-add-cc adds mr3
)
7885 !:echo 14.2:$?
/$^ERRNAME
; set fullnames
7886 14.3: ~f
(!posix
: headerpick
: subject to
; forward-add-cc adds mr1 fullname
)
7888 !:echo 14.3:$?
/$^ERRNAME
; set nofullnames noforward-add-cc posix
7891 !:echo 15:$?
/$^ERRNAME
7894 !:echo 15.5-1:$?
/$^ERRNAME
7896 !:echo 15.5-2:$?
/$^ERRNAME
7897 16, 17: ~I Sign
, ~i Sign
7899 !:echo 16:$?
/$^ERRNAME
7901 !:echo 17:$?
/$^ERRNAME
7904 !:echo 18:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7907 !:echo 19:$?
/$^ERRNAME
7910 !:echo 20:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7913 !:echo 21:$?
/$^ERRNAME
7914 !: # Initially ~Q was _exactly_ like
7915 28,29 nothing
, 30-34: ~Q
7916 !:echo quote
=<$quote>
7919 !:echo 30:$?
/$^ERRNAME
7922 !:echo 31:$?
/$^ERRNAME
7923 set quote-inject-head quote-inject-tail indentprefix
7924 !:wysh
set quote-inject-head
=%%a quote-inject-tail
=--%%r
7927 !:echo 32:$?
/$^ERRNAME
7928 set noquote-inject-head noquote-inject-tail quote-add-cc
7929 !:set noquote-inject-head noquote-inject-tail quote-add-cc
7932 !:echo 33:$?
/$^ERRNAME
7937 !:echo 34:$?
/$^ERRNAME
7938 unset fullnames
, quote stuff
7939 !:unset quote quote-add-cc fullnames
7942 !:echo 22:$?
/$^ERRNAME
7945 !:echo 23:$?
/$^ERRNAME
7946 24: ~s this new subject
7947 !s
24 did new ~s ubject
7948 !:echo 24:$?
/$^ERRNAME
7949 !t
25 added ~t o
<ex3@am.ple
>
7950 !:echo 25:$?
/$^ERRNAME
7953 !:echo 26.1:$?
/$^ERRNAME
7956 !:echo 26.2:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7959 !:echo 27.1:$?
/$^ERRNAME
7962 !:echo 27.2:$?
/$^ERRNAME
# XXX forward-add-cc: not expl. tested
7963 and i ~w rite this out to .
/.tmsg
7965 !:echo i ~w
:$?
/$^ERRNAME
7966 !:wysh
set x
=$escape;set escape
=~
7967 ~
!echo shell
command output
7968 ~
:echo shell
:$?
/$^ERRNAME
7969 ~
:wysh
set escape
=$x
7972 !:echo 50 was F
:$?
/$^ERRNAME
7975 !:echo 51 was f
:$?
/$^ERRNAME
7978 !:echo 52 was M
:$?
/$^ERRNAME
7981 !:echo 53 was m
:$?
/$^ERRNAME
; set quote
7984 !:echo 54 was Q
:$?
/$^ERRNAME
7987 !:echo 55 was U
:$?
/$^ERRNAME
7990 !:echo 56 was u
:$?
/$^ERRNAME
7992 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Rf \
7993 -Sescape=! -Sindentprefix=' |
' \
7994 ./.tmbox >./.tall 2>./.terr
7996 ${cat} ./.tall >> "${MBOX}"
7997 check 2 - "${MBOX}" '3877629593 7699'
7999 if have_feat uistrings && have_feat iconv; then
8000 check 2-err - ./.terr '3575876476 49'
8002 t_echoskip '2-err:[!UISTRINGS or
!ICONV
]'
8004 check 3 - ./.tmsg '3502750368 4445'
8006 # Simple return/error value after *expandaddr* failure test
8009 !s This a new subject is
8010 !:set expandaddr
=-name
8019 !:alias abcc one@bcc.invalid
8022 !:set expandaddr
=+addr
8024 !:echo $
!/$?
/$^ERRNAME
8026 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
8028 -s testsub one@to.invalid >./.tall 2>&1
8029 check 4 0 "${MBOX}" '115245837 7900'
8030 if have_feat uistrings; then
8031 check 5 - ./.tall '2336041127 212'
8033 check 5 - ./.tall '1818580177 59'
8036 # Modifiers and whitespace indulgence
8038 !:remove
'"${MBOX}"'
8051 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
8054 -s testsub one@to.invalid >./.tall 2>./.terr
8055 check 6 4 ./.tall '686767281 95'
8056 [ -f "${MBOX}" ]; check_exn0 7
8057 if have_feat uistrings; then
8058 check 8 - ./.terr '1304637795 199'
8060 t_echoskip '8:[!UISTRINGS
]'
8066 t_compose_edits() { # XXX very rudimentary
8067 # after: t_cmd_escapes
8070 # Something to use as "editor"
8071 ${cat} <<-_EOT > ./.ted.sh
8073 ${cat} <<-__EOT > \${1}
8084 ${chmod} 0755 .ted.sh
8086 # > All these are in-a-row!
8088 printf 'mail .
/.tout
\n~s This subject is
\nThis body is
\n~.
' |
8089 ${MAILX} ${ARGS} -Seditheaders >./.tall 2>&1
8090 check 1 0 ./.tout '3993703854 127'
8091 check 2 - ./.tall '4294967295 0'
8093 ${mv} ./.tall ./.tout
8094 printf 'mail .
/.tout
\n~s This subject is
\nThis body is
\n~e
\n~.
' |
8095 ${MAILX} ${ARGS} -Seditheaders -SEDITOR=./.ted.sh >./.tall 2>&1
8096 check 3 0 ./.tout1 '285981670 116'
8097 check 4 - ./.tout2 '285981670 116'
8098 check 5 - ./.tout3 '285981670 116'
8099 check 6 - ./.tout '4294967295 0'
8100 check 7 - ./.tall '4294967295 0'
8101 ${rm} ./.tout1 ./.tout2 ./.tout3
8103 # Note t_compose_hooks adds ~^ stress tests
8104 ${mv} ./.tout ./.tout1
8105 ${mv} ./.tall ./.tout2
8107 mail .
/.tout
\n!s This subject is
\nThis body is
8113 !^header insert fcc .
/.tout
8114 !^header insert fcc .tout1
8115 !^header insert fcc .
/.tout2
8118 !^header remove-at fcc
2
8119 !^header remove-at fcc
2
8123 !^header insert fcc .
/.tout
8127 ' | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
8128 check 8 0 ./.tout '3993703854 127'
8129 check 9 - ./.tout1 '4294967295 0'
8130 check 10 - ./.tout2 '4294967295 0'
8131 check 11 - ./.tall '1857504914 342'
8133 # < No longer in-a-row
8135 ${cat} <<-_EOT | ${MAILX} ${ARGS} -t >./.tall 2>&1
8137 Subject: Fcc via -t test
8141 check 12 0 ./.ttout '1289478830 122'
8142 check 13 - ./.tall '4294967295 0'
8144 # This test assumes code of `^' and
`digmsg' is shared: see t_digmsg()
8145 echo 'b 1' > ./.t' x 1'
8146 echo 'b 2' > ./.t' x 2'
8149 !^header insert subject subject
8155 !^attachment insert "$i"
8161 !^attachment insert '"'"'./.t x 2'"'"'
8165 !^attachment remove "$i"
8169 !^attachment insert $'"'"'\\$i'"'"'
8177 !^a attribute-set "$i" filenames " cannot wait for you "
8181 !^a attribute-set "$i" filename " cannot wait for you "
8187 !^a attribute-set-at 2 "filename" "private eyes"
8191 !^a attribute-set-at 2 content-description "private c-desc"
8195 !^a attribute-set-at 2 content-ID "priv invd c-id"
8199 !^a attribute-set-at 2 content-TyPE tExT/mARkLO
8203 !^a attribute-set-at 2 content-TyPE ""
8208 ' | ${MAILX} ${ARGS} -Sescape=! >./.tall 2>&1
8209 check 14 0 ./.tall '3491667030 1565'
8210 check 15 - ./.tatt '1685063733 636'
8215 t_digmsg() { # XXX rudimentary; <> compose_edits()?
8219 mail ./.tout\n!s This subject is\nThis body is
8222 !:digmsg - header list
8223 !:digmsg - header show subject
8224 !:digmsg - header show to
8225 !:digmsg - header remove to
8226 !:digmsg - header list
8227 !:digmsg - header show to
8231 !:digmsg - header list; readall x; echon "<$x>";
8232 !:digmsg - header show subject;readall x;echon "<$x>";;
8235 !: # nothing here as is comment
8236 !^header insert fcc ./.tbox
8239 !:digmsg - header list
8240 !:digmsg - header show fcc
8244 !:digmsg - header list
8245 !:digmsg - header show fcc
8246 !:digmsg - header insert fcc ./.tfcc
8255 digmsg 1 header list
8256 digmsg 1 header show subject
8261 digmsg 1 header list; echo $?/$^ERRNAME
8262 digmsg create -; echo $?/$^ERRNAME
8264 ! %s ./.tfcc > ./.tcat
8265 ! %s "s/This subject is/There subject was/" < ./.tfcc >> ./.tcat
8267 mail nowhere@exam.ple
8269 !:digmsg create -; echo $?/$^ERRNAME;\\
8270 digmsg create 1; echo $?/$^ERRNAME;\\
8271 digmsg create 2; echo $?/$^ERRNAME
8273 !:digmsg - h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8275 !:digmsg 1 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8279 !:digmsg 2 h l;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8281 !:digmsg - h s to;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8283 !:digmsg 1 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8287 !:digmsg 2 h s subject;echo $?/$^ERRNAME;readall d;echo "$?/$^ERRNAME <$d>"
8289 !:digmsg remove -; echo $?/$^ERRNAME;\\
8290 digmsg remove 1; echo $?/$^ERRNAME;\\
8291 digmsg remove 2; echo $?/$^ERRNAME;
8293 echo ======= new game new fun!
8296 !:set expandaddr=-name
8298 !^ header insert to two@to.invalid
8301 !^ header insert cc no-name-allowed
8303 !^ header insert cc one@cc.invalid
8306 !:alias abcc one@bcc.invalid
8307 !^ header insert bcc abcc
8309 !:set expandaddr=+addr
8310 !^ header insert bcc abcc
8311 !:echo $!/$?/$^ERRNAME
8314 ' "${cat}" "${sed}" |
8315 ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! >./.tall 2>&1
8316 check 1 0 "$MBOX" '665881681 179'
8317 have_feat uistrings && i='4159482825 1372' || i='2254509488 1103'
8318 check 2 - ./.tall "${i}"
8319 check 3 - ./.tfcc '3993703854 127'
8320 check 4 - ./.tempty '4294967295 0'
8321 check 5 - ./.tcat '2157992522 256'
8326 t_on_main_loop_tick() {
8329 if have_feat cmd-vexpr; then :; else
8330 t_echoskip '[!CMD_VEXPR]'
8346 set on-main-loop-tick=omlt
8349 echo calling bla;call bla
8352 ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Sescape=! >./.tall 2>&1
8353 check 1 0 ./.tall '3697651500 130'
8358 t_on_program_exit() {
8362 -X 'define x {' -X 'echo jay' -X '}' -X x -Son-program-exit=x \
8364 check 1 0 ./.tall '2820891503 4'
8367 -X 'define x {' -X 'echo jay' -X '}' -X q -Son-program-exit=x \
8369 check 2 0 ./.tall '2820891503 4'
8371 </dev/null ${MAILX} ${ARGS} \
8372 -X 'define x {' -X 'echo jay' -X '}' -Son-program-exit=x \
8374 check 3 0 ./.tall '2820891503 4'
8376 </dev/null ${MAILX} ${ARGS} -Smta=test://"$MBOX" \
8377 -X 'define x {' -X 'echo jay' -X '}' -Son-program-exit=x \
8378 -s subject -. hey@you \
8380 check 4 0 ./.tall '2820891503 4'
8381 check 5 - "$MBOX" '561900352 118'
8387 # Heavy use of/rely on state machine (behaviour) and basics {{{
8388 t_compose_hooks() { # {{{ TODO monster
8391 if have_feat uistrings &&
8392 have_feat cmd-csop && have_feat cmd-vexpr; then :; else
8393 t_echoskip '[!UISTRINGS/!CMD_CSOP/!CMD_VEXPR]'
8398 (echo line one&&echo line two&&echo line three) > ./.treadctl
8399 (echo echo four&&echo echo five&&echo echo six) > ./.tattach
8401 # Supposed to extend t_compose_edits with ~^ stress tests!
8402 ${cat} <<'__EOT__' > ./.trc
8404 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
8407 vput csop es substr "$1" 0 1
8412 define read_mline_res {
8413 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
8414 echo $len/$es/$^ERRNAME: $hl
8415 if [ $es -ne $^ERR-NONE ]
8416 xcall bail read_mline_res
8418 \xcall read_mline_res
8423 echo "~^header list"; read hl; echo $hl;\
8424 call xerr "$hl" "in_addr ($xh) 0-1"
8426 echo "~^header insert $xh 'diet <$xh@exam.ple> spliced'";\
8427 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
8428 echo "~^header insert $xh <${xh}2@exam.ple>";\
8429 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
8430 echo "~^header insert $xh ${xh}3@exam.ple";\
8431 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
8432 echo "~^header list $xh"; read hl; echo $hl;\
8433 call xerr "$hl" "ins_addr $xh 1-4"
8434 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
8437 if [ "$t_remove" == "" ]
8441 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
8442 echo "~^header remove $xh"; read es; vput csop es substr $es 0 3
8444 xcall bail "ins_addr $xh 2-2"
8446 echo "~^header list $xh"; read es; vput csop es substr $es 0 3
8448 xcall bail "ins_addr $xh 2-3"
8450 echo "~^header show $xh"; read es; vput csop es substr $es 0 3
8452 xcall bail "ins_addr $xh 2-4"
8456 echo "~^header insert $xh 'diet <$xh@exam.ple> spliced'";\
8457 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
8458 echo "~^header insert $xh <${xh}2@exam.ple>";\
8459 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
8460 echo "~^header insert $xh ${xh}3@exam.ple";\
8461 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
8462 echo "~^header list $xh"; read hl; echo $hl;\
8463 call xerr "$hl" "ins_addr $xh 3-4"
8464 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
8467 echo "~^header remove-at $xh 1"; read es;\
8468 call xerr $es "ins_addr $xh 3-6"
8469 echo "~^header remove-at $xh 1"; read es;\
8470 call xerr $es "ins_addr $xh 3-7"
8471 echo "~^header remove-at $xh 1"; read es;\
8472 call xerr $es "ins_addr $xh 3-8"
8473 echo "~^header remove-at $xh 1"; read es;\
8474 vput csop es substr $es 0 3
8476 xcall bail "ins_addr $xh 3-9"
8478 echo "~^header remove-at $xh T"; read es;\
8479 vput csop es substr $es 0 3
8481 xcall bail "ins_addr $xh 3-10"
8483 echo "~^header list $xh"; read es;\
8484 vput csop es substr $es 0 3
8486 xcall bail "ins_addr $xh 3-11"
8488 echo "~^header show $xh"; read es;\
8489 vput csop es substr $es 0 3
8491 xcall bail "ins_addr $xh 3-12"
8495 echo "~^header insert $xh 'diet <$xh@exam.ple> spliced'";\
8496 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
8497 echo "~^header insert $xh <${xh}2@exam.ple>\ (comment)\ \\\"Quot(e)d\\\"";\
8498 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
8499 echo "~^header insert $xh ${xh}3@exam.ple";\
8500 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
8501 echo "~^header list $xh"; read hl; echo $hl;\
8502 call xerr "$hl" "header list $xh 3-4"
8503 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
8506 echo "~^header remove-at $xh 3"; read es;\
8507 call xerr $es "ins_addr $xh 4-6"
8508 echo "~^header remove-at $xh 2"; read es;\
8509 call xerr $es "ins_addr $xh 4-7"
8510 echo "~^header remove-at $xh 1"; read es;\
8511 call xerr $es "ins_addr $xh 4-8"
8512 echo "~^header remove-at $xh 1"; read es;\
8513 vput csop es substr $es 0 3
8515 xcall bail "ins_addr $xh 4-9"
8517 echo "~^header remove-at $xh T"; read es;\
8518 vput csop es substr $es 0 3
8520 xcall bail "ins_addr $xh 4-10"
8522 echo "~^header list $xh"; read es;\
8523 vput csop es substr $es 0 3
8525 xcall bail "ins_addr $xh 4-11"
8527 echo "~^header show $xh"; read es;\
8528 vput csop es substr $es 0 3
8530 xcall bail "ins_addr $xh 4-12"
8534 wysh set xh=$1 mult=$2
8535 echo "~^header list"; read hl; echo $hl;\
8536 call xerr "$hl" "ins_ref ($xh) 0-1"
8538 echo "~^header insert $xh <$xh@exam.ple>";\
8539 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
8541 echo "~^header insert $xh <${xh}2@exam.ple>";\
8542 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
8543 echo "~^header insert $xh ${xh}3@exam.ple";\
8544 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
8546 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
8547 vput csop es substr $es 0 3
8549 xcall bail "ins_ref $xh 1-4"
8553 echo "~^header list $xh"; read hl; echo $hl;\
8554 call xerr "$hl" "ins_ref $xh 1-5"
8555 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
8558 if [ "$t_remove" == "" ]
8562 echo "~^header remove $xh"; read es;\
8563 call xerr $es "ins_ref $xh 2-1"
8564 echo "~^header remove $xh"; read es;\
8565 vput csop es substr $es 0 3
8567 xcall bail "ins_ref $xh 2-2"
8569 echo "~^header list $xh"; read es;\
8570 vput csop es substr $es 0 3
8572 xcall bail "$es ins_ref $xh 2-3"
8574 echo "~^header show $xh"; read es;\
8575 vput csop es substr $es 0 3
8577 xcall bail "ins_ref $xh 2-4"
8581 echo "~^header insert $xh <$xh@exam.ple>";\
8582 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
8584 echo "~^header insert $xh <${xh}2@exam.ple>";\
8585 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
8586 echo "~^header insert $xh ${xh}3@exam.ple";\
8587 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
8589 echo "~^header list $xh";\
8590 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
8591 echo "~^header show $xh";\
8592 read es; call xerr $es "ins_ref $xh 3-5"
8595 echo "~^header remove-at $xh 1"; read es;\
8596 call xerr $es "ins_ref $xh 3-6"
8597 if [ $mult -ne 0 ] && [ $xh != subject ]
8598 echo "~^header remove-at $xh 1"; read es;\
8599 call xerr $es "ins_ref $xh 3-7"
8600 echo "~^header remove-at $xh 1"; read es;\
8601 call xerr $es "ins_ref $xh 3-8"
8603 echo "~^header remove-at $xh 1"; read es;\
8604 vput csop es substr $es 0 3
8606 xcall bail "ins_ref $xh 3-9"
8608 echo "~^header remove-at $xh T"; read es;\
8609 vput csop es substr $es 0 3
8611 xcall bail "ins_ref $xh 3-10"
8613 echo "~^header show $xh"; read es;\
8614 vput csop es substr $es 0 3
8616 xcall bail "ins_ref $xh 3-11"
8620 echo "~^header insert $xh <$xh@exam.ple> ";\
8621 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
8623 echo "~^header insert $xh <${xh}2@exam.ple> ";\
8624 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
8625 echo "~^header insert $xh ${xh}3@exam.ple";\
8626 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
8628 echo "~^header list $xh"; read hl; echo $hl;\
8629 call xerr "$hl" "ins_ref $xh 4-4"
8630 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
8633 if [ $mult -ne 0 ] && [ $xh != subject ]
8634 echo "~^header remove-at $xh 3"; read es;\
8635 call xerr $es "ins_ref $xh 4-6"
8636 echo "~^header remove-at $xh 2"; read es;\
8637 call xerr $es "ins_ref $xh 4-7"
8639 echo "~^header remove-at $xh 1"; read es;\
8640 call xerr $es "ins_ref $xh 4-8"
8641 echo "~^header remove-at $xh 1"; read es;\
8642 vput csop es substr $es 0 3
8644 xcall bail "ins_ref $xh 4-9"
8646 echo "~^header remove-at $xh T"; read es;\
8647 vput csop es substr $es 0 3
8649 xcall bail "ins_ref $xh 4-10"
8651 echo "~^header show $xh"; read es;\
8652 vput csop es substr $es 0 3
8654 xcall bail "ins_ref $xh 4-11"
8659 # In collect.c order
8661 call ins_ref sender 0 # Not a "ref", but works
8665 call ins_addr reply-To
8666 call ins_addr mail-Followup-to
8667 call ins_ref messAge-id 0
8668 call ins_ref rEfErEncEs 1
8669 call ins_ref in-Reply-to 1
8670 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
8671 call ins_addr freeForm1
8672 call ins_addr freeform2
8674 echo "~^header show MAILX-Command"; read es; call xerr $es "t_header 1000"
8676 echo "~^header show MAILX-raw-TO"; read es; call xerr $es "t_header 1001"
8684 echo "~^attachment";\
8685 read hl; echo $hl; vput csop es substr "$hl" 0 3
8687 xcall bail "attach 0-1"
8690 echo "~^attach attribute ./.treadctl";\
8691 read hl; echo $hl; vput csop es substr "$hl" 0 3
8693 xcall bail "attach 0-2"
8695 echo "~^attachment attribute-at 1";\
8696 read hl; echo $hl; vput csop es substr "$hl" 0 3
8698 xcall bail "attach 0-3"
8701 echo "~^attachment insert ./.treadctl=ascii";\
8702 read hl; echo $hl; call xerr "$hl" "attach 1-1"
8703 echo "~^attachment list";\
8704 read es; echo $es;call xerr "$es" "attach 1-2"
8706 echo "~^attachment attribute ./.treadctl";\
8707 read es; echo $es;call xerr "$es" "attach 1-3"
8709 echo "~^attachment attribute .treadctl";\
8710 read es; echo $es;call xerr "$es" "attach 1-4"
8712 echo "~^attachment attribute-at 1";\
8713 read es; echo $es;call xerr "$es" "attach 1-5"
8716 echo "~^attachment attribute-set ./.treadctl filename rctl";\
8717 read es; echo $es;call xerr "$es" "attach 1-6"
8718 echo "~^attachment attribute-set .treadctl content-description Au";\
8719 read es; echo $es;call xerr "$es" "attach 1-7"
8720 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
8721 read es; echo $es;call xerr "$es" "attach 1-8"
8723 echo "~^attachment attribute ./.treadctl";\
8724 read es; echo $es;call xerr "$es" "attach 1-9"
8726 echo "~^attachment attribute .treadctl";\
8727 read es; echo $es;call xerr "$es" "attach 1-10"
8729 echo "~^attachment attribute rctl";\
8730 read es; echo $es;call xerr "$es" "attach 1-11"
8732 echo "~^attachment attribute-at 1";\
8733 read es; echo $es;call xerr "$es" "attach 1-12"
8737 echo "~^attachment insert ./.tattach=latin1";\
8738 read hl; echo $hl; call xerr "$hl" "attach 2-1"
8739 echo "~^attachment list";\
8740 read es; echo $es;call xerr "$es" "attach 2-2"
8742 echo "~^attachment attribute ./.tattach";\
8743 read es; echo $es;call xerr "$es" "attach 2-3"
8745 echo "~^attachment attribute .tattach";\
8746 read es; echo $es;call xerr "$es" "attach 2-4"
8748 echo "~^attachment attribute-at 2";\
8749 read es; echo $es;call xerr "$es" "attach 2-5"
8752 echo "~^attachment attribute-set ./.tattach filename tat";\
8753 read es; echo $es;call xerr "$es" "attach 2-6"
8755 "~^attachment attribute-set .tattach content-description Au2";\
8756 read es; echo $es;call xerr "$es" "attach 2-7"
8757 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
8758 read es; echo $es;call xerr "$es" "attach 2-8"
8760 "~^attachment attribute-set-at 2 content-type application/x-sh";\
8761 read es; echo $es;call xerr "$es" "attach 2-9"
8763 echo "~^attachment attribute ./.tattach";\
8764 read es; echo $es;call xerr "$es" "attach 2-10"
8766 echo "~^attachment attribute .tattach";\
8767 read es; echo $es;call xerr "$es" "attach 2-11"
8769 echo "~^attachment attribute tat";\
8770 read es; echo $es;call xerr "$es" "attach 2-12"
8772 echo "~^attachment attribute-at 2";\
8773 read es; echo $es;call xerr "$es" "attach 2-13"
8777 if [ "$t_remove" == "" ]
8781 echo "~^attachment remove ./.treadctl"; read es;\
8782 call xerr $es "attach 3-1"
8783 echo "~^attachment remove ./.tattach"; read es;\
8784 call xerr $es "attach 3-2"
8785 echo "~^ attachment remove ./.treadctl"; read es;\
8786 vput csop es substr $es 0 3
8788 xcall bail "attach 3-3"
8790 echo "~^ attachment remove ./.tattach"; read es;\
8791 vput csop es substr $es 0 3
8793 xcall bail "attach 3-4"
8795 echo "~^attachment list"; read es;\
8796 vput csop es substr $es 0 3
8798 xcall bail "attach 3-5"
8802 echo "~^attachment insert ./.tattach=latin1";\
8803 read hl; echo $hl; call xerr "$hl" "attach 4-1"
8804 echo "~^attachment insert ./.tattach=latin1";\
8805 read hl; echo $hl; call xerr "$hl" "attach 4-2"
8806 echo "~^attachment list";\
8807 read es; echo $es;call xerr "$es" "attach 4-3"
8809 echo "~^ attachment remove .tattach"; read es;\
8810 vput csop es substr $es 0 3
8812 xcall bail "attach 4-4 $es"
8814 echo "~^attachment remove-at T"; read es;\
8815 vput csop es substr $es 0 3
8817 xcall bail "attach 4-5"
8819 echo "~^attachment remove ./.tattach"; read es;\
8820 call xerr $es "attach 4-6"
8821 echo "~^attachment remove ./.tattach"; read es;\
8822 call xerr $es "attach 4-7"
8823 echo "~^ attachment remove ./.tattach"; read es;\
8824 vput csop es substr $es 0 3
8826 xcall bail "attach 4-8 $es"
8828 echo "~^attachment list"; read es;\
8829 vput csop es substr $es 0 3
8831 xcall bail "attach 4-9"
8835 echo "~^attachment insert ./.tattach=latin1";\
8836 read hl; echo $hl; call xerr "$hl" "attach 5-1"
8837 echo "~^attachment insert ./.tattach=latin1";\
8838 read hl; echo $hl; call xerr "$hl" "attach 5-2"
8839 echo "~^attachment insert ./.tattach=latin1";\
8840 read hl; echo $hl; call xerr "$hl" "attach 5-3"
8841 echo "~^attachment list";\
8842 read es; echo $es;call xerr "$es" "attach 5-4"
8845 echo "~^attachment remove-at 3"; read es;\
8846 call xerr $es "attach 5-5"
8847 echo "~^attachment remove-at 3"; read es;\
8848 vput csop es substr $es 0 3
8850 xcall bail "attach 5-6"
8852 echo "~^attachment remove-at 2"; read es;\
8853 call xerr $es "attach 5-7"
8854 echo "~^attachment remove-at 2"; read es;\
8855 vput csop es substr $es 0 3
8857 xcall bail "attach 5-8"
8859 echo "~^attachment remove-at 1"; read es;\
8860 call xerr $es "attach 5-9"
8861 echo "~^attachment remove-at 1"; read es;\
8862 vput csop es substr $es 0 3
8864 xcall bail "attach 5-10"
8867 echo "~^attachment list"; read es;\
8868 vput csop es substr $es 0 3
8870 xcall bail "attach 5-11"
8874 echo "~^attachment insert ./.tattach=latin1";\
8875 read hl; echo $hl; call xerr "$hl" "attach 6-1"
8876 echo "~^attachment insert ./.tattach=latin1";\
8877 read hl; echo $hl; call xerr "$hl" "attach 6-2"
8878 echo "~^attachment insert ./.tattach=latin1";\
8879 read hl; echo $hl; call xerr "$hl" "attach 6-3"
8880 echo "~^attachment list";\
8881 read es; echo $es;call xerr "$es" "attach 6-4"
8884 echo "~^attachment remove-at 1"; read es;\
8885 call xerr $es "attach 6-5"
8886 echo "~^attachment remove-at 1"; read es;\
8887 call xerr $es "attach 6-6"
8888 echo "~^attachment remove-at 1"; read es;\
8889 call xerr $es "attach 6-7"
8890 echo "~^attachment remove-at 1"; read es;\
8891 vput csop es substr $es 0 3
8893 xcall bail "attach 6-8"
8896 echo "~^attachment list"; read es;\
8897 vput csop es substr $es 0 3
8899 xcall bail "attach 6-9"
8911 echo on-compose-enter, mailx-command<$mailx-command>
8912 alternates alter1@exam.ple alter2@exam.ple
8914 set autocc='alter1@exam.ple alter2@exam.ple'
8915 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
8916 echo mailx-subject<$mailx-subject>
8917 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
8918 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
8919 mailx-raw-bcc<$mailx-raw-bcc>
8920 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
8921 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
8922 digmsg create - -;echo $?/$!/$^ERRNAME;\
8923 digmsg - header list;\
8924 digmsg remove -;echo $?/$!/$^ERRNAME
8925 digmsg create -;echo $?/$!/$^ERRNAME;\
8926 digmsg - header list;readall x;echon $x;\
8927 digmsg remove -;echo $?/$!/$^ERRNAME
8930 echo on-compose-leave, mailx-command<$mailx-command>
8932 eval alternates $al alter3@exam.ple alter4@exam.ple
8934 set autobcc='alter3@exam.ple alter4@exam.ple'
8935 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
8936 echo mailx-subject<$mailx-subject>
8937 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
8938 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
8939 mailx-raw-bcc<$mailx-raw-bcc>
8940 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
8941 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
8942 digmsg create - -;echo $?/$!/$^ERRNAME;\
8943 digmsg - header list;\
8944 digmsg remove -;echo $?/$!/$^ERRNAME
8945 digmsg create -;echo $?/$!/$^ERRNAME;\
8946 digmsg - header list;readall x;echon $x;\
8947 digmsg remove -;echo $?/$!/$^ERRNAME
8950 echo on-compose-cleanup, mailx-command<$mailx-command>
8953 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
8954 echo mailx-subject<$mailx-subject>
8955 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
8956 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
8957 mailx-raw-bcc<$mailx-raw-bcc>
8958 echo mailx-orig-from<$mailx-orig-from> mailx-orig-to<$mailx-orig-to> \
8959 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
8960 # XXX error message variable digmsg create - -;echo $?/$!/$^ERRNAME;\
8961 digmsg - header list;\
8962 digmsg remove -;echo $?/$!/$^ERRNAME
8963 # ditto digmsg create -;echo $?/$!/$^ERRNAME;\
8964 digmsg - header list;readall x;echon $x;\
8965 digmsg remove -;echo $?/$!/$^ERRNAME
8967 wysh set on-compose-splice=t_ocs \
8968 on-compose-enter=t_oce on-compose-leave=t_ocl \
8969 on-compose-cleanup=t_occ
8972 printf 'm this-goes@nowhere\nbody\n!.\n' |
8973 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
8974 -X'source ./.trc' -Smta=test://"$MBOX" \
8976 ${cat} ./.tall >> "${MBOX}"
8977 check 1 0 "${MBOX}" '1646284089 10565'
8980 printf 'm this-goes@nowhere\nbody\n!.\n' |
8981 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
8982 -St_remove=1 -X'source ./.trc' -Smta=test://"$MBOX" \
8984 ${cat} ./.tall >> "${MBOX}"
8985 check 2 0 "${MBOX}" '700681006 12851'
8989 # Some state machine stress, shell compose hook, localopts for hook, etc.
8990 # readctl in child. ~r as HERE document
8992 printf 'm ex@am.ple\nbody\n!.
8993 echon ${mailx-command}${mailx-subject}
8994 echon ${mailx-from}${mailx-sender}
8995 echon ${mailx-to}${mailx-cc}${mailx-bcc}
8996 echon ${mailx-raw-to}${mailx-raw-cc}${mailx-raw-bcc}
8997 echon ${mailx-orig-from}${mailx-orig-to}${mailx-orig-gcc}${mailx-orig-bcc}
8998 var t_oce t_ocs t_ocs_sh t_ocl t_occ autocc
8999 ' | ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
9000 -Smta=test://"$MBOX" \
9003 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
9006 vput csop es substr "$1" 0 1
9011 define read_mline_res {
9012 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
9013 echo $len/$es/$^ERRNAME: $hl
9014 if [ $es -ne $^ERR-NONE ]
9015 xcall bail read_mline_res
9017 \xcall read_mline_res
9021 vput vexpr i + 1 "$2"
9023 vput vexpr j % $i 10
9030 eval \\$j _work $1 $i
9033 vput vexpr i + $i "$1"
9037 wysh set line; read line;wysh set es=$? en=$^ERRNAME ;\
9038 echo read:$es/$en: $line
9039 if [ "${es}" -ne -1 ]
9042 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
9047 echo "~^header list"; read hl; echo $hl;\
9048 vput csop es substr "$hl" 0 1
9050 xcall bail "header list"
9053 call _work 1; echo $?
9054 echo "~^header insert cc splicy\ diet\ <splice@exam.ple>\ spliced";\
9055 read es; echo $es; vput csop es substr "$es" 0 1
9057 xcall bail "be diet"
9059 echo "~^header insert cc <splice2@exam.ple>";\
9060 read es; echo $es; vput csop es substr "$es" 0 1
9062 xcall bail "be diet2"
9065 call _work 2; echo $?
9066 echo "~^header insert bcc juicy\ juice\ <juice@exam.ple>\ spliced";\
9067 read es; echo $es;vput csop es substr "$es" 0 1
9069 xcall bail "be juicy"
9071 echo "~^header insert bcc juice2@exam.ple";\
9072 read es; echo $es;vput csop es substr "$es" 0 1
9074 xcall bail "be juicy2"
9076 echo "~^header insert bcc juice3\ <juice3@exam.ple>";\
9077 read es; echo $es;vput csop es substr "$es" 0 1
9079 xcall bail "be juicy3"
9081 echo "~^header insert bcc juice4@exam.ple";\
9082 read es; echo $es;vput csop es substr "$es" 0 1
9084 xcall bail "be juicy4"
9087 echo "~^header remove-at bcc 3";\
9088 read es; echo $es;vput csop es substr "$es" 0 1
9090 xcall bail "remove juicy5"
9092 echo "~^header remove-at bcc 2";\
9093 read es; echo $es;vput csop es substr "$es" 0 1
9095 xcall bail "remove juicy6"
9097 echo "~^header remove-at bcc 3";\
9098 read es; echo $es;vput csop es substr "$es" 0 3
9100 xcall bail "failed to remove-at"
9102 # Add duplicates which ought to be removed!
9103 echo "~^header insert bcc juice4@exam.ple";\
9104 read es; echo $es;vput csop es substr "$es" 0 1
9106 xcall bail "be juicy4-1"
9108 echo "~^header insert bcc juice4@exam.ple";\
9109 read es; echo $es;vput csop es substr "$es" 0 1
9111 xcall bail "be juicy4-2"
9113 echo "~^header insert bcc juice4@exam.ple";\
9114 read es; echo $es;vput csop es substr "$es" 0 1
9116 xcall bail "be juicy4-3"
9121 call _work 3; echo $?
9123 vput ! i echo just knock if you can hear me;\
9125 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
9127 echon shell-cmd says $?/$^ERRNAME: $i
9128 echo "~x will not become interpreted, we are reading until __EOT"
9130 read r_status; echo "~~r status output: $r_status"
9131 echo "~:echo $? $! $^ERRNAME"
9133 echo "~~r status from parent: $r_status"
9136 call _work 4; echo $?
9137 vput cwd cwd;echo cwd:$?
9138 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME;\
9142 call _work 5; echo $?
9143 echo "~^header show MAILX-Command"; read es;\
9144 call xerr $es "t_header 1000"; call read_mline_res
9145 echo "~^header show MAILX-raw-TO"; read es;\
9146 call xerr $es "t_header 1001"; xcall read_mline_res
9148 echoerr IT IS WRONG IF YOU SEE THIS
9151 echo on-compose-enter, mailx-command<$mailx-command>
9152 set t_oce autobcc=oce@exam.ple
9153 alternates alter1@exam.ple alter2@exam.ple
9155 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9156 echo mailx-subject<$mailx-subject>
9157 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9158 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9159 mailx-raw-bcc<$mailx-raw-bcc>
9160 echo mailx-orig-from<$mailx-orig-from> \
9161 mailx-orig-to<$mailx-orig-to> \
9162 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9165 echo on-compose-leave, mailx-command<$mailx-command>
9166 set t_ocl autocc=ocl@exam.ple
9168 alternates alter3@exam.ple alter4@exam.ple
9170 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9171 echo mailx-subject<$mailx-subject>
9172 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9173 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9174 mailx-raw-bcc<$mailx-raw-bcc>
9175 echo mailx-orig-from<$mailx-orig-from> \
9176 mailx-orig-to<$mailx-orig-to> \
9177 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9180 echo on-compose-cleanup, mailx-command<$mailx-command>
9181 set t_occ autocc=occ@exam.ple
9184 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9185 echo mailx-subject<$mailx-subject>
9186 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9187 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9188 mailx-raw-bcc<$mailx-raw-bcc>
9189 echo mailx-orig-from<$mailx-orig-from> \
9190 mailx-orig-to<$mailx-orig-to> \
9191 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9193 wysh set on-compose-splice=t_ocs \
9194 on-compose-splice-shell="read ver;echo t_ocs-shell;\
9195 echo \"~t shell@exam.ple\"; echo \"~:set t_ocs_sh\"" \
9196 on-compose-enter=t_oce on-compose-leave=t_ocl \
9197 on-compose-cleanup=t_occ
9200 ${cat} ./.tnotes >> "${MBOX}"
9201 check 3 - "${MBOX}" '3986011319 2437'
9203 # Reply, forward, resend, Resend
9211 set from="du <f2@z>" stealthmua=noagent
9215 ' | ${MAILX} ${ARGS} -Smta=test://"$MBOX" -Snomemdebug -Sescape=! \
9217 check_ex0 4-intro-estat
9220 echo start: $? $! $^ERRNAME
9222 echo File: $? $! $^ERRNAME;echo;echo
9224 this is content of reply 1
9226 echo reply 1: $? $! $^ERRNAME;echo;echo
9228 this is content of Reply 1 2
9230 echo Reply 1 2: $? $! $^ERRNAME;echo;echo
9231 forward 1 fwdex@am.ple
9232 this is content of forward 1
9234 echo forward 1: $? $! $^ERRNAME;echo;echo
9235 wysh set forward-inject-head=$'"'"'-- \\
9236 forward (%%a)(%%d)(%%f)(%%i)(%%n)(%%r) --\\n'"'"'
9237 wysh set forward-inject-tail=$'"'"'-- \\
9238 end of forward (%%i) --\\n'"'"'
9239 forward 2 fwdex@am.ple
9240 this is content of forward 2
9242 echo forward 2: $? $! $^ERRNAME;echo;echo
9244 forward 2 fwdex2@am.ple
9245 this is content of forward 2, 2nd, with showname set
9247 echo forward 2, 2nd: $? $! $^ERRNAME;echo;echo
9248 resend 1 2 resendex@am.ple
9249 echo resend 1 2: $? $! $^ERRNAME;echo;echo
9250 Resend 1 2 Resendex@am.ple
9251 echo Resend 1 2: $? $! $^ERRNAME;echo;echo
9253 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sfullnames \
9254 -Smta=test://"$MBOX" \
9257 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
9260 vput csop es substr "$1" 0 1
9265 define read_mline_res {
9266 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
9267 echo mline_res:$len/$es/$^ERRNAME: $hl
9268 if [ $es -ne $^ERR-NONE ]
9269 xcall bail read_mline_res
9271 \xcall read_mline_res
9275 echo "~^header show $1"; read es;\
9276 call xerr $es "work_hl $1"; echo $1; call read_mline_res
9284 echo t_ocs version $ver
9285 echo "~^header list"; read hl; echo $hl;\
9286 echoerr the header list is $hl;\
9287 call xerr "$hl" "header list"
9288 eval vpospar set $hl
9291 echoerr IT IS WRONG IF YOU SEE THIS
9294 echo on-XY-enter, mailx-command<$mailx-command>
9295 set t_oce autobcc=oce@exam.ple
9296 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9297 echo mailx-subject<$mailx-subject>
9298 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9299 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9300 mailx-raw-bcc<$mailx-raw-bcc>
9301 echo mailx-orig-from<$mailx-orig-from> \
9302 mailx-orig-to<$mailx-orig-to> \
9303 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9306 echo on-XY-leave, mailx-command<$mailx-command>
9307 set t_ocl autocc=ocl@exam.ple
9308 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9309 echo mailx-subject<$mailx-subject>
9310 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9311 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9312 mailx-raw-bcc<$mailx-raw-bcc>
9313 echo mailx-orig-from<$mailx-orig-from> \
9314 mailx-orig-to<$mailx-orig-to> \
9315 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9318 echo on-XY-cleanup, mailx-command<$mailx-command>
9319 set t_occ autocc=occ@exam.ple
9320 echo mailx-from<$mailx-from> mailx-sender<$mailx-sender>
9321 echo mailx-subject<$mailx-subject>
9322 echo mailx-to<$mailx-to> mailx-cc<$mailx-cc> mailx-bcc<$mailx-bcc>
9323 echo mailx-raw-to<$mailx-raw-to> mailx-raw-cc<$mailx-raw-cc> \
9324 mailx-raw-bcc<$mailx-raw-bcc>
9325 echo mailx-orig-from<$mailx-orig-from> \
9326 mailx-orig-to<$mailx-orig-to> \
9327 mailx-orig-cc<$mailx-orig-cc> mailx-orig-bcc<$mailx-orig-bcc>
9329 wysh set on-compose-splice=t_ocs \
9330 on-compose-enter=t_oce on-compose-leave=t_ocl \
9331 on-compose-cleanup=t_occ \
9332 on-resend-enter=t_oce on-resend-cleanup=t_occ
9335 ${cat} ./.tnotes >> "${MBOX}"
9336 check 4 - "${MBOX}" '1850092468 11799'
9341 t_mass_recipients() {
9344 if have_feat cmd-vexpr; then :; else
9345 t_echoskip '[!CMD_VEXPR]'
9350 ${cat} <<'__EOT__' > ./.trc
9352 echoerr "Failed: $1. Bailing out"; echo "~x"; xit
9355 wysh set nr=$1 hn=$2
9356 echo "~$hn $hn$nr@$hn"; echo '~:echo $?'; read es
9358 xcall bail "ins_addr $hn 1-$nr"
9360 vput vexpr nr + $nr 1
9361 if [ "$nr" -le "$maximum" ]
9362 xcall ins_addr $nr $hn
9366 wysh set nr=$1 hn=$2
9367 alternates $hn$nr@$hn
9368 vput vexpr nr + $nr 2
9369 if [ "$nr" -le "$maximum" ]
9370 xcall bld_alter $nr $hn
9380 if [ "$t_remove" != '' ]
9385 set on-compose-splice=t_ocs on-compose-leave=t_ocl
9388 printf 'm this-goes@nowhere\nbody\n!.\n' |
9389 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
9390 -X'source ./.trc' -Smta=test://"$MBOX" -Smaximum=${LOOPS_MAX} \
9393 ${cat} ./.tall >> "${MBOX}"
9394 if [ ${LOOPS_MAX} -eq ${LOOPS_BIG} ]; then
9395 check 1-${LOOPS_BIG} - "${MBOX}" '3835365533 51534'
9396 elif [ ${LOOPS_MAX} -eq ${LOOPS_SMALL} ]; then
9397 check 1-${LOOPS_SMALL} - "${MBOX}" '3647549277 4686'
9401 printf 'm this-goes@nowhere\nbody\n!.\n' |
9402 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
9403 -St_remove=1 -X'source ./.trc' -Smta=test://"$MBOX" \
9404 -Smaximum=${LOOPS_MAX} \
9407 ${cat} ./.tall >> "${MBOX}"
9408 if [ ${LOOPS_MAX} -eq ${LOOPS_BIG} ]; then
9409 check 2-${LOOPS_BIG} - "${MBOX}" '3768249992 34402'
9410 elif [ $LOOPS_MAX -eq ${LOOPS_SMALL} ]; then
9411 check 2-${LOOPS_SMALL} - "${MBOX}" '4042568441 3170'
9417 t_lreply_futh_rth_etc() {
9420 ${cat} <<-_EOT > ./.tmbox
9421 From neverneverland Sun Jul 23 13:46:25 2017
9422 Subject: Bugstop: five miles out 1
9423 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
9424 From: mister originator <mr@originator>
9425 To: bugstop-commit@five.miles.out, laber@backe.eu
9427 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
9428 In-reply-to: <20170719111113.bkcMz%laber@backe.eu>
9429 Date: Wed, 19 Jul 2017 09:22:57 -0400
9430 Message-Id: <20170719132257.766AF781267@originator>
9433 > |Sorry, I think I misunderstand something. I would think that
9437 From neverneverland Fri Jul 7 22:39:11 2017
9438 Subject: Bugstop: five miles out 2
9439 Reply-To: mister originator2<mr2@originator>,bugstop@five.miles.out,is@a.list
9440 Content-Transfer-Encoding: 7bit
9441 From: mister originator <mr@originator>
9442 To: bugstop-commit@five.miles.out
9444 Message-ID: <149945963975.28888.6950788126957753723.reportbug@five.miles.out>
9445 Date: Fri, 07 Jul 2017 16:33:59 -0400
9448 capable of changing back.
9450 From neverneverland Fri Jul 7 22:42:00 2017
9451 Subject: Bugstop: five miles out 3
9452 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
9453 Content-Transfer-Encoding: 7bit
9454 From: mister originator <mr@originator>
9455 To: bugstop-commit@five.miles.out
9457 Message-ID: <149945963975.28888.6950788126957753746.reportbug@five.miles.out>
9458 Date: Fri, 07 Jul 2017 16:33:59 -0400
9459 List-Post: <mailto:bugstop@five.miles.out>
9462 are you ready, boots?
9464 From neverneverland Sat Aug 19 23:15:00 2017
9465 Subject: Bugstop: five miles out 4
9466 Reply-To: mister originator2 <mr2@originator>, bugstop@five.miles.out
9467 Content-Transfer-Encoding: 7bit
9468 From: mister originator <mr@originator>
9469 To: bugstop@five.miles.out
9471 Message-ID: <149945963975.28888.6950788126qtewrqwer.reportbug@five.miles.out>
9472 Date: Fri, 07 Jul 2017 16:33:59 -0400
9473 List-Post: <mailto:bugstop@five.miles.out>
9476 are you ready, boots?
9481 ${cat} <<-'_EOT' | ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" \
9482 -Rf ./.tmbox >> "${MBOX}" 2>&1
9484 wysh set m="This is text of \"reply ${1}."
9495 echo -----After reply $1.1 - $1.3: $?/$^ERRNAME
9498 wysh set m="This is text of \"Reply ${1}."
9504 echo -----After Reply $1.$2: $?/$^ERRNAME
9513 wysh set m="This is text of \"Lreply ${1}." on-compose-splice=_Lh n=$2
9517 # We need two indirections for this test: one for the case that Lreply
9518 # fails because of missing recipients: we need to read EOF next, thus
9519 # place this in _Ls last; and second for the succeeding cases EOF is
9520 # not what these should read, so go over the backside and splice it in!
9521 # (A shame we do not have redirection++ as a Bourne/K/POSIX shell!)
9523 echo -----After Lreply $1.$2: $?/$^ERRNAME
9526 localopts call-fixate yes
9528 call R $1 1; call R $1 2; call R $1 3; call R $1 4
9529 call L $1 1; call L $1 2; call L $1 3
9532 echo;echo '===== CHANGING === '"$*"' =====';echo
9536 set from=laber@backe.eu
9539 call tweak set reply-to-honour
9541 call tweak set followup-to
9543 call tweak set followup-to-honour
9545 call tweak mlist bugstop@five.miles.out
9547 call tweak mlsubscribe bugstop@five.miles.out
9549 call tweak set recipients-in-cc
9551 # While here, test that *fullnames* works (also here)
9552 call tweak set fullnames
9554 This message should have *fullnames* in the header.
9557 call tweak unmlsubscribe bugstop@five.miles.out';' \
9558 set followup-to-add-cc nofullnames
9560 call tweak mlsubscribe bugstop@five.miles.out
9565 if have_feat uistrings; then
9566 check 1 - "${MBOX}" '1519985418 39828'
9568 t_echoskip '1:[!UISTRINGS]'
9573 ${cat} <<-_EOT > ./.tmbox
9574 From tom@i-i.example Thu Oct 26 03:15:55 2017
9575 Date: Wed, 25 Oct 2017 21:15:46 -0400
9576 From: tom <tom@i-i.example>
9577 To: Steffen Nurpmeso <steffen@sdaoden.eu>
9578 Cc: tom <tom@i-i.example>
9579 Subject: Re: xxxx yyyyyyyy configure does not really like a missing zzzzz
9580 Message-ID: <20171026011546.GA11643@i-i.example>
9581 Reply-To: tom@i-i.example
9582 References: <20171025214601.T2pNd%steffen@sdaoden.eu>
9583 In-Reply-To: <20171025214601.T2pNd%steffen@sdaoden.eu>
9586 The report's useful :-)
9589 # Let us test In-Reply-To: removal starts a new thread..
9590 # This needs adjustment of *stealthmua*
9591 argadd='-Sstealthmua=noagent -Shostname'
9594 printf 'reply 1\nthread\n!.\n' |
9595 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9596 ${argadd} -Rf ./.tmbox > .tall 2>&1
9597 check 2 0 "${MBOX}" '841868335 433'
9598 check 3 - .tall '4294967295 0'
9600 printf 'reply 1\nnew <- thread!\n!||%s -e "%s"\n!.\n' \
9601 "${sed}" '/^In-Reply-To:/d' |
9602 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9603 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9604 check 4 0 "${MBOX}" '3136957908 771'
9605 check 5 - .tall '4294967295 0'
9607 printf 'reply 2\nold <- new <- thread!\n!.\n' |
9608 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9609 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9610 check 6 0 "${MBOX}" '3036449053 1231'
9611 check 7 - .tall '4294967295 0'
9613 printf 'reply 3\nnew <- old <- new <- thread!\n!|| %s -e "%s"\n!.\n' \
9614 "${sed}" '/^In-Reply-To:/d' |
9615 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9616 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9617 check 8 0 "${MBOX}" '2069841383 1583'
9618 check 9 - .tall '4294967295 0'
9620 # And follow-up testing whether changing In-Reply-To: to - starts a new
9621 # thread with only the message being replied-to.
9623 printf 'reply 1\nthread with only one ref!\n!||%s -e "%s"\n!.\n' \
9624 "${sed}" 's/^In-Reply-To:.*$/In-Reply-To:-/' |
9625 ${MAILX} ${ARGS} -Sescape=! -Smta=test://"$MBOX" -Sreply-to-honour \
9626 ${argadd} -Rf "${MBOX}" > .tall 2>&1
9627 check 10 0 "${MBOX}" '3155846378 2047'
9628 check 11 - .tall '4294967295 0'
9636 if have_feat cmd-vexpr; then :; else
9637 t_echoskip '[!CMD_VEXPR]'
9642 # "Test for" [d6f316a] (Gavin Troy)
9643 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
9644 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="?* ${cat}" > "${BODY}"
9645 check 1 0 "${MBOX}" '3942990636 118'
9646 check 2 - "${BODY}" '3951695530 170'
9649 printf "m %s\n~s subject2\n~@%s\nBody2\n~.\nFi %s\nmimeview\nx\n" \
9650 "${MBOX}" "${TOPDIR}snailmail.jpg" "${MBOX}" |
9651 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9652 -S 'pipe-text/plain=?' \
9653 -S 'pipe-image/jpeg=?=&?'\
9654 'trap \"'"${rm}"' -f '\ '\\"${MAILX_FILENAME_TEMPORARY}\\"\" EXIT;'\
9655 'trap \"trap \\\"\\\" INT QUIT TERM; exit 1\" INT QUIT TERM;'\
9656 '{ echo C=$MAILX_CONTENT;'\
9657 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9658 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9659 'echo F=$MAILX_FILENAME;'\
9660 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9661 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9662 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9663 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"; } > ./.tax 2>&1;'"${mv}"' ./.tax ./.tay' \
9665 check 3 0 "${MBOX}" '1933681911 13435'
9666 check 4 - "${BODY}" '2036666633 493'
9667 check 4-hdl - ./.tay '144517347 151' async
9670 if [ -z "${ln}" ]; then
9671 t_echoskip '5:[ln(1) not found]'
9673 # Let us fill in tmpfile, test auto-deletion
9674 printf 'Fi %s\nmimeview\nvput vexpr v file-stat .t.one-link\n'\
9675 'eval wysh set $v;echo should be $st_nlink link\nx\n' "${MBOX}" |
9676 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9677 -S 'pipe-text/plain=?' \
9678 -S 'pipe-image/jpeg=?=++?'\
9679 'echo C=$MAILX_CONTENT;'\
9680 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9681 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9682 'echo F=$MAILX_FILENAME;'\
9683 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9684 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9685 "${ln}"' -f $MAILX_FILENAME_TEMPORARY .t.one-link;'\
9686 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9687 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"' \
9689 check 5 0 "${BODY}" '4260004050 661'
9691 # Fill in ourselfs, test auto-deletion
9692 printf 'Fi %s\nmimeview\nvput vexpr v file-stat .t.one-link\n'\
9693 'eval wysh set $v;echo should be $st_nlink link\nx\n' "${MBOX}" |
9694 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9695 -S 'pipe-text/plain=?' \
9696 -S 'pipe-image/jpeg=?++?'\
9697 "${cat}"' > $MAILX_FILENAME_TEMPORARY;'\
9698 'echo C=$MAILX_CONTENT;'\
9699 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9700 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9701 'echo F=$MAILX_FILENAME;'\
9702 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9703 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9704 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9705 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"' \
9707 check 6 0 "${BODY}" '4260004050 661'
9709 # And the same, via copiousoutput (fake)
9710 printf 'Fi %s\np\nvput vexpr v file-stat .t.one-link\n'\
9711 'eval wysh set $v;echo should be $st_nlink link\nx\n' "${MBOX}" |
9712 ${MAILX} ${ARGS} ${ADDARG_UNI} \
9713 -S 'pipe-text/plain=?' \
9714 -S 'pipe-image/jpeg=?*++?'\
9715 "${cat}"' > $MAILX_FILENAME_TEMPORARY;'\
9716 'echo C=$MAILX_CONTENT;'\
9717 'echo C-E=$MAILX_CONTENT_EVIDENCE;'\
9718 'echo E-B-U=$MAILX_EXTERNAL_BODY_URL;'\
9719 'echo F=$MAILX_FILENAME;'\
9720 'echo F-G=not testable MAILX_FILENAME_GENERATED;'\
9721 'echo F-T=not testable MAILX_FILENAME_TEMPORARY;'\
9722 "${ln}"' -f $MAILX_FILENAME_TEMPORARY .t.one-link;'\
9723 ''"${cksum}"' < \"${MAILX_FILENAME_TEMPORARY}\" |'\
9724 ''"${sed}"' -e "s/[ ]\{1,\}/ /g"' \
9726 check 7 0 "${BODY}" '709946464 677'
9735 if have_feat mailcap; then :; else
9736 t_echoskip '[!MAILCAP]'
9741 ${cat} <<-'_EOT' > ./.tmailcap
9742 text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
9743 application/pdf; /Applications/Preview.app/Contents/MacOS/Preview %s;\
9744 nametemplate=%s.pdf;\
9745 test = [ "${OSTYPE}" = darwin ]
9748 trap "rm -f ${infile}" EXIT\;\
9749 trap "exit 75" INT QUIT TERM\;\
9751 test = [ -n "${DISPLAY}" ];\
9752 nametemplate = %s.pdf; x-mailx-async
9753 application/pdf; pdftotext -layout %s -; nametemplate=%s.pdf; copiousoutput
9754 application/*; echo "This is \\"%t\\" but \
9755 is 50 \% Greek to me" \; < %s head -c 1024 | cat -vet; \
9756 description=" this is\;a \"wildcard\" match, no trailing quote! ;\
9757 copiousoutput; x-mailx-noquote
9762 application/postscript; ps-to-terminal %s;\ needsterminal
9763 application/postscript; ps-to-terminal %s; \compose=idraw %s
9764 x-be2; the-cmd %s; \
9765 print=print-cmd %s ; \
9767 compose=compose-cmd -d %s ; \
9769 composetyped = composetyped-cmd -dd %s ; \
9771 edit=edit-cmd -ddd %s; \
9772 description = a\;desc;\
9773 nametemplate=%s.be2;\
9774 test = this is "a" test ; \
9775 x-mailx-test-once ;\
9776 x11-bitmap = x11-bitmap.bpm;;;;;
9777 application/*; echo "is \"%t\" \
9778 50 \% Greek" \; cat %s; copiousoutput; \; description="catch-all buddy";
9779 audio/*; showaudio;compose=%n
9780 image/jpeg; showpicture -viewer xv %s
9781 image/*; showpicture %s
9782 message/partial; showpartial %s %{id} %{number} %{total}
9783 application/postscript ; lpr %s ; label="PS File";\
9784 compose="getx PS %s"
9785 application/atomicmail; atomicmail %s ; needsterminal
9786 application/andrew-inset; ezview %s ; copiousoutput;\
9787 edit=ez -d %s; compose="ez -d %s"; label="Andrew i/d"
9788 text/richtext; xy iso-8859-1 -e richtext -p %s; \
9789 test=test "`echo %{charset
} |
tr A-Z a-z
`" = iso-8859-1; copiousoutput
9790 text/plain; xy iso-8859-1 %s;\
9791 test=test "`echo %{charset
} |
tr A-Z a-z
`" = iso-8859-1; copiousoutput
9792 text/richtext; rich %s %{not-closed; copiousoutput
9793 default; cat %s; copiousoutput
9795 ${chmod} 0644 ./.tmailcap
9797 printf 'm;echo =1/$?;m c;echo =2/$?;
9798 mailca loa;echo =3/$?;mailc s;echo =4/$?' |
9799 MAILCAPS=./.tmailcap ${MAILX} -X'commandalias m mailcap' ${ARGS} \
9801 check 1 0 ./.tall '2012114724 3064'
9802 have_feat uistrings && i='3903313993 2338' || i='4294967295 0'
9803 check 2 - ./.terr "${i}"
9807 echo 'From me with love' | ${MAILX} ${ARGS} -s sub1 "${MBOX}"
9808 check 3 0 "${MBOX}" '4224630386 228'
9810 # For reproducability, one pseudo check with cat(1) and mv(1)
9812 text/plain; echo p-1-1\\;< %%s cat\\;echo p-1-2;\\
9813 test=echo X >> ./.terrmc\\; [ -n "$XY" ];x-mailx-test-once
9814 text/plain; echo p-2-1\\;< %%s cat\\;echo p-2-2;\\
9815 test=echo Y >> ./.terrmc\\;[ -z "$XY" ]
9816 text/plain; { file=%%s\\; echo p-3-1 = ${file##*.}\\;\\
9817 </dev/null cat %%s\\;echo p-3-2\\; } > ./.tx\\; mv -f ./.tx ./.tasy;\\
9818 test=[ -n "$XY" ];nametemplate=%%s.txt;x-mailx-async
9819 text/plain; echo p-4-1\\;cat\\;echo p-4-2;copiousoutput
9822 </dev/null MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9823 ${MAILX} ${ARGS} -Snomailcap-disable \
9825 -Rf "${MBOX}" > ./.tall 2>./.terr
9826 check 4.pre 0 ./.tall '1428075831 455'
9828 # Same with real programs
9830 text/plain; echo p-1-1\\;< %%s %s\\;echo p-1-2;\\
9831 test=echo X >> ./.terrmc\\; [ -n "$XY" ];x-mailx-test-once
9832 text/plain; echo p-2-1\\;< %%s %s\\;echo p-2-2;\\
9833 test=echo Y >> ./.terrmc\\;[ -z "$XY" ]
9834 text/plain; { file=%%s\\; echo p-3-1 = ${file##*.}\\;\\
9835 </dev/null %s %%s\\;echo p-3-2\\; } > ./.tx\\; %s -f ./.tx ./.tasy;\\
9836 test=[ -n "$XY" ];nametemplate=%%s.txt;x-mailx-async
9837 text/plain; echo p-4-1\\;%s\\;echo p-4-2;copiousoutput
9838 ' "${cat}" "${cat}" "${cat}" "${mv}" "${cat}" > ./.tmailcap
9840 </dev/null MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9841 ${MAILX} ${ARGS} -Snomailcap-disable \
9852 -Rf "${MBOX}" > ./.tall 2>./.terr
9853 check 4 0 ./.tall '1912261831 831'
9854 check 5 - ./.terr '4294967295 0'
9855 check 6 - ./.terrmc '2376112102 6'
9856 check 7 - ./.tasy '3913344578 37' async
9858 # "Binary data"; ensure all possible temporary file / nametemplate
9859 # etc. paths are taken: avoid 2nd e7a60732c1906aefe4755fd61c5ffa81eeca0af0
9862 printf 'du\x7fbo€o\bm' > ./.tatt.pdf
9863 printf 'du' | ${MAILX} ${ARGS} -a ./.tatt.pdf -s test "${MBOX}"
9864 check 8 0 "${MBOX}" '3444709420 644'
9868 application/pdf; echo p-1-1\\;%s\\;echo p-1-2; test=[ "$XY" = "" ]
9869 # tmpfile, no template
9870 application/pdf; echo p-2-1\\;< %%s %s\\;echo p-2-2; test = [ "$XY" = two ]
9872 application/pdf; echo p-3-1\\;< %%s %s\\;echo p-3-2; test=[ "$XY" = three ];\\
9873 nametemplate=%%s.txt
9874 # tmpfile, template, async
9875 application/pdf; { file=%%s \\; echo p-4-1 = ${file##*.}\\;\\
9876 </dev/null %s %%s\\;echo p-4-2\\; } > ./.tx\\; %s -f ./.tx ./.tasy;\\
9877 test=[ "$XY" = four ] ; nametemplate = %%s.txt ; x-mailx-async
9879 application/pdf; echo p-5-1\\;%s\\;echo p-5-2; test=[ "$XY" = 1 ];\\
9881 # copious, tmpfile, no template
9882 application/pdf; echo p-6-1\\;< %%s %s\\;echo p-6-2; test = [ "$XY" = 2 ];\\
9884 # copious, tmpfile, template
9885 application/pdf; echo p-7-1\\;< %%s %s\\;echo p-7-2;test = [ "$XY" = 3 ];\\
9886 nametemplate=%%s.txt; copiousoutput
9887 ' "${cat}" "${cat}" "${cat}" "${cat}" "${mv}" "${cat}" "${cat}" "${cat}" \
9890 </dev/null XY= MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9891 ${MAILX} ${ARGS} -Snomailcap-disable \
9899 \environ set XY=three
9902 \environ set XY=four
9915 -Rf "${MBOX}" > ./.tall 2>./.terr
9916 check 9 0 ./.tall '2388630345 3850'
9917 check 10 - ./.terr '4294967295 0'
9918 check 11 - ./.tasy '842146666 27' async
9920 # x-mailx-last-resort, x-mailx-ignore
9923 printf 'in a pdf\n' > ./.tatt.pdf
9924 printf 'du\n' | ${MAILX} ${ARGS} -a ./.tatt.pdf -s test "${MBOX}"
9925 check 12 0 "${MBOX}" '3968874750 579'
9929 application/pdf;echo hidden;x-mailx-ignore
9930 application/pdf;echo hidden;copiousoutput;x-mailx-ignore
9931 application/pdf; echo pre\\;%s\\;echo post; x-mailx-last-resort
9932 ' "${cat}" > ./.tmailcap
9934 </dev/null XY= MAILCAPS=./.tmailcap TMPDIR=`${pwd}` \
9935 ${MAILX} ${ARGS} -Snomailcap-disable \
9940 \mimetype ?t application/pdf pdf
9945 \unmimetype application/pdf
9949 -Rf "${MBOX}" > ./.tall 2>./.terr
9950 check 13 0 ./.tall '759843612 1961'
9951 check 14 - ./.terr '4294967295 0'
9957 # Unclassified rest {{{
9961 t__gen_msg subject top1 to 1 from 1 cc 1 body 'body1-1
9970 t__gen_msg subject top2 to 1 from 1 cc 1 body 'body2-1
9981 ${MAILX} ${ARGS} -Rf -Y '#
9983 \echo --- $?/$^ERRNAME, 1; \set toplines=10
9985 \echo --- $?/$^ERRNAME, 2; \set toplines=5
9986 \headerpick top retain subject # For top
9987 \headerpick type retain to subject # For Top
9989 \echo --- $?/$^ERRNAME, 3; \set topsqueeze
9991 \echo --- $?/$^ERRNAME, 4
9993 \echo --- $?/$^ERRNAME, 5
9994 # ' "${MBOX}" > ./.tall 2>&1
9995 check 1 0 ./.tall '2556125754 705'
10003 if have_feat smime; then :; else
10004 t_echoskip '[!SMIME]'
10009 ${cat} <<-_EOT > ./.t.conf
10011 x509_extensions = extensions
10012 distinguished_name = req_distinguished_name
10013 attributes = req_attributes
10015 output_password = Pacem_in_terris
10018 basicConstraints = CA:FALSE
10019 # Needs a CA for that keyUsage = digitalSignature
10020 extendedKeyUsage = emailProtection
10022 [req_distinguished_name]
10029 emailAddress = test@localhost
10032 challengePassword = hi ca it is me me me
10038 if [ "${_z}" = 0 ]; then
10043 _pass=Pacem_in_terris
10045 _ossl='-passin pass:'${_pass}
10048 ${rm} -f ./.VERIFY ./.ENCRYPT ./.DECRYPT
10050 openssl req ${_osslreq} ${_ossl} -x509 -days 3650 -config ./.t.conf \
10051 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >>${ERR} 2>&1
10055 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
10058 echo bla | ${MAILX} ${ARGS} \
10059 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
10060 -Ssmime-sign-digest=sha1 \
10061 -S password-test@localhost.smime-cert-key=${_pass} \
10062 -s 'S/MIME test' ./.VERIFY >>${ERR} 2>&1
10063 check_ex0 ${_z}-estat
10066 /^Content-Description: /{ skip = 2; print; next }
10067 /^$/{ if(skip) --skip }
10068 { if(!skip) print }
10070 < ./.VERIFY > "${MBOX}"
10071 check ${_z} - "${MBOX}" '335634014 644'
10074 printf 'verify\nx\n' |
10075 ${MAILX} ${ARGS} -Ssmime-ca-file=./.tcert.pem -Serrexit \
10076 -R -f ./.VERIFY >>${ERR} 2>&1
10077 check_ex0 ${_z} # XXX pipe
10080 openssl smime -verify -CAfile ./.tcert.pem -in ./.VERIFY >>${ERR} 2>&1
10084 # (signing +) encryption / decryption
10087 -Smta=test://./.ENCRYPT \
10088 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
10089 -Ssmime-sign-digest=sha1 \
10090 -Ssmime-sign -Ssmime-sign-cert=./.tpair.pem -Sfrom=test@localhost \
10091 -S password-test@localhost.smime-cert-key=${_pass} \
10092 -s 'S/MIME test' recei@ver.com >>${ERR} 2>&1
10093 check_ex0 ${_z}-estat
10094 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
10095 check ${_z} - "${MBOX}" '2359655411 336'
10098 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
10100 -Smta=test://./.ENCRYPT \
10101 -Ssmime-ca-file=./.tcert.pem \
10102 -Ssmime-sign-cert=./.tpair.pem \
10103 -Sfrom=test@localhost \
10104 -S password-test@localhost.smime-cert-key=${_pass} \
10105 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
10106 check_ex0 ${_z}-estat
10109 /^Content-Description: /{ skip = 2; print; next }
10110 /^$/{ if(skip) --skip }
10111 { if(!skip) print }
10113 < ./.DECRYPT > "${MBOX}"
10114 check ${_z} - "${MBOX}" '2602978204 940'
10117 (openssl smime -decrypt ${_ossl} -inkey ./.tkey.pem -in ./.ENCRYPT |
10118 openssl smime -verify -CAfile ./.tcert.pem) >>${ERR} 2>&1
10119 check_ex0 ${_z} # XXX pipe..
10123 echo bla | ${MAILX} ${ARGS} \
10124 -Smta=test://./.ENCRYPT \
10125 -Ssmime-force-encryption -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
10126 -Sfrom=test@localhost \
10127 -S password-test@localhost.smime-cert-key=${_pass} \
10128 -s 'S/MIME test' recei@ver.com >>${ERR} 2>&1
10129 check_ex0 ${_z}-estat
10130 ${sed} -e '/^$/,$d' < ./.ENCRYPT > "${MBOX}"
10131 check ${_z} - "${MBOX}" '2359655411 336'
10135 # Note: deduce from *sign-cert*, not from *from*!
10136 printf 'decrypt ./.DECRYPT\nx\n' | ${MAILX} ${ARGS} \
10137 -Smta=test://./.ENCRYPT \
10138 -Ssmime-sign-cert-recei@ver.com=./.tpair.pem \
10139 -S password-recei@ver.com.smime-cert-key=${_pass} \
10140 -Serrexit -R -f ./.ENCRYPT >>${ERR} 2>&1
10141 check ${_z} 0 ./.DECRYPT '2453471323 431'
10144 openssl smime ${_ossl} -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT \
10148 unset _z _pass _osslreq _ossl
10158 # xxx Note: t_z() was the first test (series) written. Today many
10159 # xxx aspects are (better) covered by other tests above, some are not.
10160 # xxx At some future date and time, convert the last remains not covered
10161 # xxx elsewhere to a real t_* test and drop it
10165 # Test for [260e19d] (Juergen Daubert)
10166 echo body | ${MAILX} ${ARGS} "${MBOX}"
10167 check 4 0 "${MBOX}" '2948857341 94'
10169 # "Test for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
10172 for(i = 0; i < 10000; ++i)
10174 #printf "\xF0\x90\x87\x90"
10175 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
10176 check 7 0 "${MBOX}" '1707496413 61812'
10183 t___gen_msg '' "${@}"
10187 t___gen_msg 1 "${@}"
10199 while [ ${___hi} -le ${3} ]; do
10200 [ ${___hi} -gt 1 ] && printf ', '
10201 printf '%s%s <%s%s@exam.ple>' ${1} ${___hi} ${2} ${___hi}
10202 ___hi=`add
${___hi} 1`
10212 printf 'From reproducible_build Wed Oct 2 01:50:07 1996
10213 Date: Wed, 02 Oct 1996 01:50:07 +0000
10217 while [ ${#} -ge 2 ]; do
10219 from) t___header From from "${2}";;
10220 to) t___header To to "${2}";;
10221 cc) t___header Cc cc "${2}";;
10222 bcc) t___header Bcc bcc "${2}";;
10223 subject) printf 'Subject: %s\n' "${2}";;
10224 body) body="${2}";;
10229 if [ -z "${ismime}" ]; then
10230 printf '\n%s\n\n' "${body}"
10232 printf 'MIME-Version: 1.0
10233 Message-ID: <20200204225307.FaKeD%%bo@oo>
10234 Content-Type: multipart/mixed; boundary="=BOUNDOUT="
10237 Content-Type: multipart/alternative; boundary==BOUNDIN=
10240 Content-Type: text/plain; charset=utf-8
10241 Content-Transfer-Encoding: 8-bit
10246 Content-Type: text/html; charset=utf-8
10247 Content-Transfer-Encoding: 8-bit
10249 <HTML><BODY>%s<BR></BODY></HTML>
10254 Content-Type: text/troff
10259 Content-Type: text/x-uuencode
10261 Aprendimos a quererte
10264 ' "${body}" "${body}"
10270 From neverneverland Sun Jul 23 13:46:25 2017
10271 Subject: Bugstop: five miles out 1
10272 Reply-To: mister originator1 <mr1@originator>
10273 From: mister originator1 <mr1@originator>
10274 To: bugstop-commit@five.miles.out
10276 In-reply-to: <20170719111113.bkcMz%laber1@backe.eu>
10277 Date: Wed, 19 Jul 2017 09:22:57 -0400
10278 Message-Id: <20170719132257.766AF781267-1@originator>
10279 Mail-Followup-To: bugstop@five.miles.out, laber@backe.eu, is@a.list
10282 That's appalling, I.
10289 From neverneverland Sun Jul 23 13:47:25 2017
10290 Subject: Bugstop: five miles out 2
10291 Reply-To: mister originator2 <mr2@originator>
10292 From: mister originator2 <mr2@originator>
10293 To: bugstop-commit@five.miles.out
10295 In-reply-to: <20170719111113.bkcMz%laber2@backe.eu>
10296 Date: Wed, 19 Jul 2017 09:23:57 -0400
10297 Message-Id: <20170719132257.766AF781267-2@originator>
10300 That's appalling, II.
10307 From neverneverland Sun Jul 23 13:48:25 2017
10308 Subject: Bugstop: five miles out 3
10309 Reply-To: mister originator3 <mr3@originator>
10310 From: mister originator3 <mr3@originator>
10311 To: bugstop-commit@five.miles.out
10313 In-reply-to: <20170719111113.bkcMz%laber3@backe.eu>
10314 Date: Wed, 19 Jul 2017 09:24:57 -0400
10315 Message-Id: <20170719132257.766AF781267-3@originator>
10318 That's appalling, III.
10324 # MIME encoding (QP) stress message subject
10325 printf 'Äbrä Kä?dä=brö Fü?di=bus? '\
10326 'adadaddsssssssddddddddddddddddddddd'\
10327 'ddddddddddddddddddddddddddddddddddd'\
10328 'ddddddddddddddddddddddddddddddddddd'\
10329 'dddddddddddddddddddd Hallelulja? Od'\
10330 'er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
10331 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\
10332 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f'\
10333 'fffffffffffffffffffffffffffffffffff'\
10334 'fffffffffffffffffffff ggggggggggggg'\
10335 'ggggggggggggggggggggggggggggggggggg'\
10336 'ggggggggggggggggggggggggggggggggggg'\
10337 'ggggggggggggggggggggggggggggggggggg'\
10342 # MIME encoding (QP) stress message body
10344 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
10345 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
10346 "wasde willst, gelle, gelle, gelle, gelle, gelle.\r\n"\
10347 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst \r\n"\
10348 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1\r\n"\
10349 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12\r\n"\
10350 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123\r\n"\
10351 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234\r\n"\
10352 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345\r\n"\
10353 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456\r\n"\
10354 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 1234567\r\n"\
10355 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 12345678\r\n"\
10356 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst 123456789\r\n"\
10357 "Unn ausserdem habe ich trailing SP/HT/SP/HT whitespace \r\n"\
10358 "Unn ausserdem habe ich trailing HT/SP/HT/SP whitespace \r\n"\
10359 "auf den zeilen vorher.\r\n"\
10360 "From am Zeilenbeginn und From der Mitte gibt es auch.\r\n"\
10362 "Die letzte Zeile war nur ein Punkt.\r\n"\
10364 "Das waren deren zwei.\r\n"\
10366 "Die letzte Zeile war ein Leerschritt.\n"\
10367 "=VIER = EQUAL SIGNS=ON A LINE=\r\n"\
10368 "Prösterchen.\r\n"\
10370 "Die letzte Zeile war nur ein Punkt, mit Unix Zeilenende.\n"\
10372 "Das waren deren zwei. ditto.\n"\
10374 "Unn ausseerdem habe ich trailing SP/HT/SP/HT whitespace \n"\
10375 "Unn ausseerdem habe ich trailing HT/SP/HT/SP whitespace \n"\
10376 "auf den zeilen vorher.\n"\
10378 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.\n"\
10379 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.1"\
10381 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10383 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10385 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10387 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10389 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende.12"\
10391 "QP am Zeilenende über soft-nl hinweg\n"\
10392 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10394 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10396 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10398 "Ich bin eine ziemlich lange, steile, scharfe Zeile mit Unix Zeilenende."\
10400 "=VIER = EQUAL SIGNS=ON A LINE=\n"\
10402 "Die letzte Zeile war ein Leerschritt.\n"\
10407 # cc_all_configs() {{{
10408 # Test all configs TODO doesn't cover all *combinations*, stupid!
10410 if [ ${MAXJOBS} -gt 1 ]; then
10411 MAXJOBS='-j '${MAXJOBS}
10415 if [ -n "${NOCOLOUR}" ] || [ -n "${MAILX_CC_TEST_NO_COLOUR}" ]; then
10416 MAILX_CC_TEST_NO_COLOUR=1
10417 export MAILX_CC_TEST_NO_COLOUR
10422 ALWAYS = "OPT_AUTOCC=1 OPT_AMALGAMATION=1"
10423 NOTME["OPT_AUTOCC_STACKPROT"] = 1
10424 NOTME["OPT_ALWAYS_UNICODE_LOCALE"] = 1
10425 NOTME["OPT_CROSS_BUILD"] = 1
10426 NOTME["OPT_AUTOCC"] = 1
10427 NOTME["OPT_AMALGAMATION"] = 1
10428 NOTME["OPT_DEBUG"] = 1
10429 NOTME["OPT_DEVEL"] = 1
10430 NOTME["OPT_ASAN_ADDRESS"] = 1
10431 NOTME["OPT_ASAN_MEMORY"] = 1
10432 NOTME["OPT_NOMEMDBG"] = 1
10437 MULCHOICE["OPT_IDNA"] = "VAL_IDNA"
10438 MULVALS["VAL_IDNA"] = 1
10440 #VALKEYS[0] = "VAL_RANDOM"
10441 VALVALS["VAL_RANDOM"] = 1
10446 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
10447 # does not seem to be a compliant escape for =
10449 $1 = substr($1, 1, index($1, "=") - 1)
10451 OPTVALS[OPTNO++] = $1
10456 val = substr($0, index($0, "=") + 1)
10458 val = substr(val, 2)
10459 val = substr(val, 1, length(val) - 1)
10461 $1 = substr($1, 1, index($1, "=") - 1)
10464 else if(VALVALS[$1]){
10465 VALKEYS[VALNO++] = $1
10470 function onepass(addons){
10471 a_onepass__worker(addons, "1", "0")
10472 a_onepass__worker(addons, "0", "1")
10474 function a_onepass__worker(addons, b0, b1){
10475 # Doing this completely sequentially and not doing make distclean in
10476 # between runs should effectively result in lesser compilations.
10477 # It is completely dumb nonetheless... TODO
10478 for(ono = 0; ono < OPTNO; ++ono){
10480 for(i = 0; i < ono; ++i){
10481 myconf = myconf " " OPTVALS[i] "=" b0 " "
10483 j = MULCHOICE[OPTVALS[i]]
10488 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
10492 for(i = ono; i < OPTNO; ++i){
10493 myconf = myconf " " OPTVALS[i] "=" b1 " "
10495 j = MULCHOICE[OPTVALS[i]]
10500 myconf = myconf " " MULCHOICE[OPTVALS[i]] "=any "
10506 myconf = VALKEYS[i] "=any " myconf
10508 myconf = myconf " " ALWAYS " " addons
10513 i = split(MULVALS[mula], ia)
10517 print mula "=\"" j "\" " myconf
10523 # We cannot test NULL because of missing UI strings, which will end
10524 # up with different checksums
10525 print "CONFIG=NULLI OPT_AUTOCC=1"
10527 j = split(VALVALS[VALKEYS[i]], ia)
10531 print VALKEYS[i] "=\"" k "\" CONFIG=NULLI OPT_AUTOCC=1"
10534 print "CONFIG=MINIMAL OPT_AUTOCC=1"
10535 print "CONFIG=NETSEND OPT_AUTOCC=1"
10536 print "CONFIG=MAXIMAL OPT_AUTOCC=1"
10538 j = split(VALVALS[VALKEYS[i]], ia)
10542 print VALKEYS[i] "=\"" k "\" CONFIG=MAXIMAL OPT_AUTOCC=1"
10545 print "CONFIG=DEVEL OPT_AUTOCC=1"
10546 print "CONFIG=ODEVEL OPT_AUTOCC=1"
10550 onepass("OPT_DEBUG=1")
10553 ' | while read c; do
10554 if [ "$c" = split_here ]; then
10555 printf 'Predefined configs done, now OPT_ combinations\n'
10556 printf 'Predefined configs done, now OPT_ combinations\n' >&2
10557 ${SHELL} -c "cd ../ && ${MAKE} distclean"
10560 [ -f mk-config.h ] && ${cp} mk-config.h .ccac.h
10561 printf "\n\n##########\n${MAKE} ${MAXJOBS} config $c\n"
10562 printf "\n\n##########\n${MAKE} ${MAXJOBS} config $c\n" >&2
10563 ${SHELL} -c "cd .. && ${MAKE} ${MAXJOBS} config ${c}"
10564 if [ -f .ccac.h ] && ${cmp} mk-config.h .ccac.h; then
10565 printf 'Skipping after config, nothing changed\n'
10566 printf 'Skipping after config, nothing changed\n' >&2
10569 ${SHELL} -c "cd ../ && ${MAKE} ${MAXJOBS} build test"
10572 cd .. && ${MAKE} distclean
10577 if [ -z "${CHECK}${RUN_TEST}" ]; then
10581 if have_feat debug; then
10582 if have_feat devel; then
10586 ARGS="${ARGS} -Smemdebug"
10587 JOBWAIT=`add
$JOBWAIT $JOBWAIT`
10589 elif have_feat devel; then
10592 LOOPS_MAX=${LOOPS_BIG}
10596 if [ -z "${RUN_TEST}" ] || [ ${#} -eq 0 ]; then
10598 printf 'Will do up to %s tests in parallel, with a %s second timeout\n' \
10599 ${MAXJOBS} ${JOBWAIT}
10606 while [ ${#} -gt 0 ]; do
10616 printf '%u tests: %s%u ok%s, %s%u failure(s)%s. %s%u test(s) skipped%s\n' \
10617 "${TESTS_PERFORMED}" "${COLOR_OK_ON}" "${TESTS_OK}" "${COLOR_OK_OFF}" \
10618 "${COLOR_ERR_ON}" "${TESTS_FAILED}" "${COLOR_ERR_OFF}" \
10619 "${COLOR_WARN_ON}" "${TESTS_SKIPPED}" "${COLOR_WARN_OFF}"
10620 if [ -n "${ssec}" ] && [ -n "${esec}" ]; then
10621 ( echo 'Elapsed seconds: '`$awk 'BEGIN{print '"${esec}"' - '"${ssec}"'}'` )