X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=test%2Ftest_all;h=25f8183fe310040d1ca151312c90774cbb9617ea;hb=68284da58382c25f607b161f95a7baf05d178bdc;hp=a30174b897062e6218cf5ac0c351724db26fdd10;hpb=d155353d46f6f4186241e603770d0f5c6a7b6870;p=mimedecode.git diff --git a/test/test_all b/test/test_all index a30174b..25f8183 100755 --- a/test/test_all +++ b/test/test_all @@ -9,15 +9,48 @@ mkdir tmp || exit 1 RC=0 -for f in input/*.txt; do - f="`basename \"$f\"`" - ../mimedecode.py -H test -f utf-8 input/"$f" >tmp/"$f" - if cmp -s expected/"$f" tmp/"$f"; then - rm tmp/"$f" +test1() { + infile="$1" + shift + expfile="$1" + shift + + ../mimedecode.py -H test -f utf-8 "$@" input/"$infile" >tmp/"$expfile" || return 1 + if cmp -s expected/"$expfile" tmp/"$expfile"; then + rm tmp/"$expfile" && return 0 || return 1 + else + diff --text expected/"$expfile" tmp/"$expfile" >tmp/"$expfile".diff + return 1 + fi +} + +test_file() { + echo -n "$2 " + if test1 "$@"; then + echo "ok" else + echo "fail" RC=1 - diff --text expected/"$f" tmp/"$f" >tmp/"$f".diff fi +} + +for f in input/*.txt; do + n="`basename \"$f\"`" + test_file "$n" "$n" done +test_file msg_03.txt msg_03-1.txt -D -d From,To,Subject +test_file msg_03.txt msg_03-1.txt -d '*,-cc' +test_file msg_03.txt msg_03-1.txt -d \*,From,To,Subject,-cc +test_file msg_15.txt msg_15-1.txt -b text/html +test_file msg_15.txt msg_15-2.txt -i text/html +test_file msg_22.txt msg_22-1.txt -r content-id +test_file msg_29.txt msg_29-1.txt -R Content-Type:title +test_file msg_18.txt msg_18-1.txt --remove-params=X-Foobar-Spoink-Defrobnit + +if [ "$RC" -eq 0 ]; then + echo "All tests passed!" + rmdir tmp +fi + exit $RC