]> git.notmuchmail.org Git - notmuch/blobdiff - test/emacs
test: Test search's handling of subprocess errors
[notmuch] / test / emacs
index 5403930ba20c3c63d50263620a5da5a8c2e93272..5067d67b5ad42fa75b3d03e105688d4e69a9347a 100755 (executable)
@@ -853,4 +853,27 @@ test_expect_success "Rendering HTML mail with images" \
     'cat OUTPUT && grep -q smiley OUTPUT'
 
 
+test_begin_subtest "Search handles subprocess errors"
+cat > notmuch_fail <<EOF
+#!/bin/sh
+echo This is output
+echo This is an error >&2
+exit 1
+EOF
+chmod a+x notmuch_fail
+test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
+              (notmuch-search \"tag:inbox\")
+              (notmuch-test-wait)
+              (test-output)
+              (with-current-buffer \"*Notmuch errors*\"
+                 (test-output \"ERROR\")))"
+test_expect_equal "$(cat OUTPUT ERROR)" "\
+Error: Unexpected output from notmuch search:
+This is output
+Error: Unexpected output from notmuch search:
+This is an error
+End of search results.
+Error invoking notmuch.  $PWD/notmuch_fail search --format=json --sort=newest-first tag:inbox exited with status 1."
+
+
 test_done