]> git.phdru.name Git - mimedecode.git/blobdiff - test/test_all
Feat(tests): Use tox for testing
[mimedecode.git] / test / test_all
index c6a5498f0e6b2756491ec667d73c85f8c26855f4..df65454df9050d52c121c78a67a7c7bac33ba7fe 100755 (executable)
@@ -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
@@ -60,6 +73,8 @@ test_file msg_02.txt msg_02-1.txt --set-param=X-Mailer:test=set
 test_file msg_02.txt msg_02-1.txt --set-param=X-Mailer:test:set
 test_file msg_13.txt msg_13-1.txt -B '*/*'
 test_file msg_13.txt msg_13.txt -t 'text/*' -b 'image/*' -B '*/*'
+test_file msg_36.txt msg_36-1.txt -i multipart/alternative
+test_file msg_36.txt msg_36-2.txt -I multipart/alternative
 
 # Test --save-*
 test2() {
@@ -95,9 +110,17 @@ test_save msg_07.txt msg_07.txt 1-dingusfish.gif msg_07-2.txt --save-body image/
 test_save msg_07.txt msg_07.txt 1-dingusfish.gif msg_07-3.txt --save-message image/gif
 test_save msg_07-1.txt msg_07-1.txt 1-dingusfish.gif msg_07-4.txt --save-message image/gif
 
+test_save msg_07.txt msg_07.txt 1.dig msg_07-5.txt --save-headers multipart/mixed
+test_save msg_07.txt msg_07.txt 1.dig msg_07-6.txt --save-body multipart/mixed
+test_save msg_07.txt msg_07.txt 1.dig msg_07-7.txt --save-message multipart/mixed
+
+echo
+
 if [ "$RC" -eq 0 ]; then
    echo "All tests passed!"
    rmdir save tmp
+else
+   echo "ERRORS!"
 fi
 
 exit $RC