From 745756aab12a7fcab857deb6bf2d715364930071 Mon Sep 17 00:00:00 2001 From: David Levine Date: Wed, 4 Jul 2012 09:57:49 -0500 Subject: [PATCH] Added test-packf. --- Makefile.am | 5 +- test/folder/test-packf | 140 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 2 deletions(-) create mode 100755 test/folder/test-packf diff --git a/Makefile.am b/Makefile.am index 0c01502..ff61ab4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,8 +46,9 @@ TESTS = test/ali/test-ali \ test/bad-input/test-header \ test/burst/test-burst \ test/comp/test-comp-format \ - test/folder/test-create test/folder/test-sortm \ - test/folder/test-total test/format/test-dp test/format/test-fmtdump \ + test/folder/test-create test/folder/test-packf \ + test/folder/test-sortm test/folder/test-total \ + test/format/test-dp test/format/test-fmtdump \ test/format/test-localmbox test/format/test-myname \ test/format/test-myhost test/format/test-mymbox \ test/forw/test-forw-digest \ diff --git a/test/folder/test-packf b/test/folder/test-packf new file mode 100755 index 0000000..758a2ab --- /dev/null +++ b/test/folder/test-packf @@ -0,0 +1,140 @@ +#!/bin/sh +###################################################### +# +# Test packf +# +###################################################### + +set -e + +if test -z "${MH_OBJ_DIR}"; then + srcdir=`dirname $0`/../.. + MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR +fi + +. "$MH_OBJ_DIR/test/common.sh" + +setup_test + +expected="$MH_TEST_DIR/$$.expected" +actual="$MH_TEST_DIR/$$.actual" + + +# check -help +cat >"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +# check -version +case `packf -v` in + packf\ --*) ;; + * ) printf "$0: packf -v generated unexpected output\n" >&2 + failed=`expr ${failed:-0} + 1`;; +esac + +# check unknown switch +run_test "packf -nonexistent" 'packf: -nonexistent unknown' + +cd "${MH_TEST_DIR}" || exit 1 +printf 'y\n' >Mail/yes + +# check with no switches +packf /dev/null +rm -f msgbox .msgbox.map +for i in `pick +inbox`; do + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" +done +run_test "printf $i" '10' +rmm +inbox2 -unlink `pick +inbox2` + +# check +folder +packf +inbox /dev/null +rm -f msgbox .msgbox.map +for i in `pick +inbox`; do + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" +done +run_test "printf $i" '10' +rmm +inbox2 -unlink `pick +inbox2` + +# check msgs +packf +inbox 1 2 3 /dev/null +rm -f msgbox .msgbox.map +for i in `pick +inbox2`; do + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" +done +run_test "printf $i" '3' +rmm +inbox2 -unlink `pick +inbox2` + +# check -file +packf +inbox -file msgbox2 /dev/null +for i in `pick +inbox2`; do + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" +done +run_test "printf $i" '10' +rmm +inbox2 -unlink `pick +inbox2` + +# check append to existing mbox file +packf +inbox -file msgbox2 /dev/null +rm -f msgbox2 .msgbox2.map +for i in `pick +inbox2`; do + if [ $i -le 10 ]; then + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" + else + arith_eval $i - 10 + diff "`mhpath +inbox $arith_val`" "`mhpath +inbox2 $i`" + fi +done +run_test "printf $i" '20' +rmm +inbox2 -unlink `pick +inbox2` + +# check -mbox +packf +inbox -mbox /dev/null +rm -f msgbox .msgbox.map +for i in `pick +inbox2`; do + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" +done +run_test "printf $i" '10' +rmm +inbox2 -unlink `pick +inbox2` + +# check -mmdf +packf +inbox -mmdf /dev/null +rm -f msgbox .msgbox.map +for i in `pick +inbox2`; do + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" +done +run_test "printf $i" '10' +rmm +inbox2 -unlink `pick +inbox2` + +# check append to existing mmdf file +packf +inbox -mmdf /dev/null +rm -f msgbox .msgbox.map +for i in `pick +inbox2`; do + if [ $i -le 10 ]; then + diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`" + else + arith_eval $i - 10 + diff "`mhpath +inbox $arith_val`" "`mhpath +inbox2 $i`" + fi +done +run_test "printf $i" '10' +rmm +inbox2 -unlink `pick +inbox2` + + +exit ${failed:-0} -- 1.7.10.4