From 006a9503ec8ea892ea9381de8d11865481b00096 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 16 Mar 2014 00:23:58 +0400 Subject: [PATCH] Add tests for --save-* --- TODO | 3 --- test/expected-save/msg_07-1.txt | 5 +++++ test/expected-save/msg_07-2.txt | Bin 0 -> 3512 bytes test/expected-save/msg_07-3.txt | Bin 0 -> 3718 bytes test/test_all | 37 ++++++++++++++++++++++++++++++-- 5 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 test/expected-save/msg_07-1.txt create mode 100644 test/expected-save/msg_07-2.txt create mode 100644 test/expected-save/msg_07-3.txt diff --git a/TODO b/TODO index 70b4158..1970f5c 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ -Add tests for --save-*. - - Release 2.5.0. diff --git a/test/expected-save/msg_07-1.txt b/test/expected-save/msg_07-1.txt new file mode 100644 index 0000000..0ddf15f --- /dev/null +++ b/test/expected-save/msg_07-1.txt @@ -0,0 +1,5 @@ +Content-Type: image/gif; name="dingusfish.gif" +Content-Transfer-Encoding: 8bit +content-disposition: attachment; filename="dingusfish.gif" +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode.py + diff --git a/test/expected-save/msg_07-2.txt b/test/expected-save/msg_07-2.txt new file mode 100644 index 0000000000000000000000000000000000000000..55871839727cec96303f86f592252760a9746236 GIT binary patch literal 3512 zcmV;p4M*}vNk%v~VE_RD0q_6-|Ns90001li000000RRC20{(=LsmtvTqnxzbi?iOm z`wxcVNS5Y_rs~SJ?hD8AOxN~}=lag~{tpZahs2`sh)iMvOs4V)T?Gu&sP!tTLaI)z zm)FfSBiiuyOlxW{<82uYpQ$zG$2*R9wU>3rJr5|<=XbCcc(}7i#)a6JXh=o{=|~AP zXjfSIHA%&Cxs<8tqc$hWRccx~rih?gw@S)cu`1dVy9cXy>(s_-TKKx_Yw=f$L;9P_ zTc(Q);ET%Y{5(7xYJ7uwtqt5aEo}xKEIZLfj;;5Zx=PLHeiQqMc%5CSnY!age}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9yQ?(g^q?o9Q<;jS5$%w&-N7u(MaiV<28hG|?BL~479p%OZBCdG<+ zxSj literal 0 HcmV?d00001 diff --git a/test/expected-save/msg_07-3.txt b/test/expected-save/msg_07-3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc8962b78e115a8135b6190f6517830c6e937b9d GIT binary patch literal 3718 zcmV;14teoIZ*FvDZgeeFd2nSqAZcx3XJs#EX=XbhZeeX@JtAajZfA9KW@&S1E@x?G zA__xqZggdCbS+eJVQzC~WpXV=Zewp`X>MmaAUI-abP8i{ZggdCbS-3Qb8v5SX>@6C zZaN@gbaY{3Xl-R~bUPqsX>4U~VQpnSB4lZ9XLWOCX>({UXK7|43Ro>oNlis9L3MO* zV{dMDWpZ?7WI7;ba&K)QVqtS-HZ&k~Zy-2gX>=fBc_4IUb95kSWFT#6ZDnL-V{c?- zE^v7Y3P(vsI5%Mc0RRE;00960{{R30EC2ui000310RRI2gpaAq?GK}zwAzca-n{z{ zhT=$;=82~2%C_zc$MQ_q_KoNI&iDQg3<`(DqVb4KVggL2@(Eo94AZFfDyc%MPOO*L z%`_w0@b^q>YA@q$84aJQHRi`Vj(4?}b;msqDAeb7uoif@vq#2-*qCTYMg{3e2{UL{ zSot+c#d5insp+FOC&^W6S~{kPpjx*|%2}~0+7r76t9a|w#%fyly6bE4SBpdXo61|J ziwxk4%If?)JR53!gL|VJk=LQzU$3S2*fa>6_Yc-DDyhYDEC`6cWV!-}}?@mGbr{JQUVqzv@45@LDz<=`M zsWeH5;6XPtPj;gzk)ODYE+>g3RFA_?n>YRF8zdIo@znSwFkEE zLpF(z1r^#@u`xz_C0h=a_|{gx_cR~w7Wwi>6M7BC`mAgkM9uKBisr+Y0yEQbTQA#L z+n>46ugk{H0yX1RTrF$+j@w%V>){uPd%`saUwmrS=aGEQ5lE4N zAzeeySPDKz)@lvrR26T%tx=VJTL6^LNBx+n+i?6@2w{OD{*oDp2WfK}Xdc<8VTu{H z_*8z}-N%+!B_e}cjXBOioM$}7XQ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xL+qRNAI>kP%Bw zmyGZ6EgEPcL&#u(s5LQVig6fq^w%%RxP5Vke$zN9%?OSjC_6b=W%x&pxfhGY){Vg@ zi_X%EY9o5$n2zHmjbkAyrw17)2#f2uUpJUua5shfsA9;49{|}{G{{jANQLM1TlW}z zw^l#aB0`;ZRwBrQFW8UOGBnGjZt1s9Qdovj(G&8Fhzpi z;*x1)jgQkd$ku<3bB-{njn7hfh0-izR*=K~VtvAsff+SmURHu>n2&IUisaae1c;Ax zW{}Y}hP()d?sFW4)?4jZAM-O}GUGDM7jphrk9*jH;WTmWXkj@5KSCsxGzoxfX;c1~ zg>LA3q4H>9CUdPOb#D2V!*`9^a+Ez;GPv`3{ZwC~6kX9)8KS64B2_v~b|EJjk5Gwd z0|zy1`G*pgnPHQW9NAY;lQixS6TozQFqSHl1(8{z9?V#ANLgI-@oMvEM4p$Cqc}HE zxM8o^KpNFVkSIB1)NZ+1UIg};Y1l^5m?X&ggE=#b%~*_L1DvMm3aJMhj0KX=iC#lw zPL0@l1L>XCrJV&7m+mB(fK*ep8G)pjsEOsth#aTxiwV>k>J$4w4+M|jQS`vn7TogoVdx@bEI&vn(ih8)7 z1qz4!5O?wUq4ol2LCIYnwxX6rXaw|#QW>Lw$caiLk~gXZC;Qmr*LE_(`Q#ilte45(NMNJK2Z>7ytkO literal 0 HcmV?d00001 diff --git a/test/test_all b/test/test_all index c7bdb28..5009f70 100755 --- a/test/test_all +++ b/test/test_all @@ -4,7 +4,7 @@ cd "`dirname \"$0\"`" && MAILCAPS="`pwd`"/.mailcap && export MAILCAPS && -rm -rf tmp && +rm -rf save tmp && mkdir tmp || exit 1 RC=0 @@ -61,9 +61,42 @@ 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 --save-* +test2() { + infile="$1" + shift + expfile="$1" + shift + savefile="$1" + shift + expsavefile="$1" + shift + + test_file "$infile" "$expfile" -O save "$@" + + if cmp -s expected-save/"$expsavefile" save/"$savefile"; then + rm save/"$savefile" && return 0 || return 1 + else + return 1 + fi +} + +test_save() { + if test2 "$@"; then + echo " save: ok" + else + echo " save: fail" + RC=1 + fi +} + +test_save msg_07.txt msg_07.txt 1-dingusfish.gif msg_07-1.txt --save-headers image/gif +test_save msg_07.txt msg_07.txt 1-dingusfish.gif msg_07-2.txt --save-body image/gif +test_save msg_07.txt msg_07.txt 1-dingusfish.gif msg_07-3.txt --save-message image/gif + if [ "$RC" -eq 0 ]; then echo "All tests passed!" - rmdir tmp + rmdir save tmp fi exit $RC -- 2.39.5