From 7afe9b7d7142e48c76dfac3992fdf91d3e5518ff Mon Sep 17 00:00:00 2001 From: Josh Bressers Date: Fri, 25 Jul 2008 00:11:53 +0000 Subject: [PATCH] * test/runtest: cat test-temp-dir only once. Destroy and create test Mail hierarchy here, so each test has its own independent test data. * test/setup-test: Drop needless pushd/popd, which don't exist in sh anyway. Don't use aclocal, which is part of automake. Don't create Mail hierarchy here (see test/runtest). * test/tests/folder/test-create, tests/folder/test-total: Drop unused BINDIR. * tests/pick/test-pick: Remove failing no-op test. * test/tests/scan/test-scan: Write expected and actual output to files and diff them. This way, if the output differs, diff provides the FAILing exit code and shows the differences. --- ChangeLog | 19 +++++++++++++++++++ test/runtest | 21 ++++++++++++++++++++- test/setup-test | 23 ++--------------------- test/tests/folder/test-create | 3 --- test/tests/folder/test-total | 3 --- test/tests/pick/test-pick | 3 --- test/tests/scan/test-scan | 31 +++++++++++++++++-------------- 7 files changed, 58 insertions(+), 45 deletions(-) delete mode 100644 test/tests/pick/test-pick diff --git a/ChangeLog b/ChangeLog index d08bcdd..0d47602 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2008-07-24 Eric Gillespie + + * test/runtest: cat test-temp-dir only once. Destroy and create + test Mail hierarchy here, so each test has its own independent + test data. + + * test/setup-test: Drop needless pushd/popd, which don't exist in + sh anyway. Don't use aclocal, which is part of automake. + Don't create Mail hierarchy here (see test/runtest). + + * test/tests/folder/test-create, tests/folder/test-total: Drop + unused BINDIR. + + * tests/pick/test-pick: Remove failing no-op test. + + * test/tests/scan/test-scan: Write expected and actual output to + files and diff them. This way, if the output differs, diff + provides the FAILing exit code and shows the differences. + 2008-06-12 Josh Bressers * man/repl.man, etc/mhl.reply: Add an attribution line when replying to messages. diff --git a/test/runtest b/test/runtest index d970b18..3d7a92b 100755 --- a/test/runtest +++ b/test/runtest @@ -1,9 +1,28 @@ #!/bin/sh -export MH=`cat test-temp-dir`/mh_profile export MH_TEST_DIR=`cat test-temp-dir` +export MH=$MH_TEST_DIR/mh_profile export PATH=$MH_TEST_DIR/bin:$PATH +# clean old test data +rm -rf $MH_TEST_DIR/Mail +# setup test data +mkdir $MH_TEST_DIR/Mail +folder -create +inbox > /dev/null +# create 10 basic messages +for i in `seq 1 10`; +do + cat > $MH_TEST_DIR/Mail/inbox/$i < +To: Some User +Date: Fri, 29 Sep 2006 00:00:00 +Subject: Testing message $i + +This is message number $i +EOF +done + +# now run the test /bin/sh $1 return_value=$? diff --git a/test/setup-test b/test/setup-test index d197295..a05b139 100755 --- a/test/setup-test +++ b/test/setup-test @@ -3,28 +3,9 @@ TEMPDIR=`mktemp -d /tmp/nmh-test-XXXXXXXX` echo $TEMPDIR > test-temp-dir -pushd .. -aclocal -autoheader -autoconf +cd .. +autoheader && autoconf && date > stamp-h.in ./configure --prefix=$TEMPDIR --with-locking=fcntl make install echo "Path: $TEMPDIR/Mail" > $TEMPDIR/mh_profile -mkdir $TEMPDIR/Mail - -MH=$TEMPDIR/mh_profile $TEMPDIR/bin/folder -create +inbox - -for i in `seq 1 10`; -do - cat > $TEMPDIR/Mail/inbox/$i < -To: Some User -Date: Fri, 29 Sep 2006 00:00:00 -Subject: Testing message $i - -This is message number $i -EOF -done - -popd diff --git a/test/tests/folder/test-create b/test/tests/folder/test-create index a5b71ba..5b74b23 100644 --- a/test/tests/folder/test-create +++ b/test/tests/folder/test-create @@ -5,9 +5,6 @@ # ###################################################### -BINDIR=$MH_TEST_DIR/bin - - folder -create +testfolder > /dev/null if [ ! -d "$MH_TEST_DIR/Mail/testfolder" ]; then exit 1 diff --git a/test/tests/folder/test-total b/test/tests/folder/test-total index 6da3174..ff29310 100644 --- a/test/tests/folder/test-total +++ b/test/tests/folder/test-total @@ -5,9 +5,6 @@ # ###################################################### -BINDIR=$MH_TEST_DIR/bin - - output=`folder -total +inbox` if test x"$output" != x'TOTAL = 10 messages in 1 folder.' ; then exit 1 diff --git a/test/tests/pick/test-pick b/test/tests/pick/test-pick deleted file mode 100644 index 2bb8d86..0000000 --- a/test/tests/pick/test-pick +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exit 1 diff --git a/test/tests/scan/test-scan b/test/tests/scan/test-scan index 4aca55f..597bb96 100644 --- a/test/tests/scan/test-scan +++ b/test/tests/scan/test-scan @@ -1,18 +1,21 @@ #!/bin/sh -expected_text=" 1 09/29*Test1 Testing message 1<> - 2 09/29*Test2 Testing message 2<> - 3 09/29*Test3 Testing message 3<> - 4 09/29*Test4 Testing message 4<> - 5 09/29*Test5 Testing message 5<> - 6 09/29*Test6 Testing message 6<> - 7 09/29*Test7 Testing message 7<> - 8 09/29*Test8 Testing message 8<> - 9 09/29*Test9 Testing message 9<> - 10 09/29*Test10 Testing message 10<>" +expected=$MH_TEST_DIR/$$.expected +actual=$MH_TEST_DIR/$$.actual -output=`scan -width 80 +inbox` +cat > $expected <> + 2 09/29 Test2 Testing message 2<> + 3 09/29 Test3 Testing message 3<> + 4 09/29 Test4 Testing message 4<> + 5 09/29 Test5 Testing message 5<> + 6 09/29 Test6 Testing message 6<> + 7 09/29 Test7 Testing message 7<> + 8 09/29 Test8 Testing message 8<> + 9 09/29 Test9 Testing message 9<> + 10 09/29 Test10 Testing message 10<> +EOF -if test x"$output" != x"$expected_text" ; then - exit 1 -fi +scan -width 80 +inbox > $actual + +diff -u $expected $actual -- 1.7.10.4