]> git.notmuchmail.org Git - notmuch/blobdiff - test/notmuch-test
test: Unify all tests to use the pass_if_equal function.
[notmuch] / test / notmuch-test
index ba1e70f6fb7c48d6c6bd1fbee27366069b686c4f..2a2c2e5fcd1a114e1c39dc31d18d6c710b586e54 100755 (executable)
@@ -583,34 +583,22 @@ printf "\nTesting \"notmuch dump\" and \"notmuch restore\":\n"
 
 printf " Dumping all tags...\t\t\t\t"
 $NOTMUCH dump dump.expected
 
 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
 
 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
 
 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
 
 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"
 
 printf "\nTesting threading when messages received out of order:\n"
 printf " Adding initial child message...\t\t"