Merge tag '0.18.2_rc1'
[notmuch] / test / T310-emacs.sh
index 00ae96a89aa8de2e9e79ffaa75f8aa12f4e42064..d72799b4e1fff881e3d258ff81ae7277b16ee94f 100755 (executable)
@@ -483,7 +483,7 @@ test_expect_equal_file OUTPUT EXPECTED
 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))"
@@ -877,7 +877,8 @@ exit 1
 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\")
@@ -909,7 +910,8 @@ 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 \"*Messages*\"
+                 (let ((inhibit-read-only t)) (erase-buffer)))
               (with-current-buffer (get-buffer-create \"*Notmuch errors*\")
                  (erase-buffer))
               (notmuch-search \"tag:inbox\")
@@ -953,4 +955,15 @@ test_emacs '(notmuch-search "subject:\"search race test\" -subject:two")
 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