2 #@ Usage: ./cc-test.sh [--check-only [s-nail-binary]]
5 ARGS
='-:/ -# -Sencoding=quoted-printable -Sstealthmua -Snosave -Sexpandaddr=restrict -Sdotlock-ignore-error'
10 #UTF8_LOCALE= autodetected unless set
12 if ( command -v command ) >/dev
/null
2>&1; then :; else
19 MAKE
="${MAKE:-`command -v make`}"
20 awk=${awk:-`command -v awk`}
21 cat=${cat:-`command -v cat`}
22 cksum=${cksum:-`command -v cksum`}
23 rm=${rm:-`command -v rm`}
24 sed=${sed:-`command -v sed`}
25 grep=${grep:-`command -v grep`}
29 export SNAIL ARGS CONF BODY MBOX MAIL MAKE
awk cat cksum rm sed grep
31 LC_ALL
=C LANG
=C ADDARG_UNI
=-Sttycharset=UTF-8
33 # Wed Oct 2 01:50:07 UTC 1996
34 SOURCE_DATE_EPOCH
=844221007
36 export LC_ALL LANG ADDARG_UNI TZ SOURCE_DATE_EPOCH
39 # Problem: force $SHELL to be a real shell. It seems some testing environments
40 # use nologin(?), but we need a real shell for command execution
41 if { echo ${SHELL} | ${grep} nologin; } >/dev
/null
2>&1; then
42 echo >&2 '$SHELL seems to be nologin, overwriting to /bin/sh!'
47 if [ -z "${UTF8_LOCALE}" ]; then
49 if command -v locale
>/dev
/null
2>&1; then
50 UTF8_LOCALE
=`locale -a | { m=
52 if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then
54 if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then
68 echo >&2 "Usage: ./cc-test.sh [--check-only [s-nail-binary]]"
74 [ "${1}" = --check-only ] || usage
75 [ ${#} -gt 2 ] && usage
76 [ ${#} -eq 2 ] && SNAIL
="${2}"
77 [ -x "${SNAIL}" ] || usage
82 trap "${rm} -rf \"${BODY}\" \"${MBOX}\" \${TRAP_EXIT_ADDONS}" EXIT
83 trap "exit 1" HUP INT TERM
86 # Test all configs TODO doesn't cover all *combinations*, stupid!
90 NOTME["OPT_AUTOCC"] = 1
91 NOTME["OPT_DEBUG"] = 1
92 NOTME["OPT_DEVEL"] = 1
93 NOTME["OPT_NOEXTMD5"] = 1
94 NOTME["OPT_NOMEMDBG"] = 1
99 sub(/^[[:space:]]*/, "")
100 # This bails for UnixWare 7.1.4 awk(1), but preceeding = with \
101 # does not seem to be a compliant escape for =
103 $1 = substr($1, 1, index($1, "=") - 1)
109 # Doing this completely sequentially and not doing make distclean in
110 # between runs should effectively result in lesser compilations.
111 # It is completely dumb nonetheless... TODO
112 for (j = 1; j < i; ++j) {
113 for (k = 1; k < j; ++k)
115 for (k = j; k < i; ++k)
117 printf "OPT_AUTOCC=1\n"
119 for (j = 1; j < i; ++j) {
120 for (k = 1; k < j; ++k)
122 for (k = j; k < i; ++k)
124 printf "OPT_AUTOCC=1\n"
127 for (j = 1; j < i; ++j) {
128 for (k = 1; k < j; ++k)
130 for (k = j; k < i; ++k)
132 printf "OPT_AUTOCC=1\n"
133 printf "OPT_DEBUG=1\n"
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"
141 printf "OPT_DEBUG=1\n"
144 printf "CONFIG=NULL OPT_AUTOCC=0\n"
145 printf "CONFIG=NULL OPT_AUTOCC=1\n"
146 printf "CONFIG=NULLI OPT_AUTOCC=0\n"
147 printf "CONFIG=NULLI OPT_AUTOCC=1\n"
148 printf "CONFIG=MINIMAL OPT_AUTOCC=0\n"
149 printf "CONFIG=MINIMAL OPT_AUTOCC=1\n"
150 printf "CONFIG=MEDIUM OPT_AUTOCC=0\n"
151 printf "CONFIG=MEDIUM OPT_AUTOCC=1\n"
152 printf "CONFIG=NETSEND OPT_AUTOCC=0\n"
153 printf "CONFIG=NETSEND OPT_AUTOCC=1\n"
154 printf "CONFIG=MAXIMAL OPT_AUTOCC=0\n"
155 printf "CONFIG=MAXIMAL OPT_AUTOCC=1\n"
156 printf "CONFIG=DEVEL OPT_AUTOCC=0\n"
157 printf "CONFIG=DEVEL OPT_AUTOCC=1\n"
158 printf "CONFIG=ODEVEL OPT_AUTOCC=0\n"
159 printf "CONFIG=ODEVEL OPT_AUTOCC=1\n"
162 printf "\n\n##########\n$c\n"
163 printf "\n\n##########\n$c\n" >&2
171 # Read mailbox $2, strip non-constant headers and MIME boundaries, query the
172 # cksum(1) of the resulting data and compare against the checksum $3
174 tid
=${1} f=${2} s=${3}
176 csum
="`${sed} -e '/^From /d' \
177 -e '/^ boundary=/d' -e '/^--=-=/d' < \"${f}\" \
178 -e '/^\[-- Message/d' | ${cksum}`";
179 if [ "${csum}" = "${s}" ]; then
183 printf 'error: checksum mismatch (got %s)\n' "${csum}"
188 ( "${SNAIL}" ${ARGS} -X'echo $features' -Xx | ${grep} +${1} ) >/dev/null 2>&1
192 # Basic (easily testable) behaviour tests
194 __behave_x_opt_input_command_stack
196 __behave_input_inject_semicolon_seq
200 __behave_macro_param_shift
205 # FIXME __behave_alias
207 # FIXME __behave_mlist
209 have_feat smime && __behave_smime
212 __behave_x_opt_input_command_stack() {
213 ${cat} <<- '__EOT' > "${BODY}"
221 echo "define mac1
{";\
222 echo " echo mac1-1 via1 \
$0";\
224 echo " echo mac1-2
";\
226 echo " echo mac1-3
";\
229 echo "define mac2
{";\
230 echo " echo mac2-1 via1 \
$0";\
232 echo " echo mac2-2
";\
238 echo echo 1-1-1 via1 \
$0;\
250 # The -X option supports multiline arguments, and those can internally use
251 # reverse solidus newline escaping. And all -X options are joined...
253 < "${BODY}" "${SNAIL}" ${ARGS} \
268 echo "define mac1 {";\
269 echo " echo mac1-1 via2 \$0";\
271 echo " echo mac1-2";\
273 echo " echo mac1-3";\
276 echo "define mac2 {";\
277 echo " echo mac2-1 via2 \$0";\
279 echo " echo mac2-2";\
285 echo echo 1-1-1 via2 \$0;\
297 ' > "${MBOX}" 2>/dev
/null
342 cksum_test behave
:x_opt_input_command_stack
"${MBOX}" '1391275936 378'
346 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} -Snomemdebug > "${MBOX}" 2>&1
351 vput vexpr j '&' $i 7
357 echo ! The end for $1
369 cksum_test behave:xcall "${MBOX}" '1717228546 9555'
373 ${cat} <<- '__EOT' > "${BODY}"
392 echo 'a${DIET}b${TIED}c\${DIET}d\${TIED}e' # COMMENT
393 echo "a${DIET}b${TIED}c\${DIET}d\${TIED}e"
394 echo $
'a${DIET}b${TIED}c\${DIET}d\${TIED}e'
396 echo a$
'\101\0101\x41\u0041\u41\U00000041\U41'c
397 echo a$
'\u0041\u41\u0C1\U00000041\U41'c
420 echo a$
'b\U0000000'dt
421 echo a$
'b\U00000000'du
431 if [ -z "${UTF8_LOCALE}" ]; then
432 echo 'Skip behave:wysh_unicode, no UTF8_LOCALE'
434 < "${BODY}" DIET
=CURD TIED
= \
435 LC_ALL
=${UTF8_LOCALE} "${SNAIL}" ${ARGS} 2>/dev/null > "${MBOX}"
451 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
452 #aCURDbc${DIET}d${TIED}e
453 #a${DIET}b${TIED}cCURDde
482 cksum_test behave
:wysh_unicode
"${MBOX}" '475805847 317'
485 < "${BODY}" DIET=CURD TIED= "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev
/null
501 #a${DIET}b${TIED}c\${DIET}d\${TIED}e
502 #aCURDbc${DIET}d${TIED}e
503 #a${DIET}b${TIED}cCURDde
532 cksum_test behave
:wysh_c
"${MBOX}" '1473887148 321'
535 __behave_input_inject_semicolon_seq
() {
536 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
541 echon this_is_mymac;call mydeepmac;echon ';';
543 echon one';';~mymac;echon two";";call mymac;echo three$';';
545 echon this_is_mymac;call mydeepmac;echon ,TOO'!;';
547 echon one';';~mymac;echon two";";call mymac;echo three$';';
549 #one;this_is_mymac(mydeepmac);two;this_is_mymac(mydeepmac);three;
550 #one;this_is_mymac(mydeepmac),TOO!;two;this_is_mymac(mydeepmac),TOO!;three;
551 cksum_test behave:input_inject_semicolon_seq "${MBOX}" '512117110 140'
555 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
563 ghost XxXxXx
echo huhu
564 ghost XxXxXxX
echo huhu
572 cksum_test behave
:ghost
"${MBOX}" '776950759 26'
577 # Nestable conditions test
578 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
600 if $dietcurd == 'yoho'
605 if $dietcurd != 'yoho'
666 if $dietcurd == 'yohu'
668 elif $dietcurd == 'yoha'
670 elif $dietcurd == 'yohe'
672 elif $dietcurd == 'yoho'
674 if $dietcurd == 'yohu'
676 elif $dietcurd == 'yoha'
678 elif $dietcurd == 'yohe'
680 elif $dietcurd == 'yoho'
682 if $dietcurd == 'yohu'
684 elif $dietcurd == 'yoha'
686 elif $dietcurd == 'yohe'
688 elif $dietcurd == 'yoho'
699 # integer conversion, <..>..
802 set diet=abc curd=abc
808 set diet=abc curd=abcd
814 # 1. Shitty grouping capabilities as of today
815 unset diet curd ndefined
816 if [ [ false ] || [ false ] || [ true ] ] && [ [ false ] || [ true ] ] && \
822 if [ [ [ [ 0 ] || [ 1 ] ] && [ [ 1 ] || [ 0 ] ] ] && [ 1 ] ] && [ yes ]
827 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] ]
832 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] ]
837 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] && [ no ]
842 if [ [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] || [ [ 1 ] ] || [ 1 ] ] \
848 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
853 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 0 ] ]
858 if [ [ [ [ [ [ [ 1 ] ] && [ 1 ] ] && [ 0 ] ] && [ 1 ] ] ] && [ 1 ] ]
863 if [ [ [ [ [ [ [ 0 ] ] && [ 1 ] ] && [ 1 ] ] && [ 1 ] ] ] && [ 1 ] ]
868 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 0 ]
873 if [ 1 ] || [ 0 ] || [ 0 ] || [ 0 ] && [ 1 ]
878 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ]
883 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 1 ]
888 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 0 ]
893 if [ 0 ] || [ 0 ] || [ 0 ] || [ 1 ] && [ 0 ] || [ 1 ] && [ 1 ]
899 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
905 if [ [ $diet == 'yo' ] && [ $curd == 'ho' ] ] && [ $ndefined ]
910 # 2. Shitty grouping capabilities as of today
911 unset diet curd ndefined
912 if [ false || false || true ] && [ false || true ] && yes
917 if [ [ [ 0 || 1 ] && [ 1 || 0 ] ] && 1 ] && [ yes ]
922 if [ 1 || 0 || 0 || 0 ]
927 if [ 1 || 0 || 0 || 0 || [ 1 ] ]
932 if [ 1 || 0 || 0 || 0 || [ 1 ] || 1 ] && no
937 if [ 1 || 0 || 0 || 0 || 1 || [ 1 ] ] && no || [ yes ]
942 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && 1 ] ] && [ 1 ] ]
947 if [ [ [ [ [ [ 1 ] && 1 ] && 1 ] && [ 1 ] ] ] && 0 ]
952 if [ [ [ [ [ [ [ 1 ] ] && 1 ] && 0 ] && [ 1 ] ] ] && 1 ]
957 if [ [ [ [ [ [ 0 ] && 1 ] && 1 ] && 1 ] ] && 1 ]
962 if 1 || 0 || 0 || 0 && 0
967 if 1 || 0 || 0 || 0 && 1
972 if 0 || 0 || 0 || 1 && 0
977 if 0 || 0 || 0 || 1 && 1
982 if 0 || 0 || 0 || 1 && 0 || 1 && 0
987 if 0 || 0 || 0 || 1 && 0 || 1 && 1
993 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
998 if $diet == 'yo' && $curd == 'ho' && $ndefined
1004 if [ $diet == 'yo' && $curd == 'ho' ] && $ndefined
1009 if $diet == 'yo' && $curd == 'ho' && $ndefined
1014 if [ [ [ [ [ [ $diet == 'yo' && $curd == 'ho' && $ndefined ] ] ] ] ] ]
1019 # Some more en-braced variables
1021 if ${diet} == ${curd}
1026 if ${diet} != ${curd}
1042 if ! 0 && ! ! 1 && ! ! ! ! 2 && 3
1047 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ ! 2 ] ] ] && 3
1052 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1057 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1062 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ [ ! [ ! [ ! [ 2 ] ] ] ] ] && ! 3
1067 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1072 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] && 3
1077 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ 2 ] ] ] ] ] || 3
1082 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! ! [ 2 ] ] ] ] ]
1088 if ! 0 && ! ! 1 && ! ! ! 0 && 3
1093 if ! 0 && ! [ ! 1 ] && ! [ ! [ ! [ 0 ] ] ] && 3
1098 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ [ 0 ] ] ] ] ] && 3
1103 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! ! [ ! [ ! 0 ] ] ] ] && ! 3
1108 if [ ! 0 ] && [ ! [ ! 1 ] ] && ! [ ! [ ! [ ! [ ! 0 ] ] ] ] && 3
1113 if [ ! 0 ] && ! [ ! [ ! 1 ] ] && [ ! ! [ ! [ ! [ ! [ 0 ] ] ] ] ] && 3
1118 if ! [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! ! 0 ] ] ] ] && 3
1123 if [ ! 0 ] && [ ! [ ! 1 ] ] && [ ! [ ! [ ! [ ! [ ! 0 ] ] ] ] ] || 3
1128 if [ ! 0 ] && [ ! ! [ ! ! 1 ] ] && [ ! ! [ ! ! [ ! ! [ ! [ 0 ] ] ] ] ]
1134 cksum_test behave:if-normal "${MBOX}" '557629289 631'
1136 if have_feat regex; then
1137 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1139 if $dietcurd =~
'^yo.*'
1144 if $dietcurd =~
'^yoho.+'
1149 if $dietcurd !~
'.*ho$'
1154 if $dietcurd !~
'.+yoho$'
1159 if [ $dietcurd !~
'.+yoho$' ]
1164 if ! [ $dietcurd =~
'.+yoho$' ]
1169 if ! ! [ $dietcurd !~
'.+yoho$' ]
1174 if ! [ ! [ $dietcurd !~
'.+yoho$' ] ]
1179 if [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
1184 if ! [ ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
1189 if ! ! ! $dietcurd !~
'.+yoho$'
1194 if ! ! ! $dietcurd =~
'.+yoho$'
1199 if ! [ ! ! [ ! [ $dietcurd !~
'.+yoho$' ] ] ]
1204 set diet
=abc curd
='^abc$'
1210 set diet
=abc curd
='^abcd$'
1217 cksum_test behave
:if-regex
"${MBOX}" '439960016 81'
1221 __behave_localopts
() {
1222 # Nestable conditions test
1223 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1238 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1243 echo $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2
1244 echo "$gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t2"
1253 echo active trouble: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1255 echo active null: $gv1 $lv1 ${lv2} ${lv3} ${gv2}, $t3
1261 #gv1 lv1 lv2 lv3 gv2, t2
1269 #gv1 lv1 lv2 lv3 gv2, t2
1272 #active trouble: gv1 gv2,
1274 cksum_test behave:localopts "${MBOX}" '1936527193 192'
1277 __behave_macro_param_shift() {
1278 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev
/null
1281 echo t2.0 has
$#/${#} parameters: "$1,${2},$3" (${*}) [$@
]
1286 echo t2.1 has
$#/${#} parameters: "$1,${2},$3" (${*}) [$@
]
1287 if [ $# > 1 ] ||
[ $ignerr == '' ]
1292 echo t2.2
:$? has
$#/${#} parameters: "$1,${2},$3" (${*}) [$@
]
1294 echo t2.3
:$? has
$#/${#} parameters: "$1,${2},$3" (${*}) [$@
]
1298 echo t2.4
:$? has
$#/${#} parameters: "$1,${2},$3" (${*}) [$@
]
1302 call t2
1 you get four args
1303 echo t1.1
: $?
';' ignerr
($ignerr) should not exist
1304 call t2
1 you get
'three args'
1305 echo t1.2
: $?
';' ignerr
($ignerr) should not exist
1306 call t2
1 you
'get two args'
1307 echo t1.3
: $?
';' ignerr
($ignerr) should not exist
1308 call t2
1 'you get one arg'
1309 echo t1.4
: $?
';' ignerr
($ignerr) should not exist
1310 ignerr call t2
'' 'you get one arg'
1311 echo t1.5
: $?
';' ignerr
($ignerr) should not exist
1317 #t2.0 has 5/5 parameters: 1,you,get (1 you get four args) [1 you get four args]
1318 #t2.1 has 4/4 parameters: you,get,four (you get four args) [you get four args]
1319 #t2.2:0 has 2/2 parameters: four,args, (four args) [four args]
1320 #t2.3:0 has 2/2 parameters: four,args, (four args) [four args]
1321 #t2.4:0 has 1/1 parameters: args,, (args) [args]
1322 #t1.1: 0; ignerr () should not exist
1324 #t2.0 has 4/4 parameters: 1,you,get (1 you get three args) [1 you get three args]
1325 #t2.1 has 3/3 parameters: you,get,three args (you get three args) [you get three args]
1326 #t2.2:0 has 1/1 parameters: three args,, (three args) [three args]
1327 #t2.3:0 has 1/1 parameters: three args,, (three args) [three args]
1328 #t2.4:0 has 0/0 parameters: ,, () []
1329 #t1.2: 0; ignerr () should not exist
1331 #t2.0 has 3/3 parameters: 1,you,get two args (1 you get two args) [1 you get two args]
1332 #t2.1 has 2/2 parameters: you,get two args, (you get two args) [you get two args]
1333 #t2.2:0 has 0/0 parameters: ,, () []
1334 #t2.3:0 has 0/0 parameters: ,, () []
1335 #t2.4:0 has 0/0 parameters: ,, () []
1336 #t1.3: 0; ignerr () should not exist
1338 #t2.0 has 2/2 parameters: 1,you get one arg, (1 you get one arg) [1 you get one arg]
1339 #t2.1 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1340 #t2.2:0 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1341 #t2.3:0 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1342 #t2.4:0 has 0/0 parameters: ,, () []
1343 #t1.4: 0; ignerr () should not exist
1345 #t2.0 has 2/2 parameters: ,you get one arg, ( you get one arg) [ you get one arg]
1346 #t2.1 has 1/1 parameters: you get one arg,, (you get one arg) [you get one arg]
1347 #t1.5: 1; ignerr () should not exist
1348 cksum_test behave
:macro_param_shift
"${MBOX}" '1402489146 1682'
1351 __behave_addrcodec
() {
1352 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}"
1353 vput addrcodec res e 1 <doog@def>
1355 eval vput addrcodec res d $res
1357 vput addrcodec res e 2 . <doog@def>
1359 eval vput addrcodec res d $res
1361 vput addrcodec res e 3 Sauer Dr. <doog@def>
1363 eval vput addrcodec res d $res
1365 vput addrcodec res e 4 Sauer (Ma) Dr. <doog@def>
1367 eval vput addrcodec res d $res
1369 vput addrcodec res e 5 Sauer (Ma) Braten Dr. <doog@def>
1371 eval vput addrcodec res d $res
1373 vput addrcodec res e 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1375 eval vput addrcodec res d $res
1377 vput addrcodec res e 7 Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu)
1379 eval vput addrcodec res d $res
1381 vput addrcodec res e 8 \
1382 Dr. Sauer (Ma) Braten Dr. (Heu) <doog@def> (bu) Boom. Boom
1384 eval vput addrcodec res d $res
1386 vput addrcodec res e 9 Dr.Sauer(Ma)Braten Dr. (Heu) <doog@def>
1388 eval vput addrcodec res d $res
1390 vput addrcodec res e 10 (Ma)Braten Dr. (Heu) <doog@def>
1392 eval vput addrcodec res d $res
1394 vput addrcodec res e 11 (Ma)Braten Dr".
" (Heu) <doog@def>
1396 eval vput addrcodec res d $res
1398 vput addrcodec res e 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1400 eval vput addrcodec res d $res
1402 vput addrcodec res e 13(Ma)Braten Dr. (Heu) <doog@def>
1404 eval vput addrcodec res d $res
1406 vput addrcodec res e 14 Hey, Du <doog@def> Wie() findet Dr. das? ()
1408 eval vput addrcodec res d $res
1410 vput addrcodec res e 15 \
1411 Hey, Du <doog@def> Wie() findet "" Dr. "" das? ()
1413 eval vput addrcodec res d $res
1415 vput addrcodec res e 16 \
1416 "Hey
," "Du
" <doog@def> "Wie
()" findet "" Dr. "" das? ()
1418 eval vput addrcodec res d $res
1420 vput addrcodec res e 17 "Hey
" Du <doog@def> "Wie
() findet
" " Dr.
""" das? ()
1422 eval vput addrcodec res d $res
1424 vput addrcodec res e 18 <doog@def> "Hey
" Du "Wie
() findet
" " Dr.
""" das? ()
1426 eval vput addrcodec res d $res
1428 vput addrcodec res e 19 Hey\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
1430 eval vput addrcodec res d $res
1432 vput addrcodec res +e 20 Hey\,\" <doog@def> "Wie
()" findet \" Dr. \" das?
1434 vput addrcodec res +e 21 Hey\,\"" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1436 eval vput addrcodec res d
$res
1438 vput addrcodec res
++e
22 Hey\
,\" <doog@def
> "Wie()" findet
\" Dr.
\" das?
1440 eval vput addrcodec res d
$res
1447 #0 "3 Sauer Dr." <doog@def>
1448 #0 3 Sauer Dr. <doog@def>
1449 #0 4 Sauer (Ma) "Dr." <doog@def>
1450 #0 4 Sauer (Ma) Dr. <doog@def>
1451 #0 5 Sauer (Ma) "Braten Dr." <doog@def>
1452 #0 5 Sauer (Ma) Braten Dr. <doog@def>
1453 #0 6 Sauer (Ma) "Braten Dr." (Heu) <doog@def>
1454 #0 6 Sauer (Ma) Braten Dr. (Heu) <doog@def>
1455 #0 7 Sauer (Ma) "Braten Dr." (Heu bu) <doog@def>
1456 #0 7 Sauer (Ma) Braten Dr. (Heu bu) <doog@def>
1457 #0 "8 Dr. Sauer" (Ma) "Braten Dr." (Heu bu) "Boom. Boom" <doog@def>
1458 #0 8 Dr. Sauer (Ma) Braten Dr. (Heu bu) Boom. Boom <doog@def>
1459 #0 "9 Dr.Sauer" (Ma) "Braten Dr." (Heu) <doog@def>
1460 #0 9 Dr.Sauer (Ma) Braten Dr. (Heu) <doog@def>
1461 #0 10 (Ma) "Braten Dr." (Heu) <doog@def>
1462 #0 10 (Ma) Braten Dr. (Heu) <doog@def>
1463 #0 11 (Ma) "Braten Dr\".\"" (Heu) <doog@def>
1464 #0 11 (Ma) Braten Dr"." (Heu) <doog@def>
1465 #0 "12 Dr. Sauer" (Ma) "Braten Dr." (u) <doog@def>
1466 #0 12 Dr. Sauer (Ma) Braten Dr. (u) <doog@def>
1467 #0 13 (Ma) "Braten Dr." (Heu) <doog@def>
1468 #0 13 (Ma) Braten Dr. (Heu) <doog@def>
1469 #0 "14 Hey, Du Wie" () "findet Dr. das?" () <doog@def>
1470 #0 14 Hey, Du Wie () findet Dr. das? () <doog@def>
1471 #0 "15 Hey, Du Wie" () "findet \"\" Dr. \"\" das?" () <doog@def>
1472 #0 15 Hey, Du Wie () findet "" Dr. "" das? () <doog@def>
1473 #0 "16 \"Hey,\" \"Du\" \"Wie" () "\" findet \"\" Dr. \"\" das?" () <doog@def>
1474 #0 16 "Hey," "Du" "Wie () " findet "" Dr. "" das? () <doog@def>
1475 #0 "17 \"Hey\" Du \"Wie" () "findet \" \" Dr. \"\"\" das?" () <doog@def>
1476 #0 17 "Hey" Du "Wie () findet " " Dr. """ das? () <doog@def>
1477 #0 "18 \"Hey\" Du \"Wie" () "findet \" \" Dr. \"\"\" das?" () <doog@def>
1478 #0 18 "Hey" Du "Wie () findet " " Dr. """ das? () <doog@def>
1479 #0 "19 Hey\\,\\\" \"Wie" () "\" findet \\\" Dr. \\\" das?" <doog@def>
1480 #0 19 Hey\,\" "Wie () " findet \" Dr. \" das? <doog@def>
1481 #1 20 Hey\\,\\" <doog@def> "Wie()" findet \\" Dr. \\" das?
1482 #0 "21 Hey\\,\\ Wie() findet \\ Dr. \\ das?" <doog@def>
1483 #0 21 Hey\,\ Wie() findet \ Dr. \ das? <doog@def>
1484 #0 "22 Hey\,\" Wie() findet \" Dr. \" das?" <doog@def>
1485 #0 22 Hey," Wie() findet " Dr. " das? <doog@def>
1486 cksum_test behave
:addrcodec
"${MBOX}" '2804134200 2018'
1490 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" 2>/dev/null
1491 vput vexpr res = 9223372036854775807
1493 vput vexpr res = 9223372036854775808
1495 vput vexpr res =@ 9223372036854775808
1497 vput vexpr res = -9223372036854775808
1499 vput vexpr res = -9223372036854775809
1501 vput vexpr res =@ -9223372036854775809
1511 vput vexpr res + 0 0
1513 vput vexpr res + 0 1
1515 vput vexpr res + 1 1
1518 vput vexpr res + 9223372036854775807 0
1520 vput vexpr res + 9223372036854775807 1
1522 vput vexpr res +@ 9223372036854775807 1
1524 vput vexpr res + 0 9223372036854775807
1526 vput vexpr res + 1 9223372036854775807
1528 vput vexpr res +@ 1 9223372036854775807
1531 vput vexpr res + -9223372036854775808 0
1533 vput vexpr res + -9223372036854775808 -1
1535 vput vexpr res +@ -9223372036854775808 -1
1537 vput vexpr res + 0 -9223372036854775808
1539 vput vexpr res + -1 -9223372036854775808
1541 vput vexpr res +@ -1 -9223372036854775808
1544 vput vexpr res - 0 0
1546 vput vexpr res - 0 1
1548 vput vexpr res - 1 1
1551 vput vexpr res - 9223372036854775807 0
1553 vput vexpr res - 9223372036854775807 -1
1555 vput vexpr res -@ 9223372036854775807 -1
1557 vput vexpr res - 0 9223372036854775807
1559 vput vexpr res - -1 9223372036854775807
1561 vput vexpr res - -2 9223372036854775807
1563 vput vexpr res -@ -2 9223372036854775807
1566 vput vexpr res - -9223372036854775808 +0
1568 vput vexpr res - -9223372036854775808 +1
1570 vput vexpr res -@ -9223372036854775808 +1
1572 vput vexpr res - 0 -9223372036854775808
1574 vput vexpr res - +1 -9223372036854775808
1576 vput vexpr res -@ +1 -9223372036854775808
1579 vput vexpr res + -13 -2
1581 vput vexpr res - 0 0
1583 vput vexpr res - 0 1
1585 vput vexpr res - 1 1
1587 vput vexpr res - -13 -2
1590 vput vexpr res * 0 0
1592 vput vexpr res * 0 1
1594 vput vexpr res * 1 1
1596 vput vexpr res * -13 -2
1599 vput vexpr res / 0 0
1601 vput vexpr res / 0 1
1603 vput vexpr res / 1 1
1605 vput vexpr res / -13 -2
1608 vput vexpr res % 0 0
1610 vput vexpr res % 0 1
1612 vput vexpr res % 1 1
1614 vput vexpr res % -13 -2
1617 #0 9223372036854775807
1619 #1 9223372036854775807
1620 #0 -9223372036854775808
1622 #1 -9223372036854775808
1632 #0 9223372036854775807
1634 #1 9223372036854775807
1635 #0 9223372036854775807
1637 #1 9223372036854775807
1639 #0 -9223372036854775808
1641 #1 -9223372036854775808
1642 #0 -9223372036854775808
1644 #1 -9223372036854775808
1650 #0 9223372036854775807
1652 #1 9223372036854775807
1653 #0 -9223372036854775807
1654 #0 -9223372036854775808
1656 #1 -9223372036854775808
1658 #0 -9223372036854775808
1660 #1 -9223372036854775808
1661 #0 -9223372036854775808
1663 #1 -9223372036854775808
1685 cksum_test behave:vexpr-numeric "${MBOX}" '2147139513 687'
1687 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" #2>/dev/null
1688 vput vexpr res
find 'bananarama' 'nana'
1690 vput vexpr res
find 'bananarama' 'bana'
1692 vput vexpr res
find 'bananarama' 'Bana'
1694 vput vexpr res
find 'bananarama' 'rama'
1697 vput vexpr res ifind
'bananarama' 'nana'
1699 vput vexpr res ifind
'bananarama' 'bana'
1701 vput vexpr res ifind
'bananarama' 'Bana'
1703 vput vexpr res ifind
'bananarama' 'rama'
1706 vput vexpr res substring
'bananarama' 1
1708 vput vexpr res substring
'bananarama' 3
1710 vput vexpr res substring
'bananarama' 5
1712 vput vexpr res substring
'bananarama' 7
1714 vput vexpr res substring
'bananarama' 9
1716 vput vexpr res substring
'bananarama' 10
1718 vput vexpr res substring
'bananarama' 1 3
1720 vput vexpr res substring
'bananarama' 3 3
1722 vput vexpr res substring
'bananarama' 5 3
1724 vput vexpr res substring
'bananarama' 7 3
1726 vput vexpr res substring
'bananarama' 9 3
1728 vput vexpr res substring
'bananarama' 10 3
1755 cksum_test behave
:vexpr-string
"${MBOX}" '2171181036 119'
1757 if have_feat regex
; then
1758 ${cat} <<- '__EOT' | "${SNAIL}" ${ARGS} > "${MBOX}" #2>/dev/null
1759 vput vexpr res regex 'bananarama' 'nana'
1761 vput vexpr res regex 'bananarama' 'bana'
1763 vput vexpr res regex 'bananarama' 'Bana'
1765 vput vexpr res regex 'bananarama' 'rama'
1768 vput vexpr res iregex 'bananarama' 'nana'
1770 vput vexpr res iregex 'bananarama' 'bana'
1772 vput vexpr res iregex 'bananarama' 'Bana'
1774 vput vexpr res iregex 'bananarama' 'rama'
1777 vput vexpr res regex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1779 vput vexpr res regex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1781 vput vexpr res regex 'bananarama' 'Bana(.+)' '\$1\$0'
1783 vput vexpr res regex 'bananarama' '(.+)rama' '\$1\$0'
1786 vput vexpr res iregex 'bananarama' '(.*)nana(.*)' '\${1}a\${0}u{\$2}'
1788 vput vexpr res iregex 'bananarama' '(.*)bana(.*)' '\${1}a\${0}u\$2'
1790 vput vexpr res iregex 'bananarama' 'Bana(.+)' '\$1\$0'
1792 vput vexpr res iregex 'bananarama' '(.+)rama' '\$1\$0'
1806 #0 baabananaramau{rama}
1807 #0 abananaramaunarama
1811 #0 baabananaramau{rama}
1812 #0 abananaramaunarama
1816 cksum_test behave:vexpr-regex "${MBOX}" '3419299180 199'
1820 __behave_smime() { # FIXME add test/ dir, unroll tests therein
1821 TRAP_EXIT_ADDONS=".
/.t.conf .
/.tkey.pem .
/.tcert.pem .
/.tpair.pem
"
1822 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} .
/.VERIFY .
/.DECRYPT .
/.ENCRYPT
"
1823 TRAP_EXIT_ADDONS="${TRAP_EXIT_ADDONS} .
/.tsendmail.sh
"
1825 printf 'behave:s/mime: .. generating test key and certificate ..\n'
1826 ${cat} <<-_EOT > ./.t.conf
1829 default_keyfile = keyfile.pem
1830 distinguished_name = req_distinguished_name
1831 attributes = req_attributes
1835 [ req_distinguished_name ]
1842 emailAddress = test@localhost
1847 openssl req -x509 -nodes -days 3650 -config ./.t.conf \
1848 -newkey rsa:1024 -keyout ./.tkey.pem -out ./.tcert.pem >/dev/null 2>&1
1849 ${cat} ./.tkey.pem ./.tcert.pem > ./.tpair.pem
1851 printf "behave
:s
/mime
:sign
/verify
: "
1852 echo bla | "${SNAIL}" ${ARGS} \
1853 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1854 -Ssmime-sign -Sfrom=test@localhost \
1855 -s 'S/MIME test' ./.VERIFY
1856 printf 'verify\nx\n' |
1857 "${SNAIL}" ${ARGS} \
1858 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1859 -Ssmime-sign -Sfrom=test@localhost \
1860 -Sbatch-exit-on-error -R \
1861 -f ./.VERIFY >/dev/null 2>&1
1862 if [ $? -eq 0 ]; then
1865 printf 'error: verification failed\n'
1867 ${rm} -f ${TRAP_EXIT_ADDONS}
1871 printf ' .. disproof via openssl smime(1): '
1872 if openssl smime -verify -CAfile ./.tcert.pem \
1873 -in ./.VERIFY >/dev/null 2>&1; then
1878 ${rm} -f ${TRAP_EXIT_ADDONS}
1883 # (signing +) encryption / decryption
1884 ${cat} <<-_EOT > ./.tsendmail.sh
1887 (echo 'From S-Postman Thu May 10 20:40:54 2012' && ${cat}) > ./.ENCRYPT
1889 chmod 0755 ./.tsendmail.sh
1891 printf "behave
:s
/mime
:encrypt
+sign
/decrypt
+verify
: "
1893 "${SNAIL}" ${ARGS} \
1894 -Ssmime-force-encryption \
1895 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1896 -Smta=./.tsendmail.sh \
1897 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1898 -Ssmime-sign -Sfrom=test@localhost \
1899 -s 'S/MIME test' recei@ver.com
1901 printf 'decrypt ./.DECRYPT\nfi ./.DECRYPT\nverify\nx\n' |
1902 "${SNAIL}" ${ARGS} \
1903 -Ssmime-force-encryption \
1904 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1905 -Smta=./.tsendmail.sh \
1906 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1907 -Ssmime-sign -Sfrom=test@localhost \
1908 -Sbatch-exit-on-error -R \
1909 -f ./.ENCRYPT >/dev/null 2>&1
1910 if [ $? -eq 0 ]; then
1914 printf 'error: decryption+verification failed\n'
1916 printf ' ..disproof via openssl smime(1): '
1917 if (openssl smime -decrypt -inkey ./.tkey.pem -in ./.ENCRYPT |
1918 openssl smime -verify -CAfile ./.tcert.pem) >/dev/null 2>&1; then
1924 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1926 '/^Content-Disposition: attachment; filename="smime.p7s
"/,/^-- /d' \
1927 < ./.DECRYPT > ./.ENCRYPT
1928 cksum_test ".. checksum of decrypted content
" ".
/.ENCRYPT
" '3090916509 510'
1930 printf "behave
:s
/mime
:encrypt
/decrypt
: "
1932 echo bla | "${SNAIL}" ${ARGS} \
1933 -Ssmime-force-encryption \
1934 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1935 -Smta=./.tsendmail.sh \
1936 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1937 -Sfrom=test@localhost \
1938 -s 'S/MIME test' recei@ver.com
1939 printf 'decrypt ./.DECRYPT\nx\n' | "${SNAIL}" ${ARGS} \
1940 -Ssmime-force-encryption \
1941 -Ssmime-encrypt-recei@ver.com=./.tpair.pem \
1942 -Smta=./.tsendmail.sh \
1943 -Ssmime-ca-file=./.tcert.pem -Ssmime-sign-cert=./.tpair.pem \
1944 -Sfrom=test@localhost \
1945 -Sbatch-exit-on-error -R \
1946 -f ./.ENCRYPT >/dev/null 2>&1
1947 if [ $? -eq 0 ]; then
1951 printf 'error: decryption failed\n'
1953 printf '.. disproof via openssl smime(1): '
1954 if openssl smime -decrypt -inkey ./.tkey.pem \
1955 -in ./.ENCRYPT >/dev/null 2>&1; then
1961 ${sed} -e '/^Date:/d' -e '/^X-Decoding-Date/d' \
1962 < ./.DECRYPT > ./.ENCRYPT
1963 cksum_test ".. checksum of decrypted content
" ./.ENCRYPT '999887248 295'
1965 ${rm} -f ${TRAP_EXIT_ADDONS}
1970 # Some basic tests regarding correct sending of mails, via STDIN / -t / -q,
1971 # including basic MIME Content-Transfer-Encoding correctness (quoted-printable)
1972 # Note we unfortunately need to place some statements without proper
1973 # indentation because of continuation problems
1975 # MIME encoding (QP) stress message body
1977 'Ich bin eine DÖS-Datäi mit sehr langen Zeilen und auch '\
1978 'sonst bin ich ganz schön am Schleudern, da kannste denke '\
1979 "wasde willst
, gelle
, gelle
, gelle
, gelle
, gelle.
\r\n"\
1980 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
\r\n"\
1981 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1\r\n"\
1982 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12\r\n"\
1983 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123\r\n"\
1984 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234\r\n"\
1985 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345\r\n"\
1986 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456\r\n"\
1987 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
1234567\r\n"\
1988 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
12345678\r\n"\
1989 "Ich bin eine DÖS-Datäi mit langen Zeilen und auch sonst
123456789\r\n"\
1990 "Unn ausserdem habe ich trailing SP
/HT
/SP
/HT whitespace
\r\n"\
1991 "Unn ausserdem habe ich trailing HT
/SP
/HT
/SP whitespace
\r\n"\
1992 "auf den zeilen vorher.
\r\n"\
1993 "From am Zeilenbeginn und From der Mitte gibt es auch.
\r\n"\
1995 "Die letzte Zeile war nur ein Punkt.
\r\n"\
1997 "Das waren deren zwei.
\r\n"\
1999 "Die letzte Zeile war ein Leerschritt.
\n"\
2000 "=VIER
= EQUAL SIGNS
=ON A LINE
=\r\n"\
2003 "Die letzte Zeile war nur ein Punkt
, mit Unix Zeilenende.
\n"\
2005 "Das waren deren zwei. ditto.
\n"\
2007 "Unn ausseerdem habe ich trailing SP
/HT
/SP
/HT whitespace
\n"\
2008 "Unn ausseerdem habe ich trailing HT
/SP
/HT
/SP whitespace
\n"\
2009 "auf den zeilen vorher.
\n"\
2011 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
\n"\
2012 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.1"\
2014 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
2016 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
2018 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
2020 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
2022 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende
.12"\
2024 "QP am Zeilenende über soft-nl hinweg
\n"\
2025 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
2027 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
2029 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
2031 "Ich bin eine ziemlich lange
, steile
, scharfe Zeile mit Unix Zeilenende.
"\
2033 "=VIER
= EQUAL SIGNS
=ON A LINE
=\n"\
2035 "Die letzte Zeile war ein Leerschritt.
\n"\
2039 # MIME encoding (QP) stress message subject
2040 SUB="Äbrä Kä?dä
=brö Fü?di
=bus? \
2041 adadaddsssssssddddddddddddddddddddd\
2042 ddddddddddddddddddddddddddddddddddd\
2043 ddddddddddddddddddddddddddddddddddd\
2044 dddddddddddddddddddd Hallelulja? Od\
2045 er?? eeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
2046 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
2047 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee f\
2048 fffffffffffffffffffffffffffffffffff\
2049 fffffffffffffffffffff ggggggggggggg\
2050 ggggggggggggggggggggggggggggggggggg\
2051 ggggggggggggggggggggggggggggggggggg\
2052 ggggggggggggggggggggggggggggggggggg\
2055 # Three tests for MIME encodign and (a bit) content classification.
2056 # At the same time testing -q FILE, < FILE and -t FILE
2059 < "${BODY}" "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2060 -a "${BODY}" -s "${SUB}" "${MBOX}"
2061 cksum_test content
:001 "${MBOX}" '2356108758 6413'
2064 < /dev
/null
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2065 -a "${BODY}" -s "${SUB}" -q "${BODY}" "${MBOX}"
2066 cksum_test content:002 "${MBOX}" '2356108758 6413'
2069 ( echo "To
: ${MBOX}" && echo "Subject
: ${SUB}" && echo &&
2071 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Snodot -a "${BODY}" -t
2072 cksum_test content:003 "${MBOX}" '2356108758 6413'
2074 # Test for [260e19d] (Juergen Daubert)
2076 echo body | "${SNAIL}" ${ARGS} "${MBOX}"
2077 cksum_test content:004 "${MBOX}" '4004005686 49'
2079 # Sending of multiple mails in a single invocation
2081 ( printf "m
${MBOX}\n~s subject1
\nE
-Mail Körper
1\n~.
\n" &&
2082 printf "m
${MBOX}\n~s subject2
\nEmail body
2\n~.
\n" &&
2084 ) | "${SNAIL}" ${ARGS} ${ADDARG_UNI}
2085 cksum_test content
:005 "${MBOX}" '2157252578 260'
2089 # "Test for" [d6f316a] (Gavin Troy)
2091 printf "m ${MBOX}\n~s subject1\nEmail body\n~.\nfi ${MBOX}\np\nx\n" |
2092 "${SNAIL}" ${ARGS} ${ADDARG_UNI} -Spipe-text/plain="${cat}" > "${BODY}"
2093 ${sed} -e 1d < "${BODY}" > "${MBOX}"
2094 cksum_test content:006 "${MBOX}" '2273863401 83'
2096 # "Test
for" [c299c45] (Peter Hofmann) TODO shouldn't end up QP-encoded?
2099 for(i = 0; i < 10000; ++i)
2101 #printf "\xF0\x90\x87\x90"
2102 }' | "${SNAIL}" ${ARGS} ${ADDARG_UNI} -s TestSubject "${MBOX}"
2103 cksum_test content:007 "${MBOX}" '1754234717 61767'
2105 ## Test some more corner cases for header bodies (as good as we can today) ##
2109 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2110 -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̲' \
2112 cksum_test content
:008 "${MBOX}" '1563381297 326'
2114 # Single word (overlong line split -- bad standard! Requires injection of
2115 # artificial data!! Bad can be prevented by using RFC 2047 encoding)
2117 i
=`${awk} 'BEGIN{for(i=0; i<92; ++i) printf "0123456789_"}'`
2118 echo |
"${SNAIL}" ${ARGS} -s "${i}" "${MBOX}"
2119 cksum_test content
:009 "${MBOX}" '1996714851 1669'
2121 # Combination of encoded words, space and tabs of varying sort
2123 echo |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2124 -s "1Abrä Kaspas1
2Abra Katä b_kaspas2 \
2125 3Abrä Kaspas3
4Abrä Kaspas4
5Abrä Kaspas5 \
2126 6Abra Kaspas6
7Abrä Kaspas7
8Abra Kaspas8 \
2127 9Abra Kaspastäb4-3
10Abra Kaspas1 _
11Abra Katäb1 \
2128 12Abra Kadabrä
1 After Tab after Täb this is NUTS
" \
2130 cksum_test content:010 "${MBOX}" '2956039469 542'
2132 # Overlong multibyte sequence that must be forcefully split
2133 # todo This works even before v15.0, but only by accident
2135 echo | "${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2136 -s "✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
2137 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄\
2138 ✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄✄" \
2140 cksum_test content
:011 "${MBOX}" '454973928 610'
2144 echo |
"${SNAIL}" ${ARGS} \
2145 -s "1-1 B2 B3 B4 B5 B6 B\
2146 1-2 B2 B3 B4 B5 B6 B\
2147 1-3 B2 B3 B4 B5 B6 B\
2148 1-4 B2 B3 B4 B5 B6 B\
2149 1-5 B2 B3 B4 B5 B6 B\
2150 1-6 B2 B3 B4 B5 B6 " \
2152 cksum_test content
:012 "${MBOX}" '1014122962 248'
2154 # Leading and trailing WS
2156 echo |
"${SNAIL}" ${ARGS} \
2157 -s " 2-1 B2 B3 B4 B5 B6 B\
2158 1-2 B2 B3 B4 B5 B6 B\
2159 1-3 B2 B3 B4 B5 B6 B\
2160 1-4 B2 B3 B4 B5 B6 " \
2162 cksum_test content
:013 "${MBOX}" '3212167908 187'
2164 # Quick'n dirty RFC 2231 test; i had more when implementing it, but until we
2165 # have a (better) test framework materialize a quick shot
2167 TRAP_EXIT_ADDONS
=.
/.ttt
2169 mkdir .
/.ttt ||
exit 1
2173 : > 'diet\ is \curd.txt'
2174 : > 'diet "is" curd.txt'
2176 : > 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
2177 : > höde__tröge__müde__dätte__hätte__vuelle__guelle__aese__aesse__sauerliche__kräuter__österliche__grüße__mäh.txt
2178 : > hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt
2179 : > ✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt
2181 echo bla |
"${SNAIL}" ${ARGS} ${ADDARG_UNI} \
2182 -a ".
/.ttt
/ma
'ger.txt" -a "./.ttt/mä'ger.txt
" \
2183 -a './.ttt/diet\ is \curd.txt' -a './.ttt/diet "is
" curd.txt' \
2184 -a ./.ttt/höde-tröge.txt \
2185 -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 \
2186 -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 \
2187 -a ./.ttt/hööööööööööööööööö_nöööööööööööööööööööööö_düüüüüüüüüüüüüüüüüüü_bäääääääääääääääääääääääh.txt \
2188 -a ./.ttt/✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆✆.txt \
2191 cksum_test content:14 "${MBOX}" '589846634 2491'
2193 printf "Resend
${BODY}\nx\n" | "${SNAIL}" ${ARGS} -f "${MBOX}"
2194 cksum_test content:14-2 "${MBOX}" '589846634 2491'
2198 if have_feat devel; then
2199 ARGS="${ARGS} -Smemdebug"
2206 if [ -z "${CHECK_ONLY}" ]; then
2212 [ ${ESTAT} -eq 0 ] && echo Ok || echo >&2 'Errors occurred'