X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.el;h=5dd6271c99dceb16417d947b87a731874d7c7c72;hp=bc75f06e3ab8294e39416c73acd5e84a79823892;hb=f94a50d80af8c2a5513e58db954dd0b1910eb4a8;hpb=f92d7dee8fcf399bda361df82187523598bb09b4 diff --git a/test/test-lib.el b/test/test-lib.el index bc75f06e..5dd6271c 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -51,16 +51,19 @@ FILENAME is OUTPUT." (with-temp-file (or filename "OUTPUT") (insert text)))) (defun visible-buffer-string () - "Same as `buffer-string', but excludes invisible text." + "Same as `buffer-string', but excludes invisible text and +removes any text properties." (visible-buffer-substring (point-min) (point-max))) (defun visible-buffer-substring (start end) - "Same as `buffer-substring', but excludes invisible text." + "Same as `buffer-substring-no-properties', but excludes +invisible text." (let (str) (while (< start end) (let ((next-pos (next-char-property-change start end))) (when (not (invisible-p start)) - (setq str (concat str (buffer-substring start next-pos)))) + (setq str (concat str (buffer-substring-no-properties + start next-pos)))) (setq start next-pos))) str)) @@ -86,10 +89,20 @@ nothing." (add-hook-counter 'notmuch-hello-mode-hook) (add-hook-counter 'notmuch-hello-refresh-hook) +(defadvice notmuch-search-process-filter (around pessimal activate disable) + "Feed notmuch-search-process-filter one character at a time." + (let ((string (ad-get-arg 1))) + (loop for char across string + do (progn + (ad-set-arg 1 (char-to-string char)) + ad-do-it)))) + (defmacro notmuch-test-run (&rest body) "Evaluate a BODY of test expressions and output the result." `(with-temp-buffer - (let ((result (progn ,@body))) + (let ((buffer (current-buffer)) + (result (progn ,@body))) + (switch-to-buffer buffer) (insert (if (stringp result) result (prin1-to-string result)))