X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=test%2Ftest_all;h=3de6ec74fb0daf91ff740250d7d3a1c261693640;hb=8bd291ec4b0e8ae1a981194ccc9b4d0388ec2cea;hp=41243847740715ac68f6e37f85fe8031fcf59253;hpb=0d38385113a4e8093ff7fc11f3e11a5b12e5a820;p=mimedecode.git diff --git a/test/test_all b/test/test_all index 4124384..3de6ec7 100755 --- a/test/test_all +++ b/test/test_all @@ -10,18 +10,23 @@ mkdir tmp || exit 1 RC=0 test1() { - ../mimedecode.py -H test -f utf-8 input/"$1" >tmp/"$1" || return 1 - if cmp -s expected/"$2" tmp/"$1"; then - rm tmp/"$1" && return 0 || return 1 + 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/"$2" tmp/"$1" >tmp/"$1".diff + diff --text expected/"$expfile" tmp/"$expfile" >tmp/"$expfile".diff return 1 fi } test_file() { echo -n "$2 " - if test1 "$1" "$2"; then + if test1 "$@"; then echo "ok" else echo "fail" @@ -34,6 +39,9 @@ for f in input/*.txt; do test_file "$n" "$n" done +test_file msg_15.txt msg_15-1.txt -b text/html +test_file msg_15.txt msg_15-2.txt -i text/html + if [ "$RC" -eq 0 ]; then echo "All tests passed!" rmdir tmp