add_email_corpus
+# syntax errors in test-lib.el cause mysterious failures
+test_expect_success 'Syntax of emacs test library' \
+ "${TEST_EMACS} -Q --batch --load $TEST_DIRECTORY/test-lib.el"
+
test_begin_subtest "Basic notmuch-hello view in emacs"
test_emacs '(notmuch-hello)
(test-output)'
test_begin_subtest "Reply within emacs to an html-only message"
add_message '[content-type]="text/html"' \
'[body]="Hi,<br />This is an <b>HTML</b> test message.<br /><br />OK?"'
-test_emacs "(let ((message-hidden-headers '()) (mm-text-html-renderer 'html2text))
+test_emacs "(let ((message-hidden-headers '()))
(notmuch-show \"id:${gen_msg_id}\")
(notmuch-show-reply)
(test-output))"
${gen_msg_filename}
http://mid.gmane.org/bought
http://marc.info/?i=bought
-http://mail-archive.com/search?l=mid&q=bought
+http://mid.mail-archive.com/bought
EOF
test_expect_equal_file OUTPUT EXPECTED
EOF
chmod a+x notmuch_fail
test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
- (with-current-buffer \"*Messages*\" (erase-buffer))
+ (with-current-buffer \"*Messages*\"
+ (let ((inhibit-read-only t)) (erase-buffer)))
(with-current-buffer (get-buffer-create \"*Notmuch errors*\")
(erase-buffer))
(notmuch-search \"tag:inbox\")
EOF
chmod a+x notmuch_fail
test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
- (with-current-buffer \"*Messages*\" (erase-buffer))
+ (with-current-buffer \"*Messages*\"
+ (let ((inhibit-read-only t)) (erase-buffer)))
(with-current-buffer (get-buffer-create \"*Notmuch errors*\")
(erase-buffer))
(notmuch-search \"tag:inbox\")
output=$(notmuch search --output=messages 'tag:search-global-race-tag')
test_expect_equal "$output" "id:$gen_msg_id_1"
+test_begin_subtest "Term escaping"
+output=$(test_emacs "(mapcar 'notmuch-escape-boolean-term (list
+ \"\"
+ \"abc\`~\!@#\$%^&*-=_+123\"
+ \"(abc\"
+ \")abc\"
+ \"\\\"abc\"
+ \"\x01xyz\"
+ \"\\x201cxyz\\x201d\"))")
+test_expect_equal "$output" '("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\"" "\"'$'\x01''xyz\"" "\"“xyz”\"")'
+
test_done