]> git.phdru.name Git - mimedecode.git/commitdiff
Add a test for option -b
authorOleg Broytman <phd@phdru.name>
Wed, 19 Feb 2014 13:01:14 +0000 (17:01 +0400)
committerOleg Broytman <phd@phdru.name>
Wed, 19 Feb 2014 13:01:14 +0000 (17:01 +0400)
test/expected/msg_15-1.txt [new file with mode: 0644]
test/test_all

diff --git a/test/expected/msg_15-1.txt b/test/expected/msg_15-1.txt
new file mode 100644 (file)
index 0000000..272ad45
--- /dev/null
@@ -0,0 +1,58 @@
+From test Sat Feb  1 00:00:00 2014
+Return-Path: <xx@xx.dk>
+Received: from fepD.post.tele.dk (195.41.46.149) by mail.groupcare.dk (LSMTP for Windows NT v1.1b) with SMTP id <0.0014F8A2@mail.groupcare.dk>; Mon, 30 Apr 2001 12:17:50 +0200
+User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2106
+Subject: XX
+From: xx@xx.dk
+To: XX
+Message-ID: <xxxx>
+Mime-version: 1.0
+Content-type: multipart/mixed;
+   boundary="MS_Mac_OE_3071477847_720252_MIME_Part"
+
+> Denne meddelelse er i MIME-format. Da dit postl
+
+--MS_Mac_OE_3071477847_720252_MIME_Part
+Content-type: multipart/alternative;
+   boundary="MS_Mac_OE_3071477847_720252_MIME_Part"
+
+
+
+--MS_Mac_OE_3071477847_720252_MIME_Part
+Content-transfer-encoding: 8bit
+X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py
+
+Some removed test. 
+
+--MS_Mac_OE_3071477847_720252_MIME_Part
+Content-type: text/html; charset="ISO-8859-1"
+Content-transfer-encoding: 8bit
+X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py
+
+<HTML>
+<HEAD>
+<TITLE>Some removed HTML</TITLE>
+</HEAD>
+<BODY>
+Some removed text.
+</BODY>
+</HTML>
+
+
+--MS_Mac_OE_3071477847_720252_MIME_Part--
+
+
+--MS_Mac_OE_3071477847_720252_MIME_Part
+Content-type: image/gif; name="xx.gif";
+ x-mac-creator="6F676C65";
+ x-mac-type="47494666"
+Content-disposition: attachment
+Content-transfer-encoding: base64
+
+Some removed base64 encoded chars.
+
+--MS_Mac_OE_3071477847_720252_MIME_Part--
+
index 41243847740715ac68f6e37f85fe8031fcf59253..300578eeb1d34c89df7772fb0893e3a7d6e0fcae 100755 (executable)
@@ -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,8 @@ for f in input/*.txt; do
    test_file "$n" "$n"
 done
 
+test_file msg_15.txt msg_15-1.txt -b text/html
+
 if [ "$RC" -eq 0 ]; then
    echo "All tests passed!"
    rmdir tmp