+2008-07-24 Eric Gillespie <epg@pretzelnet.org>
+
+ * 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 <josh@bress.net>
* man/repl.man, etc/mhl.reply:
Add an attribution line when replying to messages.
#!/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 <<EOF
+From: Test$i <test$i@example.com>
+To: Some User <user@example.com>
+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=$?
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 <<EOF
-From: Test$i <test$i@example.com>
-To: Some User <user@example.com>
-Date: Fri, 29 Sep 2006 00:00:00
-Subject: Testing message $i
-
-This is message number $i
-EOF
-done
-
-popd
#
######################################################
-BINDIR=$MH_TEST_DIR/bin
-
-
folder -create +testfolder > /dev/null
if [ ! -d "$MH_TEST_DIR/Mail/testfolder" ]; then
exit 1
#
######################################################
-BINDIR=$MH_TEST_DIR/bin
-
-
output=`folder -total +inbox`
if test x"$output" != x'TOTAL = 10 messages in 1 folder.' ; then
exit 1
+++ /dev/null
-#!/bin/sh
-
-exit 1
#!/bin/sh
-expected_text=" 1 09/29*Test1 Testing message 1<<This is message number 1 >>
- 2 09/29*Test2 Testing message 2<<This is message number 2 >>
- 3 09/29*Test3 Testing message 3<<This is message number 3 >>
- 4 09/29*Test4 Testing message 4<<This is message number 4 >>
- 5 09/29*Test5 Testing message 5<<This is message number 5 >>
- 6 09/29*Test6 Testing message 6<<This is message number 6 >>
- 7 09/29*Test7 Testing message 7<<This is message number 7 >>
- 8 09/29*Test8 Testing message 8<<This is message number 8 >>
- 9 09/29*Test9 Testing message 9<<This is message number 9 >>
- 10 09/29*Test10 Testing message 10<<This is message number 10 >>"
+expected=$MH_TEST_DIR/$$.expected
+actual=$MH_TEST_DIR/$$.actual
-output=`scan -width 80 +inbox`
+cat > $expected <<EOF
+ 1 09/29 Test1 Testing message 1<<This is message number 1 >>
+ 2 09/29 Test2 Testing message 2<<This is message number 2 >>
+ 3 09/29 Test3 Testing message 3<<This is message number 3 >>
+ 4 09/29 Test4 Testing message 4<<This is message number 4 >>
+ 5 09/29 Test5 Testing message 5<<This is message number 5 >>
+ 6 09/29 Test6 Testing message 6<<This is message number 6 >>
+ 7 09/29 Test7 Testing message 7<<This is message number 7 >>
+ 8 09/29 Test8 Testing message 8<<This is message number 8 >>
+ 9 09/29 Test9 Testing message 9<<This is message number 9 >>
+ 10 09/29 Test10 Testing message 10<<This is message number 10 >>
+EOF
-if test x"$output" != x"$expected_text" ; then
- exit 1
-fi
+scan -width 80 +inbox > $actual
+
+diff -u $expected $actual