summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-04-15 15:09:21 -0700
committerCarl Worth <cworth@cworth.org>2010-04-15 15:09:21 -0700
commit004ed3362f7cbc46a118faf6c380da1bc5bd3f78 (patch)
treec647102431a783e359866970c09724dcfa85298e
parent6d16e5c7a311b6b255f59aac8747b8d441d5dd57 (diff)
test: Unify all tests to use the pass_if_equal function.
Previously some tests (dump/restore) were doing ad-hoc verification of values and their own printing of PASS/FAIL, etc. This made it impossible to count test pass/fail rates in a single place. The only reason these tests were written that way was because the old execute_expecting function only worked if one could directly test the stdout output of a notmuch command. The recent switch to pass_if_equal means that all tests can use it.
-rwxr-xr-xtest/notmuch-test20
1 files changed, 4 insertions, 16 deletions
diff --git a/test/notmuch-test b/test/notmuch-test
index ba1e70f..2a2c2e5 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -583,34 +583,22 @@ printf "\nTesting \"notmuch dump\" and \"notmuch restore\":\n"
printf " Dumping all tags...\t\t\t\t"
$NOTMUCH dump dump.expected
-echo " PASS"
+pass_if_equal "$?" "0"
printf " Clearing all tags...\t\t\t\t"
sed -e 's/(\([^(]*\))$/()/' < dump.expected > clear.expected
$NOTMUCH restore clear.expected
$NOTMUCH dump clear.actual
-if diff clear.expected clear.actual > /dev/null; then
- echo " PASS"
-else
- echo " FAIL"
- echo " Expected output: See file clear.expected"
- echo " Actual output: See file clear.actual"
-fi
+pass_if_equal "$(< clear.actual)" "$(< clear.expected)"
printf " Restoring original tags...\t\t\t"
$NOTMUCH restore dump.expected
$NOTMUCH dump dump.actual
-if diff dump.expected dump.actual > /dev/null; then
- echo " PASS"
-else
- echo " FAIL"
- echo " Expected output: See file dump.expected"
- echo " Actual output: See file dump.actual"
-fi
+pass_if_equal "$(< dump.actual)" "$(< dump.expected)"
printf " Restore with nothing to do...\t\t\t"
$NOTMUCH restore dump.expected
-echo " PASS"
+pass_if_equal "$?" "0"
printf "\nTesting threading when messages received out of order:\n"
printf " Adding initial child message...\t\t"