2 #@ Usage: ./cc-test.sh [--check-only] s-mailx-binary
3 #@ TODO _All_ the tests should happen in a temporary subdir.
6 # We need *stealthmua* regardless of $SOURCE_DATE_EPOCH, the program name as
7 # such is a compile-time variable
8 ARGS
='-:/ -# -Sdotlock-ignore-error -Sencoding=quoted-printable -Sstealthmua'
9 ARGS
="${ARGS}"' -Snosave -Sexpandaddr=restrict'
10 ADDARG_UNI
=-Sttycharset=UTF-8
15 #UTF8_LOCALE= autodetected unless set
18 #MEMTESTER='valgrind --leak-check=full --log-file=.vl-%p '
20 if ( command -v command ) >/dev
/null
2>&1; then :; else
27 MAKE
="${MAKE:-`command -v make`}"
28 awk=${awk:-`command -v awk`}
29 cat=${cat:-`command -v cat`}
30 cksum=${cksum:-`command -v cksum`}
31 rm=${rm:-`command -v rm`}
32 sed=${sed:-`command -v sed`}
33 grep=${grep:-`command -v grep`}
35 # Problem: force $SHELL to be a real shell. It seems some testing environments
36 # use nologin(?), but we need a real shell for command execution
37 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
38 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
43 # We sometimes "fake" sendmail(1) a.k.a. *mta* with a shell wrapper, and it
44 # happens that /bin/sh is often terribly slow
45 if command -v dash
>/dev
/null
2>&1; then
46 MYSHELL
="`command -v dash`"
47 elif command -v mksh
>/dev
/null
2>&1; then
48 MYSHELL
="`command -v mksh`"
55 export ARGS ADDARG_UNI CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
59 # Wed Oct 2 01:50:07 UTC 1996
60 SOURCE_DATE_EPOCH
=844221007
62 export LC_ALL LANG TZ SOURCE_DATE_EPOCH
65 if [ -z "${UTF8_LOCALE}" ]; then
67 if command -v locale
>/dev
/null
2>&1; then
68 UTF8_LOCALE
=`locale -a | { m=
70 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
72 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
86 echo >&2 "Usage: ./cc-test.sh [--check-only] s-mailx-binary"
91 while [ $# -gt 0 ]; do
92 if [ "${1}" = --check-only ]; then
99 [ -x "${MAILX}" ] || usage
101 MAILX
="${MEMTESTER}${MAILX}"
102 export RAWMAILX MAILX
105 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
106 trap "exit 1" HUP INT TERM
109 # Test all configs TODO doesn't cover all *combinations*, stupid!
113 NOTME["OPT_AUTOCC"] = 1
114 NOTME["OPT_DEBUG"] = 1
115 NOTME["OPT_DEVEL"] = 1
116 NOTME["OPT_NOEXTMD5"] = 1
117 NOTME["OPT_NOMEMDBG"] = 1
118 NOTME["OPT_NYD2"] = 1
121 /^[[:space:]]*OPT_/ {
122 sub(/^[[:space:]]*/, "")
123 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
124 # does not seem to be a compliant escape for =
126 $1 = substr($1, 1, index($1, "=") - 1)
132 # Doing this completely sequentially and not doing make distclean in
133 # between runs should effectively result in lesser compilations.
134 # It is completely dumb nonetheless... TODO
135 for (j = 1; j < i; ++j) {
136 for (k = 1; k < j; ++k)
138 for (k = j; k < i; ++k)
140 printf "OPT_AUTOCC=1\n"
142 for (j = 1; j < i; ++j) {
143 for (k = 1; k < j; ++k)
145 for (k = j; k < i; ++k)
147 printf "OPT_AUTOCC=1\n"
150 for (j = 1; j < i; ++j) {
151 for (k = 1; k < j; ++k)
153 for (k = j; k < i; ++k)
155 printf "OPT_AUTOCC=1\n"
156 printf "OPT_DEBUG=1\n"
158 for (j = 1; j < i; ++j) {
159 for (k = 1; k < j; ++k)
161 for (k = j; k < i; ++k)
163 printf "OPT_AUTOCC=1\n"
164 printf "OPT_DEBUG=1\n"
167 printf "CONFIG=NULL OPT_AUTOCC=0\n"
168 printf "CONFIG=NULL OPT_AUTOCC=1\n"
169 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
170 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
171 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
172 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
173 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
174 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
175 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
176 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
177 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
178 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
179 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
180 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
181 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
182 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
185 printf "\n\n##########\n$c\n"
186 printf "\n\n##########\n$c\n" >&2
194 ( "${RAWMAILX}" ${ARGS} -X'echo $features' -Xx |
195 ${grep} +${1} ) >/dev
/null
2>&1
199 ${rm} -rf "${BODY}" "${MBOX}" ${TRAP_EXIT_ADDONS}
207 restat
=${?} tid=${1} eestat=${2} f=${3} s=${4}
208 #x=`echo ${tid} | tr "/:=" "__-"`
209 #cp -f "${f}" "${TMPDIR}/${x}"
210 [ "${eestat}" != - ] && [ "${restat}" != "${eestat}" ] &&
211 err
"${tid}" 'unexpected exit status: '"${restat} != ${eestat}"
212 csum
="`${cksum} < ${f}`"
213 if [ "${csum}" = "${s}" ]; then
214 printf '%s: ok\n' "${tid}"
217 printf '%s: error: checksum mismatch (got %s)\n' "${tid}" "${csum}"
223 printf '%s: error: %s\n' ${1} "${2}"
227 [ $?
-ne 0 ] && err
$1 'unexpected non-0 exit status'
231 [ $?
-eq 0 ] && err
$1 'unexpected 0 exit status'
234 if ( [ "$((1 + 1))" = 2 ] ) >/dev
/null
2>&1; then
236 echo "$((${1} + ${2}))"
238 elif command -v expr >/dev
/null
2>&1; then
240 echo `expr ${1} + ${2}`
244 echo `${awk} 'BEGIN{print '${1}' + '${2}'}'`
248 if ( [ "$((2 % 3))" = 2 ] ) >/dev
/null
2>&1; then
250 echo "$((${1} % ${2}))"
252 elif command -v expr >/dev
/null
2>&1; then
254 echo `expr ${1} % ${2}`
258 echo `${awk} 'BEGIN{print '${1}' % '${2}'}'`
263 # Basic (easily testable) behaviour tests
265 t_behave_X_opt_input_command_stack
268 t_behave_input_inject_semicolon_seq
269 t_behave_commandalias
272 t_behave_macro_param_shift
282 # FIXME t_behave_mlist
285 t_behave_record_a_resend
288 t_behave_compose_hooks
289 t_behave_mime_types_load_control
296 t_behave_X_opt_input_command_stack
() {
299 ${cat} <<- '__EOT' > "${BODY}"
307 echo "define mac1 {";\
308 echo " echo mac1-1 via1 \$0";\
310 echo " echo mac1-2";\
312 echo " echo mac1-3";\
315 echo "define mac2 {";\
316 echo " echo mac2-1 via1 \$0";\
318 echo " echo mac2-2";\
324 echo echo 1-1-1 via1 \$0;\
336 # The -X option supports multiline arguments, and those can internally use
337 # reverse solidus newline escaping. And all -X options are joined...
339 < "${BODY}" ${MAILX} ${ARGS} \
354 echo "define mac1 {";\
355 echo " echo mac1-1 via2 \$0";\
357 echo " echo mac1-2";\
359 echo " echo mac1-3";\
362 echo "define mac2 {";\
363 echo " echo mac2-1 via2 \$0";\
365 echo " echo mac2-2";\
371 echo echo 1-1-1 via2 \$0;\
385 check behave:x_opt_input_command_stack 0 "${MBOX}" '1786542668 416'
390 t_behave_X_errexit() {
393 ${cat} <<- '__EOT' > "${BODY}"
399 </dev/null ${MAILX} ${ARGS} -Snomemdebug \
400 -X'echo one' -X' echos nono ' -X'echo two' \
402 check behave:x_errexit-1 0 "${MBOX}" '916157812 53'
404 </dev/null ${MAILX} ${ARGS} -X'source '"${BODY}" -Snomemdebug \
406 check behave:x_errexit-2 0 "${MBOX}" '916157812 53'
408 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Snomemdebug \
410 check behave
:x_errexit-3
0 "${MBOX}" '916157812 53'
414 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
415 -X'echo one' -X' echos nono ' -X'echo two' \
417 check behave
:x_errexit-4
1 "${MBOX}" '2118430867 49'
419 </dev
/null
${MAILX} ${ARGS} -X'source '"${BODY}" -Serrexit -Snomemdebug \
421 check behave:x_errexit-5 1 "${MBOX}" '2118430867 49'
423 </dev/null MAILRC="${BODY}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
425 check behave
:x_errexit-6
1 "${MBOX}" '12955965 172'
427 </dev
/null MAILRC
="${BODY}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
429 check behave:x_errexit-7 1 "${MBOX}" '12955965 172'
431 ## Repeat 4-7 with ignerr set
433 ${sed} -e 's/^echos /ignerr echos /' < "${BODY}" > "${MBOX}"
435 </dev
/null
${MAILX} ${ARGS} -Serrexit -Snomemdebug \
436 -X'echo one' -X'ignerr echos nono ' -X'echo two' \
438 check behave
:x_errexit-8
0 "${BODY}" '916157812 53'
440 </dev
/null
${MAILX} ${ARGS} -X'source '"${MBOX}" -Serrexit -Snomemdebug \
442 check behave:x_errexit-9 0 "${BODY}" '916157812 53'
444 </dev/null MAILRC="${MBOX}" ${MAILX} ${ARGS} -:u
-Serrexit -Snomemdebug \
446 check behave
:x_errexit-10
0 "${BODY}" '916157812 53'
448 </dev
/null MAILRC
="${MBOX}" ${MAILX} ${ARGS} -:u -Sposix -Snomemdebug \
450 check behave:x_errexit-11 0 "${BODY}" '916157812 53'
458 ${cat} <<- '__EOT' > "${BODY}"
477 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
478 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
479 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
481 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
482 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
505 echo a$
'b\U0000000'dt
506 echo a$
'b\U00000000'du
516 if [ -z "${UTF8_LOCALE}" ]; then
517 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
519 < "${BODY}" DIET
=CURD TIED
= \
520 LC_ALL
=${UTF8_LOCALE} ${MAILX} ${ARGS} 2>/dev/null > "${MBOX}"
521 check behave:wysh_unicode 0 "${MBOX}" '475805847 317'
524 < "${BODY}" DIET=CURD TIED= ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
525 check behave:wysh_c 0 "${MBOX}" '1473887148 321'
530 t_behave_input_inject_semicolon_seq() {
533 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
538 echon this_is_mymac
;call mydeepmac
;echon
';';
540 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
542 echon this_is_mymac
;call mydeepmac
;echon
,TOO
'!;';
544 echon one
';';call mymac
;echon two
";";call mymac
;echo three$
';';
547 check behave
:input_inject_semicolon_seq
0 "${MBOX}" '512117110 140'
552 t_behave_commandalias
() {
555 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
556 commandalias echo echo hoho
560 commandalias XxX XxXx
561 commandalias XxXx XxXxX
562 commandalias XxXxX XxXxXx
563 commandalias XxXxXx echo huhu
564 commandalias XxXxXxX echo huhu
566 commandalias XxXxXx XxXxXxX
569 commandalias XxXxXx echo huhu
573 check behave:commandalias 0 "${MBOX}" '3694143612 31'
581 # Nestable conditions test
582 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
604 if $dietcurd == 'yoho'
609 if $dietcurd @
== 'Yoho'
614 if $dietcurd == 'Yoho'
619 if $dietcurd != 'yoho'
624 if $dietcurd @
!= 'Yoho'
629 if $dietcurd != 'Yoho'
690 if $dietcurd == 'yohu'
692 elif $dietcurd == 'yoha'
694 elif $dietcurd == 'yohe'
696 elif $dietcurd == 'yoho'
698 if $dietcurd == 'yohu'
700 elif $dietcurd == 'yoha'
702 elif $dietcurd == 'yohe'
704 elif $dietcurd == 'yoho'
706 if $dietcurd == 'yohu'
708 elif $dietcurd == 'yoha'
710 elif $dietcurd == 'yohe'
712 elif $dietcurd == 'yoho'
861 set diet
=abc curd
=abc
867 set diet
=abc curd
=abcd
873 # 1. Shitty grouping capabilities as of today
874 unset diet curd ndefined
875 if [ [ false
] ||
[ false
] ||
[ true
] ] && [ [ false
] ||
[ true
] ] && \
881 if [ [ [ [ 0 ] ||
[ 1 ] ] && [ [ 1 ] ||
[ 0 ] ] ] && [ 1 ] ] && [ yes ]
886 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ]
891 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ]
896 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] && [ no
]
901 if [ [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ [ 1 ] ] ||
[ 1 ] ] \
907 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
912 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
917 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
922 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
927 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 0 ]
932 if [ 1 ] ||
[ 0 ] ||
[ 0 ] ||
[ 0 ] && [ 1 ]
937 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ]
942 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 1 ]
947 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 0 ]
952 if [ 0 ] ||
[ 0 ] ||
[ 0 ] ||
[ 1 ] && [ 0 ] ||
[ 1 ] && [ 1 ]
958 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
964 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
969 # 2. Shitty grouping capabilities as of today
970 unset diet curd ndefined
971 if [ false || false || true
] && [ false || true
] && yes
976 if [ [ [ 0 ||
1 ] && [ 1 ||
0 ] ] && 1 ] && [ yes ]
981 if [ 1 ||
0 ||
0 ||
0 ]
986 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ]
991 if [ 1 ||
0 ||
0 ||
0 ||
[ 1 ] ||
1 ] && no
996 if [ 1 ||
0 ||
0 ||
0 ||
1 ||
[ 1 ] ] && no ||
[ yes ]
1001 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
1006 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
1011 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
1016 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
1021 if 1 ||
0 ||
0 ||
0 && 0
1026 if 1 ||
0 ||
0 ||
0 && 1
1031 if 0 ||
0 ||
0 ||
1 && 0
1036 if 0 ||
0 ||
0 ||
1 && 1
1041 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 0
1046 if 0 ||
0 ||
0 ||
1 && 0 ||
1 && 1
1052 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1057 if $diet == 'yo' && $curd == 'ho' && $ndefined
1063 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1068 if $diet == 'yo' && $curd == 'ho' && $ndefined
1073 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1078 # Some more en-braced variables
1080 if ${diet} == ${curd}
1085 if ${diet} != ${curd}
1101 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1106 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1111 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1116 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1121 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1126 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1131 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1136 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] ||
3
1141 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1147 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1152 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1157 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1162 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1167 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1172 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1177 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1182 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] ||
3
1187 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1194 check behave
:if-normal
0 "${MBOX}" '1688759742 719'
1196 if have_feat regex
; then
1197 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1199 if $dietcurd =~ '^yo.*'
1204 if $dietcurd =~ '^Yo.*'
1209 if $dietcurd @=~ '^Yo.*'
1214 if $dietcurd =~ '^yOho.+'
1219 if $dietcurd @!~ '.*Ho$'
1224 if $dietcurd !~ '.+yohO$'
1229 if [ $dietcurd @i!~ '.+yoho$' ]
1234 if ! [ $dietcurd @i=~ '.+yoho$' ]
1239 if ! ! [ $dietcurd @i!~ '.+yoho$' ]
1244 if ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ]
1249 if [ ! [ ! [ $dietcurd @i!~ '.+yoho$' ] ] ]
1254 if ! [ ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1259 if ! ! ! $dietcurd !~ '.+yoho$'
1264 if ! ! ! $dietcurd =~ '.+yoho$'
1269 if ! [ ! ! [ ! [ $dietcurd !~ '.+yoho$' ] ] ]
1274 set diet=abc curd='^abc$'
1280 set diet=abc curd='^abcd$'
1288 check behave:if-regex 0 "${MBOX}" '1115671789 95'
1290 printf 'behave:if-regex: unsupported, skipped\n'
1296 t_behave_localopts() {
1299 # Nestable conditions test
1300 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1315 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1320 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1321 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1330 echo active trouble
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1332 echo active null
: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1335 check behave
:localopts
0 "${MBOX}" '1936527193 192'
1340 t_behave_macro_param_shift
() {
1343 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev/null
1346 echo t2.0 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1351 echo t2.1 has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1352 if [ $# > 1 ] || [ $ignerr == '' ]
1357 echo t2.2:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1359 echo t2.3:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1363 echo t2.4:$? has $#/${#} parameters: "$1,${2},$3" (${*}) [$@]
1368 call t2 1 you get four args
1369 echo t1.1: $?';' ignerr ($ignerr) should not exist
1370 call t2 1 you get 'three args'
1371 echo t1.2: $?';' ignerr ($ignerr) should not exist
1372 call t2 1 you 'get two args'
1373 echo t1.3: $?';' ignerr ($ignerr) should not exist
1374 call t2 1 'you get one arg'
1375 echo t1.4: $?';' ignerr ($ignerr) should not exist
1376 ignerr call t2 '' 'you get one arg'
1377 echo t1.5: $?';' ignerr ($ignerr) should not exist
1382 check behave:macro_param_shift 0 "${MBOX}" '1402489146 1682'
1387 t_behave_addrcodec() {
1390 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}"
1391 vput addrcodec res e
1 <doog@def
>
1392 echo $?
/$^ERRNAME
$res
1393 eval vput addrcodec res d
$res
1394 echo $?
/$^ERRNAME
$res
1395 vput addrcodec res e
2 .
<doog@def
>
1396 echo $?
/$^ERRNAME
$res
1397 eval vput addrcodec res d
$res
1398 echo $?
/$^ERRNAME
$res
1399 vput addrcodec res e
3 Sauer Dr.
<doog@def
>
1400 echo $?
/$^ERRNAME
$res
1401 eval vput addrcodec res d
$res
1402 echo $?
/$^ERRNAME
$res
1403 vput addrcodec res e
3.50 Sauer
(Ma
) Dr.
<doog@def
>
1404 echo $?
/$^ERRNAME
$res
1405 eval vput addrcodec res d
$res
1406 echo $?
/$^ERRNAME
$res
1407 vput addrcodec res e
3.51 Sauer
(Ma
) "Dr." <doog@def
>
1408 echo $?
/$^ERRNAME
$res
1409 eval vput addrcodec res d
$res
1410 echo $?
/$^ERRNAME
$res
1412 vput addrcodec res
+e
4 Sauer
(Ma
) Dr.
<doog@def
>
1413 echo $?
/$^ERRNAME
$res
1414 eval vput addrcodec res d
$res
1415 echo $?
/$^ERRNAME
$res
1416 vput addrcodec res
+e
5 Sauer
(Ma
) Braten Dr.
<doog@def
>
1417 echo $?
/$^ERRNAME
$res
1418 eval vput addrcodec res d
$res
1419 echo $?
/$^ERRNAME
$res
1420 vput addrcodec res
+e
6 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
>
1421 echo $?
/$^ERRNAME
$res
1422 eval vput addrcodec res d
$res
1423 echo $?
/$^ERRNAME
$res
1424 vput addrcodec res
+e
7 Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
)
1425 echo $?
/$^ERRNAME
$res
1426 eval vput addrcodec res d
$res
1427 echo $?
/$^ERRNAME
$res
1428 vput addrcodec res
+e
8 \
1429 Dr. Sauer
(Ma
) Braten Dr.
(Heu
) <doog@def
> (bu
) Boom. Boom
1430 echo $?
/$^ERRNAME
$res
1431 eval vput addrcodec res d
$res
1432 echo $?
/$^ERRNAME
$res
1433 vput addrcodec res
+e
9 Dr.Sauer
(Ma
)Braten Dr.
(Heu
) <doog@def
>
1434 echo $?
/$^ERRNAME
$res
1435 eval vput addrcodec res d
$res
1436 echo $?
/$^ERRNAME
$res
1437 vput addrcodec res
+e
10 (Ma
)Braten Dr.
(Heu
) <doog@def
>
1438 echo $?
/$^ERRNAME
$res
1439 eval vput addrcodec res d
$res
1440 echo $?
/$^ERRNAME
$res
1441 vput addrcodec res
+e
11 (Ma
)Braten Dr
"." (Heu
) <doog@def
>
1442 echo $?
/$^ERRNAME
$res
1443 eval vput addrcodec res d
$res
1444 echo $?
/$^ERRNAME
$res
1445 vput addrcodec res
+e
12 Dr. Sauer
(Ma
) Braten Dr.
(u
) <doog@def
>
1446 echo $?
/$^ERRNAME
$res
1447 eval vput addrcodec res d
$res
1448 echo $?
/$^ERRNAME
$res
1449 vput addrcodec res
+e
13(Ma
)Braten Dr.
(Heu
) <doog@def
>
1450 echo $?
/$^ERRNAME
$res
1451 eval vput addrcodec res d
$res
1452 echo $?
/$^ERRNAME
$res
1453 vput addrcodec res
+e
14 Hey
, Du
<doog@def
> Wie
() findet Dr. das?
()
1454 echo $?
/$^ERRNAME
$res
1455 eval vput addrcodec res d
$res
1456 echo $?
/$^ERRNAME
$res
1457 vput addrcodec res
+e
15 \
1458 Hey
, Du
<doog@def
> Wie
() findet
"" Dr.
"" das?
()
1459 echo $?
/$^ERRNAME
$res
1460 eval vput addrcodec res d
$res
1461 echo $?
/$^ERRNAME
$res
1462 vput addrcodec res
+e
16 \
1463 "Hey," "Du" <doog@def
> "Wie()" findet
"" Dr.
"" das?
()
1464 echo $?
/$^ERRNAME
$res
1465 eval vput addrcodec res d
$res
1466 echo $?
/$^ERRNAME
$res
1467 vput addrcodec res
+e
17 \
1468 "Hey" Du
<doog@def
> "Wie() findet " " Dr. """ das?
()
1469 echo $?
/$^ERRNAME
$res
1470 eval vput addrcodec res d
$res
1471 echo $?
/$^ERRNAME
$res
1472 vput addrcodec res
+e
18 \
1473 <doog@def
> "Hey" Du
"Wie() findet " " Dr. """ das?
()
1474 echo $?
/$^ERRNAME
$res
1475 eval vput addrcodec res d
$res
1476 echo $?
/$^ERRNAME
$res
1477 vput addrcodec res
+e
19 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1478 echo $?
/$^ERRNAME
$res
1479 eval vput addrcodec res d
$res
1480 echo $?
/$^ERRNAME
$res
1482 vput addrcodec res
++e
20 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1483 echo $?
/$^ERRNAME
$res
1484 vput addrcodec res
++e
21 Hey\
,\"" <doog@def> "Wie
()" findet \" Dr. \" das?
1485 echo $?/$^ERRNAME $res
1486 eval vput addrcodec res d $res
1487 echo $?/$^ERRNAME $res
1489 vput addrcodec res +++e 22 Hey\\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
1490 echo $?/$^ERRNAME $res
1491 eval vput addrcodec res d $res
1492 echo $?/$^ERRNAME $res
1494 vput addrcodec res s \
1495 "23 Hey
\\,\\\" \"Wie
" () "\" findet
\\\" Dr.
\\\" das?
" <doog@def>
1496 echo $?/$^ERRNAME $res
1499 check behave:addrcodec 0 "${MBOX}" '429099645 2414'
1507 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>/dev
/null
1508 vput vexpr res
= 9223372036854775807
1509 echo $?
/$^ERRNAME
$res
1510 vput vexpr res
= 9223372036854775808
1511 echo $?
/$^ERRNAME
$res
1512 vput vexpr res
=@
9223372036854775808
1513 echo $?
/$^ERRNAME
$res
1514 vput vexpr res
= -9223372036854775808
1515 echo $?
/$^ERRNAME
$res
1516 vput vexpr res
= -9223372036854775809
1517 echo $?
/$^ERRNAME
$res
1518 vput vexpr res
=@
-9223372036854775809
1519 echo $?
/$^ERRNAME
$res
1522 echo $?
/$^ERRNAME
$res
1524 echo $?
/$^ERRNAME
$res
1526 echo $?
/$^ERRNAME
$res
1528 vput vexpr res
+ 0 0
1529 echo $?
/$^ERRNAME
$res
1530 vput vexpr res
+ 0 1
1531 echo $?
/$^ERRNAME
$res
1532 vput vexpr res
+ 1 1
1533 echo $?
/$^ERRNAME
$res
1535 vput vexpr res
+ 9223372036854775807 0
1536 echo $?
/$^ERRNAME
$res
1537 vput vexpr res
+ 9223372036854775807 1
1538 echo $?
/$^ERRNAME
$res
1539 vput vexpr res
+@
9223372036854775807 1
1540 echo $?
/$^ERRNAME
$res
1541 vput vexpr res
+ 0 9223372036854775807
1542 echo $?
/$^ERRNAME
$res
1543 vput vexpr res
+ 1 9223372036854775807
1544 echo $?
/$^ERRNAME
$res
1545 vput vexpr res
+@
1 9223372036854775807
1546 echo $?
/$^ERRNAME
$res
1548 vput vexpr res
+ -9223372036854775808 0
1549 echo $?
/$^ERRNAME
$res
1550 vput vexpr res
+ -9223372036854775808 -1
1551 echo $?
/$^ERRNAME
$res
1552 vput vexpr res
+@
-9223372036854775808 -1
1553 echo $?
/$^ERRNAME
$res
1554 vput vexpr res
+ 0 -9223372036854775808
1555 echo $?
/$^ERRNAME
$res
1556 vput vexpr res
+ -1 -9223372036854775808
1557 echo $?
/$^ERRNAME
$res
1558 vput vexpr res
+@
-1 -9223372036854775808
1559 echo $?
/$^ERRNAME
$res
1561 vput vexpr res
- 0 0
1562 echo $?
/$^ERRNAME
$res
1563 vput vexpr res
- 0 1
1564 echo $?
/$^ERRNAME
$res
1565 vput vexpr res
- 1 1
1566 echo $?
/$^ERRNAME
$res
1568 vput vexpr res
- 9223372036854775807 0
1569 echo $?
/$^ERRNAME
$res
1570 vput vexpr res
- 9223372036854775807 -1
1571 echo $?
/$^ERRNAME
$res
1572 vput vexpr res
-@
9223372036854775807 -1
1573 echo $?
/$^ERRNAME
$res
1574 vput vexpr res
- 0 9223372036854775807
1575 echo $?
/$^ERRNAME
$res
1576 vput vexpr res
- -1 9223372036854775807
1577 echo $?
/$^ERRNAME
$res
1578 vput vexpr res
- -2 9223372036854775807
1579 echo $?
/$^ERRNAME
$res
1580 vput vexpr res
-@
-2 9223372036854775807
1581 echo $?
/$^ERRNAME
$res
1583 vput vexpr res
- -9223372036854775808 +0
1584 echo $?
/$^ERRNAME
$res
1585 vput vexpr res
- -9223372036854775808 +1
1586 echo $?
/$^ERRNAME
$res
1587 vput vexpr res
-@
-9223372036854775808 +1
1588 echo $?
/$^ERRNAME
$res
1589 vput vexpr res
- 0 -9223372036854775808
1590 echo $?
/$^ERRNAME
$res
1591 vput vexpr res
- +1 -9223372036854775808
1592 echo $?
/$^ERRNAME
$res
1593 vput vexpr res
-@
+1 -9223372036854775808
1594 echo $?
/$^ERRNAME
$res
1596 vput vexpr res
+ -13 -2
1597 echo $?
/$^ERRNAME
$res
1598 vput vexpr res
- 0 0
1599 echo $?
/$^ERRNAME
$res
1600 vput vexpr res
- 0 1
1601 echo $?
/$^ERRNAME
$res
1602 vput vexpr res
- 1 1
1603 echo $?
/$^ERRNAME
$res
1604 vput vexpr res
- -13 -2
1605 echo $?
/$^ERRNAME
$res
1607 vput vexpr res
* 0 0
1608 echo $?
/$^ERRNAME
$res
1609 vput vexpr res
* 0 1
1610 echo $?
/$^ERRNAME
$res
1611 vput vexpr res
* 1 1
1612 echo $?
/$^ERRNAME
$res
1613 vput vexpr res
* -13 -2
1614 echo $?
/$^ERRNAME
$res
1616 vput vexpr res
/ 0 0
1617 echo $?
/$^ERRNAME
$res
1618 vput vexpr res
/ 0 1
1619 echo $?
/$^ERRNAME
$res
1620 vput vexpr res
/ 1 1
1621 echo $?
/$^ERRNAME
$res
1622 vput vexpr res
/ -13 -2
1623 echo $?
/$^ERRNAME
$res
1625 vput vexpr res
% 0 0
1626 echo $?
/$^ERRNAME
$res
1627 vput vexpr res
% 0 1
1628 echo $?
/$^ERRNAME
$res
1629 vput vexpr res
% 1 1
1630 echo $?
/$^ERRNAME
$res
1631 vput vexpr res
% -13 -2
1632 echo $?
/$^ERRNAME
$res
1635 check behave
:vexpr-numeric
0 "${MBOX}" '1723609217 1048'
1637 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1638 vput vexpr res find 'bananarama' 'nana'
1639 echo $?/$^ERRNAME :$res:
1640 vput vexpr res find 'bananarama' 'bana'
1641 echo $?/$^ERRNAME :$res:
1642 vput vexpr res find 'bananarama' 'Bana'
1643 echo $?/$^ERRNAME :$res:
1644 vput vexpr res find 'bananarama' 'rama'
1645 echo $?/$^ERRNAME :$res:
1647 vput vexpr res ifind 'bananarama' 'nana'
1648 echo $?/$^ERRNAME :$res:
1649 vput vexpr res ifind 'bananarama' 'bana'
1650 echo $?/$^ERRNAME :$res:
1651 vput vexpr res ifind 'bananarama' 'Bana'
1652 echo $?/$^ERRNAME :$res:
1653 vput vexpr res ifind 'bananarama' 'rama'
1654 echo $?/$^ERRNAME :$res:
1656 vput vexpr res substring 'bananarama' 1
1657 echo $?/$^ERRNAME :$res:
1658 vput vexpr res substring 'bananarama' 3
1659 echo $?/$^ERRNAME :$res:
1660 vput vexpr res substring 'bananarama' 5
1661 echo $?/$^ERRNAME :$res:
1662 vput vexpr res substring 'bananarama' 7
1663 echo $?/$^ERRNAME :$res:
1664 vput vexpr res substring 'bananarama' 9
1665 echo $?/$^ERRNAME :$res:
1666 vput vexpr res substring 'bananarama' 10
1667 echo $?/$^ERRNAME :$res:
1668 vput vexpr res substring 'bananarama' 1 3
1669 echo $?/$^ERRNAME :$res:
1670 vput vexpr res substring 'bananarama' 3 3
1671 echo $?/$^ERRNAME :$res:
1672 vput vexpr res substring 'bananarama' 5 3
1673 echo $?/$^ERRNAME :$res:
1674 vput vexpr res substring 'bananarama' 7 3
1675 echo $?/$^ERRNAME :$res:
1676 vput vexpr res substring 'bananarama' 9 3
1677 echo $?/$^ERRNAME :$res:
1678 vput vexpr res substring 'bananarama' 10 3
1679 echo $?/$^ERRNAME :$res:
1683 check behave:vexpr-string 0 "${MBOX}" '265398700 267'
1685 if have_feat regex; then
1686 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" #2>/dev/null
1687 vput vexpr res regex
'bananarama' 'nana'
1688 echo $?
/$^ERRNAME
:$res:
1689 vput vexpr res regex
'bananarama' 'bana'
1690 echo $?
/$^ERRNAME
:$res:
1691 vput vexpr res regex
'bananarama' 'Bana'
1692 echo $?
/$^ERRNAME
:$res:
1693 vput vexpr res regex
'bananarama' 'rama'
1694 echo $?
/$^ERRNAME
:$res:
1696 vput vexpr res iregex
'bananarama' 'nana'
1697 echo $?
/$^ERRNAME
:$res:
1698 vput vexpr res iregex
'bananarama' 'bana'
1699 echo $?
/$^ERRNAME
:$res:
1700 vput vexpr res iregex
'bananarama' 'Bana'
1701 echo $?
/$^ERRNAME
:$res:
1702 vput vexpr res iregex
'bananarama' 'rama'
1703 echo $?
/$^ERRNAME
:$res:
1705 vput vexpr res regex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1706 echo $?
/$^ERRNAME
:$res:
1707 vput vexpr res regex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1708 echo $?
/$^ERRNAME
:$res:
1709 vput vexpr res regex
'bananarama' 'Bana(.+)' '\$1\$0'
1710 echo $?
/$^ERRNAME
:$res:
1711 vput vexpr res regex
'bananarama' '(.+)rama' '\$1\$0'
1712 echo $?
/$^ERRNAME
:$res:
1714 vput vexpr res iregex
'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1715 echo $?
/$^ERRNAME
:$res:
1716 vput vexpr res iregex
'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1717 echo $?
/$^ERRNAME
:$res:
1718 vput vexpr res iregex
'bananarama' 'Bana(.+)' '\$1\$0'
1719 echo $?
/$^ERRNAME
:$res:
1720 vput vexpr res iregex
'bananarama' '(.+)rama' '\$1\$0'
1721 echo $?
/$^ERRNAME
:$res:
1725 check behave
:vexpr-regex
0 "${MBOX}" '3270360157 311'
1727 printf 'behave:vexpr-regex: unsupported, skipped\n'
1733 t_behave_call_ret
() {
1736 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1741 vput vexpr j '&' $i 7
1747 vput vexpr j '&' $i 7
1753 echo ! The end for $1
1757 # Transport $?/$! up the call chain
1763 wysh set i=$? j=$! k=$^ERRNAME
1767 echo ! The end for $1
1768 return $i $^ERR-BUSY
1772 # Up and down it goes
1779 vput vexpr k - $1 $2
1783 echo "# <$i/$j> .. "
1787 eval echon
"<\$1=\$i/\$^ERRNAME-$j "
1790 echo ! The end
for $1=$i/$2
1794 return $i $^ERR-BUSY
1800 call w1
0; echo ?
=$?
!=$
!; echo -----;
1801 call w2
0; echo ?
=$?
!=$^ERRNAME
; echo -----;
1802 call w3
0 1; echo ?
=$?
!=$^ERRNAME
; echo -----;
1805 check behave
:call_ret
0 "${MBOX}" '1572045517 5922'
1813 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
1818 vput vexpr j '&' $i 7
1824 echo ! The end for $1/$2
1826 return $i $^ERR-BUSY
1837 echo ?=$? !=$^ERRNAME
1840 echo ?=$? !=$^ERRNAME
1842 echo ?=$? !=$^ERRNAME
1845 check behave:xcall-1 0 "${MBOX}" '728629184 19115'
1849 ${cat} <<- '__EOT' > "${BODY}"
1854 vput vexpr j '&' $i 7
1860 echo ! The end for $1
1863 echo would be err with errexit
1872 echo zwei, ?=$? !=$!
1873 localopts yes; set errexit
1875 echo drei, ?=$? !=$^ERRNAME
1877 echo vier, ?=$? !=$^ERRNAME, this is an error
1880 echo outer 1, ?=$? !=$^ERRNAME
1882 echo outer 2, ?=$? !=$^ERRNAME, could be error if xxxign non-empty
1884 echo outer 3, ?=$? !=$^ERRNAME
1885 echo this is definitely an error
1888 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign ignerr' -Snomemdebug \
1890 check behave
:xcall-2
0 "${MBOX}" '3900716531 4200'
1892 < "${BODY}" ${MAILX} ${ARGS} -X'commandalias xxxign " "' -Snomemdebug \
1894 check behave:xcall-3 1 "${MBOX}" '1006776201 2799'
1899 t_behave_vpospar() {
1902 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1903 vpospar
set hey
, "'you ", world
!
1904 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1905 vput vpospar x quote
; echo x
<$x>
1906 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1907 vput vpospar y quote
;echo y
<$y>
1908 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1909 eval vpospar
set ${y};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1910 eval vpospar
set ${x};echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1913 echo infun2
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1914 vput vpospar z quote
;echo infun2
:z
<$z>
1918 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1919 vput vpospar y quote
;echo infun
:y
<$y>
1920 eval vpospar
set ${x};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1921 vpospar
clear;echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1923 echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1924 eval vpospar
set ${y};echo infun
:$?
/$^ERRNAME
/$#:$
*/"$@"/<$1><$2><$3><$4>
1927 call infun This
"in a" fun
1928 echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1929 vpospar
clear;echo $?
/$^ERRNAME
/$#: $
* / "$@" / <$1><$2><$3><$4>
1931 check behave
:vpospar-1
0 "${MBOX}" '155175639 866'
1934 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} > "${MBOX}" 2>&1
1936 echo ifs<$ifs> ifs-ws<$ifs-ws>
1937 vpospar set hey, "'you ", world!
1938 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1939 vput vpospar x quote; echo x<$x>
1940 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1941 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1944 echo ifs<$ifs> ifs-ws<$ifs-ws>
1945 vpospar set hey, "'you
", world!
1946 echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
1947 vput vpospar x quote; echo x<$x>
1948 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
1949 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@
" / <$1><$2><$3><$4>
1952 echo ifs<$ifs> ifs-ws<$ifs-ws>
1953 vpospar set hey, "'you ", world!
1954 echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1955 vput vpospar x quote; echo x<$x>
1956 vpospar clear;echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1957 eval vpospar set ${x};echo $?/$^ERRNAME/$#: $* / "$@" / <$1><$2><$3><$4>
1959 check behave:vpospar-ifs 0 "${MBOX}" '2015927702 706'
1966 TRAP_EXIT_ADDONS="./.t*"
1968 ${cat} <<- '__EOT
' > .tin
1969 hey1, "'you
", world!
1970 hey2, "'you ", bugs bunny!
1975 ${cat} <<- '__EOT
' |\
1976 ${MAILX} ${ARGS} -X'readctl create ./.tin' > "${MBOX}" 2>&1
1978 echo $?/$^ERRNAME / <$a><$b><$c>
1980 echo $?/$^ERRNAME / <$a><$b><$c>
1982 echo $?/$^ERRNAME / <$a><$b><$c>
1984 echo $?/$^ERRNAME / <$a><$b><$c>
1986 echo $?/$^ERRNAME / <$a><$b><$c>
1987 readctl remove ./.tin;echo readctl remove:$?/$^ERRNAME
1989 check behave:read-1 0 "${MBOX}" '1527910147 173'
1991 ${cat} <<- '__EOT
' > .tin2
1992 hey2.0,:"'you
",:world!:mars.:
1993 hey2.1,:"'you ",:world!
1994 hey2.2,:"'you
",:bugs bunny!
2000 ${cat} <<- '__EOT' |\
2001 6< .tin2 ${MAILX} ${ARGS} -X 'readctl create 6' > "${MBOX}" 2>&1
2004 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2006 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2008 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2010 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2012 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2014 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2016 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2018 echo $?
/$^ERRNAME
/ <$a><$b><$c>
2019 readctl remove
6;echo readctl remove
:$?
/$^ERRNAME
2021 check behave
:read-ifs
0 "${MBOX}" '890153490 298'
2028 TRAP_EXIT_ADDONS
="./.t*"
2032 while [ ${i} -lt 112 ]; do
2033 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
2034 "${MBOX}" "${i}" "${i}"
2037 ) |
${MAILX} ${ARGS}
2038 check behave
:mbox-1
0 "${MBOX}" '1140119864 13780'
2044 ' "${MBOX}" .tmbox1 .tmbox1 |
2045 ${MAILX} ${ARGS} > .tlst
2046 check behave
:mbox-2
0 .tlst
'2739893312 9103'
2052 ' "${MBOX}" .tmbox2 .tmbox2 |
2053 ${MAILX} ${ARGS} > .tlst
2054 check behave
:mbox-3
0 .tlst
'1702194178 9110'
2056 # only the odd (even)
2058 printf 'File "file://%s"
2061 while [ ${i} -lt 112 ]; do
2063 [ ${j} -eq 1 ] && printf '%s ' "${i}"
2070 ) |
${MAILX} ${ARGS} > .tlst
2071 check behave
:mbox-4
0 .tmbox3
'631132924 6890'
2072 check behave
:mbox-5
- .tlst
'2960975049 4573'
2075 printf 'file "file://%s"
2078 while [ ${i} -lt 112 ]; do
2080 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
2088 ' .tmbox3 .tmbox3 .tmbox2
2089 ) | ${MAILX} ${ARGS} > .tlst
2090 check behave:mbox-6 0 .tmbox3 '1387070539 13655'
2091 ${sed} 2d < .tlst > .tlstx
2092 check behave:mbox-7 - .tlstx '2729940494 13645'
2099 TRAP_EXIT_ADDONS=".
/.t
*"
2101 ${cat} <<-_EOT > ./.tsendmail.sh
2103 (echo 'From Hippocastanum Mon Jun 19 15:07:07 2017' && ${cat} && echo
2106 chmod 0755 ./.tsendmail.sh
2108 ${cat} <<- '__EOT' | ${MAILX} ${ARGS} -Smta=./.tsendmail.sh > ./.tall 2>&1
2110 alias a1 ex2@a1.ple "EX3
<ex3@a1.ple
>"
2112 alias a2 ex1@a2.ple ex2@a2.ple ex3@a2.ple ex4@a2.ple
2114 alias a4 a5 ex1@a4.ple
2116 alias a6 a7 ex1@a6.ple
2130 check behave:alias-1 0 "${MBOX}" '2496925843 272'
2131 check behave:alias-2 - .tall '3548953204 152'
2133 # TODO t_behave_alias: n_ALIAS_MAXEXP is compile-time constant,
2134 # TODO need to somehow provide its contents to the test, then test
2139 t_behave_filetype() {
2141 TRAP_EXIT_ADDONS=".
/.t
*"
2143 ${cat} <<-_EOT > ./.tsendmail.sh
2145 (echo 'From Alchemilla Wed Apr 25 15:12:13 2017' && ${cat} && echo
2148 chmod 0755 ./.tsendmail.sh
2150 printf 'm m1@e.t\nL1\nHy1\n~.\nm m2@e.t\nL2\nHy2\n~@ ./snailmail.jpg\n~.\n' |
2151 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2152 check behave:filetype-1 0 "${MBOX}" '1645747150 13536'
2154 if command -v gzip >/dev/null 2>&1; then
2157 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2158 copy 2 ./.t.mbox.gz' "${MBOX}" |
2160 -X'filetype gz gzip\ -dc gzip\ -c'
2161 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2163 -X'filetype gz gzip\ -dc gzip\ -c'
2165 check behave:filetype-2 0 ".
/.t.mbox
" '1645747150 13536'
2167 echo 'behave:filetype-2: unsupported, skipped'
2172 printf 'File "%s
"\ncopy 1 ./.t.mbox.gz
2178 -X'filetype gz gzip\ -dc gzip\ -c' \
2179 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" \
2180 "echo eins
;echo zwei
;echo und mit
${sed} bist Du dabei
;${cat}"'
2181 printf 'File ./.t.mbox.gz\ncopy * ./.t.mbox\n' |
2183 -X'filetype gz gzip\ -dc gzip\ -c' \
2184 -X'filetype mbox.gz "${sed} 1,3d|
${cat}" kill\ 0'
2187 check behave:filetype-3 - ".
/.t.mbox
" '238021003 27092'
2192 t_behave_record_a_resend() {
2194 TRAP_EXIT_ADDONS=".
/.t.record .
/.t.resent
"
2198 m %s\n~s Subject 1.\nHello.\n~.
2199 set record-files add-file-recipients
2200 m %s\n~s Subject 2.\nHello.\n~.
2202 resend 2 ./.t.resent
2203 Resend 1 ./.t.resent
2205 resend 2 ./.t.resent
2206 Resend 1 ./.t.resent
2207 ' ./.t.record "${MBOX}" "${MBOX}" "${MBOX}" |
2210 check behave:record_a_resend-1 0 "${MBOX}" '3057873538 256'
2211 check behave:record_a_resend-2 - .t.record '391356429 460'
2212 check behave:record_a_resend-3 - .t.resent '2685231691 648'
2217 t_behave_e_H_L_opts() {
2219 TRAP_EXIT_ADDONS=".
/.tsendmail.sh .
/.t.mbox
"
2222 ${MAILX} ${ARGS} -ef ./.t.mbox
2223 echo ${?} > "${MBOX}"
2225 ${cat} <<-_EOT > ./.tsendmail.sh
2227 (echo 'From Alchemilla Wed Apr 07 17:03:33 2017' && ${cat} && echo
2230 chmod 0755 ./.tsendmail.sh
2231 printf 'm me@exam.ple\nLine 1.\nHello.\n~.\n' |
2232 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2233 printf 'm you@exam.ple\nLine 1.\nBye.\n~.\n' |
2234 ${MAILX} ${ARGS} -Smta=./.tsendmail.sh
2236 ${MAILX} ${ARGS} -ef ./.t.mbox
2237 echo ${?} >> "${MBOX}"
2238 ${MAILX} ${ARGS} -efL @t@me ./.t.mbox
2239 echo ${?} >> "${MBOX}"
2240 ${MAILX} ${ARGS} -efL @t@you ./.t.mbox
2241 echo ${?} >> "${MBOX}"
2242 ${MAILX} ${ARGS} -efL '@>@Line 1' ./.t.mbox
2243 echo ${?} >> "${MBOX}"
2244 ${MAILX} ${ARGS} -efL '@>@Hello.' ./.t.mbox
2245 echo ${?} >> "${MBOX}"
2246 ${MAILX} ${ARGS} -efL '@>@Bye.' ./.t.mbox
2247 echo ${?} >> "${MBOX}"
2248 ${MAILX} ${ARGS} -efL '@>@Good bye.' ./.t.mbox
2249 echo ${?} >> "${MBOX}"
2251 ${MAILX} ${ARGS} -fH ./.t.mbox >> "${MBOX}"
2252 echo ${?} >> "${MBOX}"
2253 ${MAILX} ${ARGS} -fL @t@me ./.t.mbox >> "${MBOX}"
2254 echo ${?} >> "${MBOX}"
2255 ${MAILX} ${ARGS} -fL @t@you ./.t.mbox >> "${MBOX}"
2256 echo ${?} >> "${MBOX}"
2257 ${MAILX} ${ARGS} -fL '@>@Line 1' ./.t.mbox >> "${MBOX}"
2258 echo ${?} >> "${MBOX}"
2259 ${MAILX} ${ARGS} -fL '@>@Hello.' ./.t.mbox >> "${MBOX}"
2260 echo ${?} >> "${MBOX}"
2261 ${MAILX} ${ARGS} -fL '@>@Bye.' ./.t.mbox >> "${MBOX}"
2262 echo ${?} >> "${MBOX}"
2263 ${MAILX} ${ARGS} -fL '@>@Good bye.' ./.t.mbox >> "${MBOX}" 2>/dev
/null
2264 echo ${?} >> "${MBOX}"
2266 check behave
:e_H_L_opts
- "${MBOX}" '1708955574 678'
2271 t_behave_compose_hooks
() {
2273 TRAP_EXIT_ADDONS
="./.t*"
2275 (echo line one
&&echo line two
&&echo line three
) > .
/.treadctl
2276 (echo echo four
&&echo echo five
&&echo echo six
) > .
/.tattach
2278 ${cat} <<-_EOT > ./.tsendmail.sh
2281 (echo 'From PrimulaVeris Wed Apr 10 22:59:00 2017' && ${cat}) > "${MBOX}"
2283 chmod 0755 .
/.tsendmail.sh
2285 ${cat} <<'__EOT__' > ./.trc
2287 vput vexpr es substr "$1" 0 1
2289 echoerr "Failed: $2. Bailing out"; echo "~x"
2292 define read_mline_res {
2293 read hl; wysh set len=$? es=$! en=$^ERRNAME;\
2294 echo $len/$es/$^ERRNAME: $hl
2295 if [ $es -ne $^ERR-NONE ]
2296 echoerr "read_mline_res: bailing out"; echo "~x"
2298 \xcall read_mline_res
2303 echo "~^header list"; read hl; echo $hl;\
2304 call xerr "$hl" "in_addr ($xh) 0-1"
2306 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2307 read es; echo $es; call xerr "$es" "ins_addr $xh 1-1"
2308 echo "~^header insert $xh <${xh}2@exam.ple>";\
2309 read es; echo $es; call xerr "$es" "ins_addr $xh 1-2"
2310 echo "~^header insert $xh ${xh}3@exam.ple";\
2311 read es; echo $es; call xerr "$es" "ins_addr $xh 1-3"
2312 echo "~^header list $xh"; read hl; echo $hl;\
2313 call xerr "$hl" "ins_addr $xh 1-4"
2314 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 1-5"
2317 if [ "$t_remove" == "" ]
2321 echo "~^header remove $xh"; read es; call xerr $es "ins_addr $xh 2-1"
2322 echo "~^header remove $xh"; read es; vput vexpr es substr $es 0 3
2324 echoerr "Failed: ins_addr $xh 2-2"; echo "~x"
2326 echo "~^header list $xh"; read es; vput vexpr es substr $es 0 3
2328 echoerr "Failed: ins_addr $xh 2-3"; echo "~x"
2330 echo "~^header show $xh"; read es; vput vexpr es substr $es 0 3
2332 echoerr "Failed: ins_addr $xh 2-4"; echo "~x"
2336 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2337 read es; echo $es; call xerr "$es" "ins_addr $xh 3-1"
2338 echo "~^header insert $xh <${xh}2@exam.ple>";\
2339 read es; echo $es; call xerr "$es" "ins_addr $xh 3-2"
2340 echo "~^header insert $xh ${xh}3@exam.ple";\
2341 read es; echo $es; call xerr "$es" "ins_addr $xh 3-3"
2342 echo "~^header list $xh"; read hl; echo $hl;\
2343 call xerr "$hl" "ins_addr $xh 3-4"
2344 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 3-5"
2347 echo "~^header remove-at $xh 1"; read es;\
2348 call xerr $es "ins_addr $xh 3-6"
2349 echo "~^header remove-at $xh 1"; read es;\
2350 call xerr $es "ins_addr $xh 3-7"
2351 echo "~^header remove-at $xh 1"; read es;\
2352 call xerr $es "ins_addr $xh 3-8"
2353 echo "~^header remove-at $xh 1"; read es;\
2354 vput vexpr es substr $es 0 3
2356 echoerr "Failed: ins_addr $xh 3-9"; echo "~x"
2358 echo "~^header remove-at $xh T"; read es;\
2359 vput vexpr es substr $es 0 3
2361 echoerr "Failed: ins_addr $xh 3-10"; echo "~x"
2363 echo "~^header list $xh"; read es;\
2364 vput vexpr es substr $es 0 3
2366 echoerr "Failed: ins_addr $xh 3-11"; echo "~x"
2368 echo "~^header show $xh"; read es;\
2369 vput vexpr es substr $es 0 3
2371 echoerr "Failed: ins_addr $xh 3-12"; echo "~x"
2375 echo "~^header insert $xh diet <$xh@exam.ple> spliced";\
2376 read es; echo $es; call xerr "$es" "ins_addr $xh 4-1"
2377 echo "~^header insert $xh <${xh}2@exam.ple> (comment) \"Quot(e)d\"";\
2378 read es; echo $es; call xerr "$es" "ins_addr $xh 4-2"
2379 echo "~^header insert $xh ${xh}3@exam.ple";\
2380 read es; echo $es; call xerr "$es" "ins_addr $xh 4-3"
2381 echo "~^header list $xh"; read hl; echo $hl;\
2382 call xerr "$hl" "header list $xh 3-4"
2383 echo "~^header show $xh"; read es; call xerr $es "ins_addr $xh 4-5"
2386 echo "~^header remove-at $xh 3"; read es;\
2387 call xerr $es "ins_addr $xh 4-6"
2388 echo "~^header remove-at $xh 2"; read es;\
2389 call xerr $es "ins_addr $xh 4-7"
2390 echo "~^header remove-at $xh 1"; read es;\
2391 call xerr $es "ins_addr $xh 4-8"
2392 echo "~^header remove-at $xh 1"; read es;\
2393 vput vexpr es substr $es 0 3
2395 echoerr "Failed: ins_addr $xh 4-9"; echo "~x"
2397 echo "~^header remove-at $xh T"; read es;\
2398 vput vexpr es substr $es 0 3
2400 echoerr "Failed: ins_addr $xh 4-10"; echo "~x"
2402 echo "~^header list $xh"; read es;\
2403 vput vexpr es substr $es 0 3
2405 echoerr "Failed: ins_addr $xh 4-11"; echo "~x"
2407 echo "~^header show $xh"; read es;\
2408 vput vexpr es substr $es 0 3
2410 echoerr "Failed: ins_addr $xh 4-12"; echo "~x"
2414 wysh set xh=$1 mult=$2
2415 echo "~^header list"; read hl; echo $hl;\
2416 call xerr "$hl" "ins_ref ($xh) 0-1"
2418 echo "~^header insert $xh <$xh@exam.ple>";\
2419 read es; echo $es; call xerr "$es" "ins_ref $xh 1-1"
2421 echo "~^header insert $xh <${xh}2@exam.ple>";\
2422 read es; echo $es; call xerr "$es" "ins_ref $xh 1-2"
2423 echo "~^header insert $xh ${xh}3@exam.ple";\
2424 read es; echo $es; call xerr "$es" "ins_ref $xh 1-3"
2426 echo "~^header insert $xh <${xh}2@exam.ple>"; read es;\
2427 vput vexpr es substr $es 0 3
2429 echoerr "Failed: ins_ref $xh 1-4"; echo "~x"
2433 echo "~^header list $xh"; read hl; echo $hl;\
2434 call xerr "$hl" "ins_ref $xh 1-5"
2435 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 1-6"
2438 if [ "$t_remove" == "" ]
2442 echo "~^header remove $xh"; read es;\
2443 call xerr $es "ins_ref $xh 2-1"
2444 echo "~^header remove $xh"; read es;\
2445 vput vexpr es substr $es 0 3
2447 echoerr "Failed: ins_ref $xh 2-2"; echo "~x"
2449 echo "~^header list $xh"; read es;\
2450 vput vexpr es substr $es 0 3
2452 echoerr "Failed: $es ins_ref $xh 2-3"; echo "~x"
2454 echo "~^header show $xh"; read es;\
2455 vput vexpr es substr $es 0 3
2457 echoerr "Failed: ins_ref $xh 2-4"; echo "~x"
2461 echo "~^header insert $xh <$xh@exam.ple>";\
2462 read es; echo $es; call xerr "$es" "ins_ref $xh 3-1"
2464 echo "~^header insert $xh <${xh}2@exam.ple>";\
2465 read es; echo $es; call xerr "$es" "ins_ref $xh 3-2"
2466 echo "~^header insert $xh ${xh}3@exam.ple";\
2467 read es; echo $es; call xerr "$es" "ins_ref $xh 3-3"
2469 echo "~^header list $xh";\
2470 read hl; echo $hl; call xerr "$hl" "ins_ref $xh 3-4"
2471 echo "~^header show $xh";\
2472 read es; call xerr $es "ins_ref $xh 3-5"
2475 echo "~^header remove-at $xh 1"; read es;\
2476 call xerr $es "ins_ref $xh 3-6"
2477 if [ $mult -ne 0 ] && [ $xh != subject ]
2478 echo "~^header remove-at $xh 1"; read es;\
2479 call xerr $es "ins_ref $xh 3-7"
2480 echo "~^header remove-at $xh 1"; read es;\
2481 call xerr $es "ins_ref $xh 3-8"
2483 echo "~^header remove-at $xh 1"; read es;\
2484 vput vexpr es substr $es 0 3
2486 echoerr "Failed: ins_ref $xh 3-9"; echo "~x"
2488 echo "~^header remove-at $xh T"; read es;\
2489 vput vexpr es substr $es 0 3
2491 echoerr "Failed: ins_ref $xh 3-10"; echo "~x"
2493 echo "~^header show $xh"; read es;\
2494 vput vexpr es substr $es 0 3
2496 echoerr "Failed: ins_ref $xh 3-11"; echo "~x"
2500 echo "~^header insert $xh <$xh@exam.ple> ";\
2501 read es; echo $es; call xerr "$es" "ins_ref $xh 4-1"
2503 echo "~^header insert $xh <${xh}2@exam.ple> ";\
2504 read es; echo $es; call xerr "$es" "ins_ref $xh 4-2"
2505 echo "~^header insert $xh ${xh}3@exam.ple";\
2506 read es; echo $es; call xerr "$es" "ins_ref $xh 4-3"
2508 echo "~^header list $xh"; read hl; echo $hl;\
2509 call xerr "$hl" "ins_ref $xh 4-4"
2510 echo "~^header show $xh"; read es; call xerr $es "ins_ref $xh 4-5"
2513 if [ $mult -ne 0 ] && [ $xh != subject ]
2514 echo "~^header remove-at $xh 3"; read es;\
2515 call xerr $es "ins_ref $xh 4-6"
2516 echo "~^header remove-at $xh 2"; read es;\
2517 call xerr $es "ins_ref $xh 4-7"
2519 echo "~^header remove-at $xh 1"; read es;\
2520 call xerr $es "ins_ref $xh 4-8"
2521 echo "~^header remove-at $xh 1"; read es;\
2522 vput vexpr es substr $es 0 3
2524 echoerr "Failed: ins_ref $xh 4-9"; echo "~x"
2526 echo "~^header remove-at $xh T"; read es;\
2527 vput vexpr es substr $es 0 3
2529 echoerr "Failed: ins_ref $xh 4-10"; echo "~x"
2531 echo "~^header show $xh"; read es;\
2532 vput vexpr es substr $es 0 3
2534 echoerr "Failed: ins_ref $xh 4-11"; echo "~x"
2539 # In collect.c order
2541 call ins_ref sender 0 # Not a "ref", but works
2545 call ins_addr reply-To
2546 call ins_addr mail-Followup-to
2547 call ins_ref messAge-id 0
2548 call ins_ref rEfErEncEs 1
2549 call ins_ref in-Reply-to 1
2550 call ins_ref subject 1 # Not a "ref", but works (with tweaks)
2551 call ins_addr freeForm1
2552 call ins_addr freeform2
2558 echo "~^attachment";\
2559 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2561 echoerr "Failed: attach 0-1"; echo "~x"
2564 echo "~^attach attribute ./.treadctl";\
2565 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2567 echoerr "Failed: attach 0-2"; echo "~x"
2569 echo "~^attachment attribute-at 1";\
2570 read hl; echo $hl; vput vexpr es substr "$hl" 0 3
2572 echoerr "Failed: attach 0-3"; echo "~x"
2575 echo "~^attachment insert ./.treadctl=ascii";\
2576 read hl; echo $hl; call xerr "$hl" "attach 1-1"
2577 echo "~^attachment list";\
2578 read es; echo $es;call xerr "$es" "attach 1-2"
2580 echo "~^attachment attribute ./.treadctl";\
2581 read es; echo $es;call xerr "$es" "attach 1-3"
2583 echo "~^attachment attribute .treadctl";\
2584 read es; echo $es;call xerr "$es" "attach 1-4"
2586 echo "~^attachment attribute-at 1";\
2587 read es; echo $es;call xerr "$es" "attach 1-5"
2590 echo "~^attachment attribute-set ./.treadctl filename rctl";\
2591 read es; echo $es;call xerr "$es" "attach 1-6"
2592 echo "~^attachment attribute-set .treadctl content-description Au";\
2593 read es; echo $es;call xerr "$es" "attach 1-7"
2594 echo "~^attachment attribute-set-at 1 content-id <10.du@ich>";\
2595 read es; echo $es;call xerr "$es" "attach 1-8"
2597 echo "~^attachment attribute ./.treadctl";\
2598 read es; echo $es;call xerr "$es" "attach 1-9"
2600 echo "~^attachment attribute .treadctl";\
2601 read es; echo $es;call xerr "$es" "attach 1-10"
2603 echo "~^attachment attribute rctl";\
2604 read es; echo $es;call xerr "$es" "attach 1-11"
2606 echo "~^attachment attribute-at 1";\
2607 read es; echo $es;call xerr "$es" "attach 1-12"
2611 echo "~^attachment insert ./.tattach=latin1";\
2612 read hl; echo $hl; call xerr "$hl" "attach 2-1"
2613 echo "~^attachment list";\
2614 read es; echo $es;call xerr "$es" "attach 2-2"
2616 echo "~^attachment attribute ./.tattach";\
2617 read es; echo $es;call xerr "$es" "attach 2-3"
2619 echo "~^attachment attribute .tattach";\
2620 read es; echo $es;call xerr "$es" "attach 2-4"
2622 echo "~^attachment attribute-at 2";\
2623 read es; echo $es;call xerr "$es" "attach 2-5"
2626 echo "~^attachment attribute-set ./.tattach filename tat";\
2627 read es; echo $es;call xerr "$es" "attach 2-6"
2629 "~^attachment attribute-set .tattach content-description Au2";\
2630 read es; echo $es;call xerr "$es" "attach 2-7"
2631 echo "~^attachment attribute-set-at 2 content-id <20.du@wir>";\
2632 read es; echo $es;call xerr "$es" "attach 2-8"
2634 "~^attachment attribute-set-at 2 content-type application/x-sh";\
2635 read es; echo $es;call xerr "$es" "attach 2-9"
2637 echo "~^attachment attribute ./.tattach";\
2638 read es; echo $es;call xerr "$es" "attach 2-10"
2640 echo "~^attachment attribute .tattach";\
2641 read es; echo $es;call xerr "$es" "attach 2-11"
2643 echo "~^attachment attribute tat";\
2644 read es; echo $es;call xerr "$es" "attach 2-12"
2646 echo "~^attachment attribute-at 2";\
2647 read es; echo $es;call xerr "$es" "attach 2-13"
2651 if [ "$t_remove" == "" ]
2655 echo "~^attachment remove ./.treadctl"; read es;\
2656 call xerr $es "attach 3-1"
2657 echo "~^attachment remove ./.tattach"; read es;\
2658 call xerr $es "attach 3-2"
2659 echo "~^ attachment remove ./.treadctl"; read es;\
2660 vput vexpr es substr $es 0 3
2662 echoerr "Failed: attach 3-3"; echo "~x"
2664 echo "~^ attachment remove ./.tattach"; read es;\
2665 vput vexpr es substr $es 0 3
2667 echoerr "Failed: attach 3-4"; echo "~x"
2669 echo "~^attachment list"; read es;\
2670 vput vexpr es substr $es 0 3
2672 echoerr "Failed: attach 3-5"; echo "~x"
2676 echo "~^attachment insert ./.tattach=latin1";\
2677 read hl; echo $hl; call xerr "$hl" "attach 4-1"
2678 echo "~^attachment insert ./.tattach=latin1";\
2679 read hl; echo $hl; call xerr "$hl" "attach 4-2"
2680 echo "~^attachment list";\
2681 read es; echo $es;call xerr "$es" "attach 4-3"
2683 echo "~^ attachment remove .tattach"; read es;\
2684 vput vexpr es substr $es 0 3
2686 echoerr "Failed: attach 4-4 $es"; echo "~x"
2688 echo "~^attachment remove-at T"; read es;\
2689 vput vexpr es substr $es 0 3
2691 echoerr "Failed: attach 4-5"; echo "~x"
2693 echo "~^attachment remove ./.tattach"; read es;\
2694 call xerr $es "attach 4-6"
2695 echo "~^attachment remove ./.tattach"; read es;\
2696 call xerr $es "attach 4-7"
2697 echo "~^ attachment remove ./.tattach"; read es;\
2698 vput vexpr es substr $es 0 3
2700 echoerr "Failed: attach 4-8 $es"; echo "~x"
2702 echo "~^attachment list"; read es;\
2703 vput vexpr es substr $es 0 3
2705 echoerr "Failed: attach 4-9"; echo "~x"
2709 echo "~^attachment insert ./.tattach=latin1";\
2710 read hl; echo $hl; call xerr "$hl" "attach 5-1"
2711 echo "~^attachment insert ./.tattach=latin1";\
2712 read hl; echo $hl; call xerr "$hl" "attach 5-2"
2713 echo "~^attachment insert ./.tattach=latin1";\
2714 read hl; echo $hl; call xerr "$hl" "attach 5-3"
2715 echo "~^attachment list";\
2716 read es; echo $es;call xerr "$es" "attach 5-4"
2719 echo "~^attachment remove-at 3"; read es;\
2720 call xerr $es "attach 5-5"
2721 echo "~^attachment remove-at 3"; read es;\
2722 vput vexpr es substr $es 0 3
2724 echoerr "Failed: attach 5-6"; echo "~x"
2726 echo "~^attachment remove-at 2"; read es;\
2727 call xerr $es "attach 5-7"
2728 echo "~^attachment remove-at 2"; read es;\
2729 vput vexpr es substr $es 0 3
2731 echoerr "Failed: attach 5-8"; echo "~x"
2733 echo "~^attachment remove-at 1"; read es;\
2734 call xerr $es "attach 5-9"
2735 echo "~^attachment remove-at 1"; read es;\
2736 vput vexpr es substr $es 0 3
2738 echoerr "Failed: attach 5-10"; echo "~x"
2741 echo "~^attachment list"; read es;\
2742 vput vexpr es substr $es 0 3
2744 echoerr "Failed: attach 5-11"; echo "~x"
2748 echo "~^attachment insert ./.tattach=latin1";\
2749 read hl; echo $hl; call xerr "$hl" "attach 6-1"
2750 echo "~^attachment insert ./.tattach=latin1";\
2751 read hl; echo $hl; call xerr "$hl" "attach 6-2"
2752 echo "~^attachment insert ./.tattach=latin1";\
2753 read hl; echo $hl; call xerr "$hl" "attach 6-3"
2754 echo "~^attachment list";\
2755 read es; echo $es;call xerr "$es" "attach 6-4"
2758 echo "~^attachment remove-at 1"; read es;\
2759 call xerr $es "attach 6-5"
2760 echo "~^attachment remove-at 1"; read es;\
2761 call xerr $es "attach 6-6"
2762 echo "~^attachment remove-at 1"; read es;\
2763 call xerr $es "attach 6-7"
2764 echo "~^attachment remove-at 1"; read es;\
2765 vput vexpr es substr $es 0 3
2767 echoerr "Failed: attach 6-8"; echo "~x"
2770 echo "~^attachment list"; read es;\
2771 vput vexpr es substr $es 0 3
2773 echoerr "Failed: attach 6-9"; echo "~x"
2782 if [ "$t_remove" != "" ]
2783 echo "~^ header insert to -"; read es;\
2784 call xerr "$es" "reinstantiate of a To:"
2788 wysh set on-compose-splice=t_ocs
2794 printf 'm this-goes@nowhere\nbody\n!.\n' |
2795 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
2796 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
2798 ${cat} .
/.terr
>> "${MBOX}"
2799 check behave
:compose_hooks-1
0 "${MBOX}" '3958208025 8236'
2802 printf 'm -\nbody\n!.\n' |
2803 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! -Sstealthmua=noagent \
2804 -St_remove=1 -X'source ./.trc' -Smta=.
/.tsendmail.sh \
2805 > "${MBOX}" 2>.
/.terr
2806 ${cat} .
/.terr
>> "${MBOX}"
2807 check behave
:compose_hooks-2
0 "${MBOX}" '231191826 11104'
2809 # Some state machine stress, shell compose hook, etc.
2811 printf 'm hook-test@exam.ple\nbody\n!.\nvar t_oce t_ocs t_ocs_shell t_ocl' |
2812 ${MAILX} ${ARGS} -Snomemdebug -Sescape=! \
2813 -Smta=.
/.tsendmail.sh \
2816 vput vexpr i + 1 "$2"
2818 vput vexpr j % $i 10
2825 eval \\$j _work $1 $i
2828 vput vexpr i + $i "$1"
2832 read line;wysh set es=$? en=$^ERRNAME ; echo read:$es/$en: $line
2833 if [ "${es}" -ne -1 ]
2836 readctl remove $cwd/.treadctl; echo readctl remove:$?/$^ERRNAME
2841 echo "~^header list"; read hl; echo $hl;\
2842 vput vexpr es substr "$hl" 0 1
2844 echoerr "Failed to header list, aborting send"; echo "~x"
2847 call _work 1; echo $?
2848 echo "~^header insert cc splicy diet <splice@exam.ple> spliced";\
2849 read es; echo $es; vput vexpr es substr "$es" 0 1
2851 echoerr "Failed to be diet, aborting send"; echo "~x"
2853 echo "~^header insert cc <splice2@exam.ple>";\
2854 read es; echo $es; vput vexpr es substr "$es" 0 1
2856 echoerr "Failed to be diet2, aborting send"; echo "~x"
2859 call _work 2; echo $?
2860 echo "~^header insert bcc juicy juice <juice@exam.ple> spliced";\
2861 read es; echo $es;vput vexpr es substr "$es" 0 1
2863 echoerr "Failed to be juicy, aborting send"; echo "~x"
2865 echo "~^header insert bcc juice2@exam.ple";\
2866 read es; echo $es;vput vexpr es substr "$es" 0 1
2868 echoerr "Failed to be juicy2, aborting send"; echo "~x"
2870 echo "~^header insert bcc juice3 <juice3@exam.ple>";\
2871 read es; echo $es;vput vexpr es substr "$es" 0 1
2873 echoerr "Failed to be juicy3, aborting send"; echo "~x"
2875 echo "~^header insert bcc juice4@exam.ple";\
2876 read es; echo $es;vput vexpr es substr "$es" 0 1
2878 echoerr "Failed to be juicy4, aborting send"; echo "~x"
2881 echo "~^header remove-at bcc 3";\
2882 read es; echo $es;vput vexpr es substr "$es" 0 1
2884 echoerr "Failed to remove juicy3, aborting send"; echo "~x"
2886 echo "~^header remove-at bcc 2";\
2887 read es; echo $es;vput vexpr es substr "$es" 0 1
2889 echoerr "Failed to remove juicy2, aborting send"; echo "~x"
2891 echo "~^header remove-at bcc 3";\
2892 read es; echo $es;vput vexpr es substr "$es" 0 3
2894 echoerr "Failed to failed to remove-at, aborting send"; echo "~x"
2896 # Add duplicates which ought to be removed!
2897 echo "~^header insert bcc juice4@exam.ple";\
2898 read es; echo $es;vput vexpr es substr "$es" 0 1
2900 echoerr "Failed to be juicy4-1, aborting send"; echo "~x"
2902 echo "~^header insert bcc juice4@exam.ple";\
2903 read es; echo $es;vput vexpr es substr "$es" 0 1
2905 echoerr "Failed to be juicy4-2, aborting send"; echo "~x"
2907 echo "~^header insert bcc juice4@exam.ple";\
2908 read es; echo $es;vput vexpr es substr "$es" 0 1
2910 echoerr "Failed to be juicy4-3, aborting send"; echo "~x"
2914 call _work 3; echo $?
2916 vput ! i echo just knock if you can hear me;\
2918 while [ $i -lt 24 ]; do printf "%s " $i; i=`expr $i + 1`; done;\
2920 echon shell-cmd says $?/$^ERRNAME: $i
2921 echo "~x will not become interpreted, we are reading until __EOT"
2924 call _work 4; echo $?
2925 vput cwd cwd;echo cwd:$?
2926 readctl create $cwd/.treadctl ;echo readctl:$?/$^ERRNAME
2929 call _work 5; echo $?
2932 set t_oce autobcc=oce@exam.ple
2935 set t_ocl autocc=ocl@exam.ple
2937 wysh set on-compose-splice=t_ocs \
2938 on-compose-splice-shell="read ver;printf \"t_ocs-shell\\n\
2939 ~t shell@exam.ple\\n~:set t_ocs_shell\\n\"" \
2940 on-compose-enter=t_oce on-compose-leave=t_ocl
2942 ex0_test behave
:compose_hooks-3
2943 ${cat} .
/.tnotes
>> "${MBOX}"
2945 check behave
:compose_hooks-3
- "${MBOX}" '678882154 1071'
2950 t_behave_mime_types_load_control
() {
2952 TRAP_EXIT_ADDONS
="./.t*"
2954 ${cat} <<-_EOT > ./.tmts1
2955 @ application/mathml+xml mathml
2957 ${cat} <<-_EOT > ./.tmts2
2958 @ x-conference/x-cooltalk ice
2960 @ application/aga-aga aga
2963 ${cat} <<-_EOT > ./.tmts1.mathml
2964 <head>nonsense ML</head>
2966 ${cat} <<-_EOT > ./.tmts2.ice
2969 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.doom
2970 printf 'of which the c\x01rack is coming soon' > .
/.tmtsx.aga
2984 ' "${MBOX}" "${MBOX}" |
2986 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts2 \
2988 ex0_test behave
:mime_types_load_control
2990 ${cat} "${MBOX}" >> .
/.tout
2991 check behave
:mime_types_load_control-1
- .
/.tout
'529577037 2474'
2993 echo type |
${MAILX} ${ARGS} -R \
2994 -Smimetypes-load-control=f
=.
/.tmts1
,f
=.
/.tmts3 \
2995 -f "${MBOX}" >> .
/.tout
2>&1
2996 check behave
:mime_types_load_control-2
0 .
/.tout
'2025926659 3558'
3002 have_feat smime ||
{
3003 echo 'behave:s/mime: unsupported, skipped'
3008 TRAP_EXIT_ADDONS
="./.t.conf ./.tkey.pem ./.tcert.pem ./.tpair.pem"
3009 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.VERIFY ./.DECRYPT ./.ENCRYPT"
3010 TRAP_EXIT_ADDONS
="${TRAP_EXIT_ADDONS} ./.tsendmail.sh"
3012 printf 'behave:s/mime: .. generating test key and certificate ..\n'
3013 ${cat} <<-_EOT > ./.t.conf
3016 default_keyfile = keyfile.pem
3017 distinguished_name = req_distinguished_name
3018 attributes = req_attributes
3022 [ req_distinguished_name ]
3029 emailAddress = test@localhost
3034 openssl req
-x509 -nodes -days 3650 -config .
/.t.conf \
3035 -newkey rsa
:1024 -keyout .
/.tkey.pem
-out .
/.tcert.pem
>/dev
/null
2>&1
3036 ${cat} .
/.tkey.pem .
/.tcert.pem
> .
/.tpair.pem
3039 printf 'behave:s/mime:sign/verify: '
3040 echo bla |
${MAILX} ${ARGS} \
3041 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3042 -Ssmime-sign -Sfrom=test@localhost \
3043 -s 'S/MIME test' .
/.VERIFY
3044 if [ $?
-eq 0 ]; then
3055 /^Content-Description: /{ skip = 2; print; next }
3056 /^$/{ if(skip) --skip }
3059 < .
/.VERIFY
> "${MBOX}"
3060 check behave
:s
/mime
:sign
/verify
:checksum
- "${MBOX}" '2900817158 648'
3062 printf 'behave:s/mime:sign/verify:verify '
3063 printf 'verify\nx\n' |
3065 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3066 -Ssmime-sign -Sfrom=test@localhost \
3068 -f .
/.VERIFY
>/dev
/null
2>&1
3069 if [ $?
-eq 0 ]; then
3078 printf 'behave:s/mime:sign/verify:disproof-1 '
3079 if openssl smime
-verify -CAfile .
/.tcert.pem \
3080 -in .
/.VERIFY
>/dev
/null
2>&1; then
3089 # (signing +) encryption / decryption
3090 ${cat} <<-_EOT > ./.tsendmail.sh
3092 (echo 'From Euphrasia Thu Apr 27 17:56:23 2017' && ${cat}) > ./.ENCRYPT
3094 chmod 0755 .
/.tsendmail.sh
3096 printf 'behave:s/mime:encrypt+sign: '
3099 -Ssmime-force-encryption \
3100 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3101 -Smta=.
/.tsendmail.sh \
3102 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3103 -Ssmime-sign -Sfrom=test@localhost \
3104 -s 'S/MIME test' recei@ver.com
3105 if [ $?
-eq 0 ]; then
3109 printf 'error: encrypt+sign failed\n'
3112 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3113 check behave
:s
/mime
:encrypt
+sign
:checksum
- "${MBOX}" '1937410597 327'
3115 printf 'behave:s/mime:decrypt+verify: '
3116 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
3118 -Ssmime-force-encryption \
3119 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3120 -Smta=.
/.tsendmail.sh \
3121 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3122 -Ssmime-sign -Sfrom=test@localhost \
3124 -f .
/.ENCRYPT
>/dev
/null
2>&1
3125 if [ $?
-eq 0 ]; then
3134 /^Content-Description: /{ skip = 2; print; next }
3135 /^$/{ if(skip) --skip }
3138 < .
/.DECRYPT
> "${MBOX}"
3139 check behave
:s
/mime
:decrypt
+verify
:checksum
- "${MBOX}" '1720739247 931'
3141 printf 'behave:s/mime:decrypt+verify:disproof-1: '
3142 if (openssl smime
-decrypt -inkey .
/.tkey.pem
-in .
/.ENCRYPT |
3143 openssl smime
-verify -CAfile .
/.tcert.pem
) >/dev
/null
2>&1; then
3150 printf "behave:s/mime:encrypt: "
3151 echo bla |
${MAILX} ${ARGS} \
3152 -Ssmime-force-encryption \
3153 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3154 -Smta=.
/.tsendmail.sh \
3155 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3156 -Sfrom=test@localhost \
3157 -s 'S/MIME test' recei@ver.com
3158 if [ $?
-eq 0 ]; then
3165 # Same as behave:s/mime:encrypt+sign:checksum above
3166 ${sed} -e '/^$/,$d' < .
/.ENCRYPT
> "${MBOX}"
3167 check behave
:s
/mime
:encrypt
:checksum
- "${MBOX}" '1937410597 327'
3170 printf 'decrypt ./.DECRYPT\nx\n' |
${MAILX} ${ARGS} \
3171 -Ssmime-force-encryption \
3172 -Ssmime-encrypt-recei@ver.com
=.
/.tpair.pem \
3173 -Smta=.
/.tsendmail.sh \
3174 -Ssmime-ca-file=.
/.tcert.pem
-Ssmime-sign-cert=.
/.tpair.pem \
3175 -Sfrom=test@localhost \
3177 -f .
/.ENCRYPT
>/dev
/null
2>&1
3178 check behave
:s
/mime
:decrypt
0 "./.DECRYPT" '2624716890 422'
3180 printf 'behave:s/mime:decrypt:disproof-1: '
3181 if openssl smime
-decrypt -inkey .
/.tkey.pem \
3182 -in .
/.ENCRYPT
>/dev
/null
2>&1; then
3192 t_behave_maildir
() {
3194 TRAP_EXIT_ADDONS
="./.t*"
3198 while [ ${i} -lt 112 ]; do
3199 printf 'm file://%s\n~s Subject %s\nHello %s!\n~.\n' \
3200 "${MBOX}" "${i}" "${i}"
3203 ) |
${MAILX} ${ARGS}
3204 check behave
:maildir-1
0 "${MBOX}" '1140119864 13780'
3210 ' "${MBOX}" .tmdir1 .tmdir1 |
3211 ${MAILX} ${ARGS} -Snewfolders=maildir
> .tlst
3212 check behave
:maildir-2
0 .tlst
'1797938753 9103'
3215 copy * "maildir://%s"
3218 ' "${MBOX}" .tmdir2 .tmdir2 |
3219 ${MAILX} ${ARGS} > .tlst
3220 check behave
:maildir-3
0 .tlst
'1155631089 9113'
3222 printf 'File "maildir://%s"
3226 ' .tmdir2 .tmbox1 .tmbox1 |
3227 ${MAILX} ${ARGS} > .tlst
3228 check behave
:maildir-4
0 .tmbox1
'2646131190 13220'
3229 check behave
:maildir-5
- .tlst
'3701297796 9110'
3231 # only the odd (even)
3233 printf 'File "maildir://%s"
3236 while [ ${i} -lt 112 ]; do
3238 [ ${j} -eq 1 ] && printf '%s ' "${i}"
3245 ) |
${MAILX} ${ARGS} > .tlst
3246 check behave
:maildir-6
0 .tmbox2
'142890131 6610'
3247 check behave
:maildir-7
- .tlst
'960096773 4573'
3250 printf 'file "maildir://%s"
3253 while [ ${i} -lt 112 ]; do
3255 [ ${j} -eq 0 ] && [ ${i} -ne 0 ] && printf '%s ' "${i}"
3263 ' .tmbox2 .tmbox2 .tmdir2
3264 ) | ${MAILX} ${ARGS} > .tlst
3265 check behave:maildir-8 0 .tmbox2 '3806905791 13100'
3266 ${sed} 2d < .tlst > .tlstx
3267 check behave:maildir-9 - .tlstx '4216815295 13645'
3273 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
3274 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
3275 # Note we unfortunately need to place some statements without proper
3276 # indentation because of continuation problems
3280 # MIME encoding (QP) stress message body
3282 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
3283 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
3284 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
3285 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
3286 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
3287 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
3288 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
3289 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
3290 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
3291 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
3292 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
3293 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
3294 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
3295 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
3296 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
3297 "auf den zeilen vorher.
\r\n"\
3298 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
3300 "Die letzte Zeile war nur ein Punkt.
\r\n"\
3302 "Das waren deren zwei.
\r\n"\
3304 "Die letzte Zeile war ein Leerschritt.
\n"\
3305 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
3308 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
3310 "Das waren deren zwei. ditto.
\n"\
3312 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
3313 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
3314 "auf den zeilen vorher.
\n"\
3316 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
3317 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
3319 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3321 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3323 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3325 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3327 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
3329 "QP am Zeilenende über soft-nl hinweg
\n"\
3330 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3332 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3334 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3336 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
3338 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
3340 "Die letzte Zeile war ein Leerschritt.
\n"\
3344 # MIME encoding (QP) stress message subject
3345 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
3346 adadaddsssssssddddddddddddddddddddd\
3347 ddddddddddddddddddddddddddddddddddd\
3348 ddddddddddddddddddddddddddddddddddd\
3349 dddddddddddddddddddd Hallelulja? Od\
3350 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
3351 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
3352 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
3353 fffffffffffffffffffffffffffffffffff\
3354 fffffffffffffffffffff ggggggggggggg\
3355 ggggggggggggggggggggggggggggggggggg\
3356 ggggggggggggggggggggggggggggggggggg\
3357 ggggggggggggggggggggggggggggggggggg\
3360 # Three tests for MIME encoding and (a bit) content classification.
3361 # At the same time testing -q FILE, < FILE and -t FILE
3364 < "${BODY}" ${MAILX} ${ARGS} ${ADDARG_UNI} \
3365 -a "${BODY}" -s "${SUB}" "${MBOX}"
3366 check content
:001 0 "${MBOX}" '1145066634 6654'
3369 < /dev
/null
${MAILX} ${ARGS} ${ADDARG_UNI} \
3370 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
3371 check content
:002 0 "${MBOX}" '1145066634 6654'
3374 ( echo "To: ${MBOX}" && echo "Subject: ${SUB}" && echo &&
3376 ) |
${MAILX} ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
3377 check content:003 0 "${MBOX}" '1145066634 6654'
3379 # Test for [260e19d] (Juergen Daubert)
3381 echo body | ${MAILX} ${ARGS} "${MBOX}"
3382 check content
:004 0 "${MBOX}" '2917662811 98'
3384 # Sending of multiple mails in a single invocation
3386 ( printf "m ${MBOX}\n~s subject1\nE-Mail Körper 1\n~.\n" &&
3387 printf "m ${MBOX}\n~s subject2\nEmail body 2\n~.\n" &&
3389 ) |
${MAILX} ${ARGS} ${ADDARG_UNI}
3390 check content
:005 0 "${MBOX}" '2098659767 358'
3394 # "Test for" [d6f316a] (Gavin Troy)
3396 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
3397 ${MAILX} ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="@* ${cat}" > "${BODY}"
3398 check content:006 0 "${MBOX}" '2099098650 122'
3399 check content:006-1 - "${BODY}" '794542938 174'
3401 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
3404 for(i = 0; i < 10000; ++i)
3406 #printf "\xF0\x90\x87\x90"
3407 }' | ${MAILX} ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
3408 check content
:007 0 "${MBOX}" '534262374 61816'
3410 ## Test some more corner cases for header bodies (as good as we can today) ##
3414 echo |
${MAILX} ${ARGS} ${ADDARG_UNI} \
3415 -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̲' \
3417 check content
:008 0 "${MBOX}" '3370931614 375'
3419 # Single word (overlong line split -- bad standard! Requires injection of
3420 # artificial data!! But can be prevented by using RFC 2047 encoding)
3422 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
3423 echo |
${MAILX} ${ARGS} -s "${i}" "${MBOX}"
3424 check content:009 0 "${MBOX}" '489922370 1718'
3426 # Combination of encoded words, space and tabs of varying sort
3428 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3429 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
3430 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
3431 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
3432 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
3433 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
3435 check content:010 0 "${MBOX}" '1676887734 591'
3437 # Overlong multibyte sequence that must be forcefully split
3438 # todo This works even before v15.0, but only by accident
3440 echo | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3441 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3442 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
3443 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄
" \
3445 check content:011 0 "${MBOX}" '3029301775 659'
3449 echo | ${MAILX} ${ARGS} \
3450 -s "1-1 B2 B3 B4 B5 B6 B\
3451 1-2 B2 B3 B4 B5 B6 B\
3452 1-3 B2 B3 B4 B5 B6 B\
3453 1-4 B2 B3 B4 B5 B6 B\
3454 1-5 B2 B3 B4 B5 B6 B\
3455 1-6 B2 B3 B4 B5 B6
" \
3457 check content:012 0 "${MBOX}" '4126167195 297'
3459 # Leading and trailing WS
3461 echo | ${MAILX} ${ARGS} \
3462 -s " 2-1 B2 B3 B4 B5 B6 B\
3463 1-2 B2 B3 B4 B5 B6 B\
3464 1-3 B2 B3 B4 B5 B6 B\
3465 1-4 B2 B3 B4 B5 B6
" \
3467 check content:013 0 "${MBOX}" '3600624479 236'
3469 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
3470 # have a (better) test framework materialize a quick shot
3472 TRAP_EXIT_ADDONS=./.ttt
3474 mkdir ./.ttt || exit 1
3478 : > 'diet\ is \curd.txt'
3479 : > 'diet "is
" curd.txt'
3481 : > 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
3482 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
3483 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
3484 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
3486 echo bla | ${MAILX} ${ARGS} ${ADDARG_UNI} \
3487 -a ".
/.ttt
/ma
'ger.txt" -a "./.ttt/mä'ger.txt
" \
3488 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is
" curd.txt' \
3489 -a ./.ttt/höde-tröge.txt \
3490 -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 \
3491 -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 \
3492 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
3493 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
3495 check content:014-1 0 "${MBOX}" '684985954 3092'
3497 # `resend' test, reusing $MBOX
3499 printf "Resend
${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3500 check content:014-2 0 "${BODY}" '684985954 3092'
3503 printf "resend
${BODY}\nx\n" | ${MAILX} ${ARGS} -Rf "${MBOX}"
3504 check content:014-3 0 "${BODY}" '3130352658 3148'
3510 # if have_feat devel; then
3511 # ARGS="${ARGS} -Smemdebug"
3518 if [ -z "${CHECK_ONLY}" ]; then
3524 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'