From: Oleg Broytman Date: Wed, 19 Feb 2014 13:01:14 +0000 (+0400) Subject: Add a test for option -b X-Git-Tag: v2.3.5~2 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=122d737ede15f87a025267f0d219a0a0cedbc964;p=mimedecode.git Add a test for option -b --- diff --git a/test/expected/msg_15-1.txt b/test/expected/msg_15-1.txt new file mode 100644 index 0000000..272ad45 --- /dev/null +++ b/test/expected/msg_15-1.txt @@ -0,0 +1,58 @@ +From test Sat Feb 1 00:00:00 2014 +Return-Path: +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: +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 + + + +Some removed HTML + + +Some removed text. + + + + +--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-- + diff --git a/test/test_all b/test/test_all index 4124384..300578e 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,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