# minor corruptions such as line ending changes could
# render the tests useless.)
(cd "$THISDIR" && output_md5 *.txt > "$MH_TEST_DIR/inctest.md5sums")
-diff -u "$THISDIR/md5sums" "$MH_TEST_DIR/inctest.md5sums"
+check "$THISDIR/md5sums" "$MH_TEST_DIR/inctest.md5sums" 'keep first'
FILLER="$THISDIR/filler.txt"
FROMLINE="$THISDIR/fromline.txt"
$VALGRIND inc -silent -file "$MH_TEST_DIR/eom-align.mbox"
# We know the messages should be 11 and 12 in inbox
# Now get the bodies back out.
- sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$MH_TEST_DIR/eom-align.inbox.body1"
- sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/12" > "$MH_TEST_DIR/eom-align.inbox.body2"
- diff -u "$MH_TEST_DIR/eom-align.mbox.body" "$MH_TEST_DIR/eom-align.inbox.body1"
- diff -u "$FILLER" "$MH_TEST_DIR/eom-align.inbox.body2"
+ body1="$MH_TEST_DIR/eom-align.inbox.body1"
+ body2="$MH_TEST_DIR/eom-align.inbox.body2"
+ sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$body1"
+ sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/12" > "$body2"
+ check "$MH_TEST_DIR/eom-align.mbox.body" "$body1" 'keep first'
+ check "$FILLER" "$body2" 'keep first'
rmm 11 12
}
makembox_B "$MH_TEST_DIR/eom-align.mbox" $STDIO_BUFSZ
$VALGRIND inc -silent -file "$MH_TEST_DIR/eom-align.mbox"
# We know the message should be 11 in the inbox
- sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$MH_TEST_DIR/eom-align.inbox.body1"
- diff -u "$MH_TEST_DIR/eom-align.mbox.body" "$MH_TEST_DIR/eom-align.inbox.body1"
+ body1="$MH_TEST_DIR/eom-align.inbox.body1"
+ sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$body1"
+ check "$MH_TEST_DIR/eom-align.mbox.body" "$body1" 'keep first'
rmm 11
}
-
# Cover a decent range around the stdio buffer size to make sure we catch
# any corner cases whether they relate to total message size equal to
# buffer size or to body size equal to buffer size.
i=$(expr $i + 1)
done
progress_done
+
+test ${failed:-0} -eq 0 && \
+rm "$MH_TEST_DIR/eom-align.mbox" "$MH_TEST_DIR/eom-align.mbox.body"
+
+exit $failed
groff -Tutf8 -mandoc -wmac "$manpage" > /dev/null 2>>"$actual"
done
-diff -u "$expected" "$actual"
+check "$expected" "$actual"
+
+exit $failed
sed 's/\(Content-ID:\) <[^>][^>]*>/\1 <TESTID>/' $draft > $actual
}
-draft=$MH_TEST_DIR/$$.draft
-expected=$MH_TEST_DIR/$$.expected
-actual=$MH_TEST_DIR/$$.actual
+draft="$MH_TEST_DIR/$$.draft"
+draftorig="$MH_TEST_DIR/,$$.draft.orig"
+expected="$MH_TEST_DIR/$$.expected"
+actual="$MH_TEST_DIR/$$.actual"
# check mhbuild
cat > $expected <<EOF
mhbuild $draft
mungedraft
check $expected $actual
+test ${failed:-0} -eq 0 && rm "$draft" "$draftorig"
# check mhbuild -rfc934
cat > $expected <<EOF
mhbuild -rfc934 $draft
mungedraft
check $expected $actual
+test ${failed:-0} -eq 0 && rm "$draft" "$draftorig"
exit $failed
This is a test; this is the body.
EOF
mhshow -nopause $msgnum > $actual 2>&1
-diff -u $expected $actual
+check "$expected" "$actual"
+
+exit $failed
+
=\b ^H (backspace) character, probably erased = in diff output
EOF
mhshow -nopause $msgnum > $actual 2>&1
-diff -u $expected $actual
+check "$expected" "$actual"
+
+exit $failed
# check it
mhshow -part 1.1 -form mhl.null -nopause $msgnum > $actual 2>&1
-diff -u $expected $actual && rm -f $expected $actual
+check "$expected" "$actual"
+
+exit $failed
cat /dev/null > $expected_out
pick -a > $actual_out 2> $actual_err
-diff -u $expected_err $actual_err || exit 1
-diff -u $expected_out $actual_out || exit 1
+check "$expected_err" "$actual_err"
+check "$expected_out" "$actual_out"
repl -editor true -format -form $form -group -nocc me -nowhatnowproc 1 || exit 1
-diff -u $expected $actual
+check "$expected" "$actual"
+
+test ${failed:-0} -eq 0 && rm "$form"
+
+exit $failed
scan -width 80 +inbox > $actual || exit 1
-diff -u $expected $actual
+check "$expected" "$actual"
+
+exit $failed
#
######################################################
+set -e
+
if test -z "${MH_OBJ_DIR}"; then
srcdir=`dirname "$0"`/../..
MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
setup_test
-set -e
-
cd "$MH_TEST_DIR"
-rm -f "baz's boz"
-touch "baz's boz"
+testname="baz's boz"
+testname_quoted="baz\'s\ boz"
+touch "$testname"
# whatnow's attach stuff needs a draft to work on
cp "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/draft"
touch $expected $expectederr $actual $actualerr
cat > $expected <<EOF
-baz's boz
+$testname
EOF
# whatnow's exit status is always 1 so that is not a failure
set +e
-echo "attach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
+echo "attach $testname_quoted" | \
+ whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
-echo "detach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
+echo "detach $testname_quoted" | \
+ whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
set -e
-diff -u $expectederr $actualerr || exit 1
-diff -u $expected $actual
+check "$expectederr" "$actualerr"
+check "$expected" "$actual"
+
+test ${failed:-0} -eq 0 && rm "$testname"
+
+exit $failed
#
######################################################
+set -e
+
if test -z "${MH_OBJ_DIR}"; then
srcdir=`dirname "$0"`/../..
MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
setup_test
-set -e
SPDIR="$MH_TEST_DIR/foo's bar"
rm -rf "$SPDIR"
mkdir "$SPDIR"
-cd "$SPDIR"
-touch baz boz
-cd
+(cd "$SPDIR" && touch baz boz)
expectederr=$MH_TEST_DIR/$$.expectederr
actualerr=$MH_TEST_DIR/$$.actualerr
# ||true to ignore whatnow's exit status
# watch the quoting -- shell and printf and then the shell run inside whatnow
-printf "cd $MH_TEST_DIR/foo\\\\'s\\\\ bar\npwd\n" | whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
+printf "cd $MH_TEST_DIR/foo\\\\'s\\\\ bar\npwd\n" | \
+ whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
+
+check "$expectederr" "$actualerr"
+check "$expected" "$actual"
+
+test ${failed:-0} -eq 0 && rm -r "$SPDIR"
-diff -u $expectederr $actualerr || exit 1
-diff -u $expected $actual
+exit $failed
#
######################################################
+set -e
+
if test -z "${MH_OBJ_DIR}"; then
srcdir=`dirname "$0"`/../..
MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
setup_test
-set -e
SPDIR="$MH_TEST_DIR/foo's bar"
rm -rf "$SPDIR"
mkdir "$SPDIR"
# NB use of sort as the order of output of ls is not guaranteed
echo 'ls' | whatnow -noedit -prompt '' 2> "$actualerr" | sort > "$actual"
-diff -u $expectederr $actualerr || exit 1
-diff -u $expected $actual
+check "$expectederr" "$actualerr"
+check "$expected" "$actual"
+
+test ${failed:-0} -eq 0 && rm -r "$SPDIR"
+
+exit $failed