]> git.phdru.name Git - mimedecode.git/blobdiff - test/test_all
Version 2.3.8
[mimedecode.git] / test / test_all
index 81b71eae7bafe16b1c12367b69e4a61512b4c517..669d6b3901d91c6ccf2beac59491c0d608e4facc 100755 (executable)
@@ -10,26 +10,41 @@ mkdir tmp || exit 1
 RC=0
 
 test1() {
-   ../mimedecode.py -H test -f utf-8 input/"$1" >tmp/"$1" || return 1
-   if cmp -s expected/"$1" 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/"$1" tmp/"$1" >tmp/"$1".diff
+      diff --text expected/"$expfile" tmp/"$expfile" >tmp/"$expfile".diff
       return 1
    fi
 }
 
-for f in input/*.txt; do
-   n="`basename \"$f\"`"
-   echo -n "$n "
-   if test1 "$n"; then
+test_file() {
+   echo -n "$2 "
+   if test1 "$@"; then
       echo "ok"
    else
       echo "fail"
       RC=1
    fi
+}
+
+for f in input/*.txt; do
+   n="`basename \"$f\"`"
+   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
+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