]> git.notmuchmail.org Git - notmuch/blobdiff - test/emacs
lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init()
[notmuch] / test / emacs
index 5067d67b5ad42fa75b3d03e105688d4e69a9347a..5bc3efcc6a87dc65b19031d489a804cc52b5fa2e 100755 (executable)
@@ -525,7 +525,9 @@ test_expect_equal_file attachment1.gz "$EXPECTED/attachment"
 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
 # save as archive to test that Emacs does not re-compress .gz
 test_emacs '(let ((standard-input "\"attachment2.gz\""))
-             (notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5))'
+             (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
+             (search-forward "0001-Deal-with")
+             (notmuch-show-save-part))'
 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
 
 test_begin_subtest "Save 8bit attachment from within emacs using notmuch-show-save-attachments"
@@ -853,27 +855,60 @@ test_expect_success "Rendering HTML mail with images" \
     'cat OUTPUT && grep -q smiley OUTPUT'
 
 
-test_begin_subtest "Search handles subprocess errors"
+test_begin_subtest "Search handles subprocess error exit codes"
 cat > notmuch_fail <<EOF
 #!/bin/sh
-echo This is output
-echo This is an error >&2
+echo '()'
 exit 1
 EOF
 chmod a+x notmuch_fail
 test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
+              (with-current-buffer \"*Messages*\" (erase-buffer))
               (notmuch-search \"tag:inbox\")
               (notmuch-test-wait)
-              (test-output)
+              (with-current-buffer \"*Messages*\"
+                 (test-output \"MESSAGES\"))
               (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
+                 (test-output \"ERROR\"))
+              (test-output))"
+sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
+test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
 End of search results.
-Error invoking notmuch.  $PWD/notmuch_fail search --format=json --sort=newest-first tag:inbox exited with status 1."
-
+---
+$PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
+---
+[XXX]
+$PWD/notmuch_fail exited with status 1
+command: $PWD/notmuch_fail search --format\=sexp --format-version\=1 --sort\=newest-first tag\:inbox
+exit status: 1"
+
+test_begin_subtest "Search handles subprocess warnings"
+cat > notmuch_fail <<EOF
+#!/bin/sh
+echo '()'
+echo This is a warning >&2
+echo This is another warning >&2
+exit 0
+EOF
+chmod a+x notmuch_fail
+test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
+              (with-current-buffer \"*Messages*\" (erase-buffer))
+              (with-current-buffer \"*Notmuch errors*\" (erase-buffer))
+              (notmuch-search \"tag:inbox\")
+              (notmuch-test-wait)
+              (with-current-buffer \"*Messages*\"
+                 (test-output \"MESSAGES\"))
+              (with-current-buffer \"*Notmuch errors*\"
+                 (test-output \"ERROR\"))
+              (test-output))"
+sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
+test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
+End of search results.
+---
+This is a warning (see *Notmuch errors* for more details)
+---
+[XXX]
+This is a warning
+This is another warning"
 
 test_done