X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=test%2Ftest_all;h=df65454df9050d52c121c78a67a7c7bac33ba7fe;hb=563d8bfe689ee8f0efab714d57550bb6ccaf323b;hp=69eb614c0bc4bebb2085f71570c99d4b5f50b80f;hpb=f46ea638f6e5b6ca2e10f557b396e50fead206c8;p=mimedecode.git diff --git a/test/test_all b/test/test_all index 69eb614..df65454 100755 --- a/test/test_all +++ b/test/test_all @@ -1,21 +1,34 @@ #! /bin/sh cd "`dirname \"$0\"`" && -MAILCAPS="`pwd`"/.mailcap && -export MAILCAPS && - rm -rf save tmp && mkdir tmp || exit 1 +LC_CTYPE=c.UTF-8 && +export LC_CTYPE && + +MAILCAPS="`pwd`"/.mailcap && +export MAILCAPS && + +: ${PYTHON:=python} RC=0 +if [ `$PYTHON -c "import sys; print(sys.version[0])"` -eq 2 ]; then + PY3=NO +else + PY3=YES +fi + test1() { infile="$1" shift expfile="$1" + if [ $PY3 = YES -a -f expected/"$expfile"-py3 ]; then + expfile="$expfile"-py3 + fi shift - ../mimedecode.py -H test -f utf-8 "$@" input/"$infile" >tmp/"$expfile" || return 1 + $PYTHON ../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