X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.el;h=4e7f5cfc30a7538011124717884b026a19fc2f06;hp=943999622d927265357a984efce409e5a883b3ba;hb=3b24b396c4c9178603dec5380b4e89f6795dee1f;hpb=5297b361d1c5c7dd62b80da0327c091e4c23b140 diff --git a/test/test-lib.el b/test/test-lib.el index 94399962..4e7f5cfc 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -20,6 +20,24 @@ ;; ;; Authors: Dmitry Kurochkin +;; avoid crazy 10-column default of --batch +(set-frame-width (window-frame (get-buffer-window)) 80) + +(defun notmuch-test-wait () + "Wait for process completion." + (while (get-buffer-process (current-buffer)) + (sleep-for 0.1))) + +(defun test-output (&optional filename) + "Save current buffer to file FILENAME. Default FILENAME is OUTPUT." + (write-region (point-min) (point-max) (or filename "OUTPUT"))) + +(defun test-visible-output (&optional filename) + "Save visible text in current buffer to file FILENAME. Default +FILENAME is OUTPUT." + (let ((text (visible-buffer-string))) + (with-temp-file (or filename "OUTPUT") (insert text)))) + (defun visible-buffer-string () "Same as `buffer-string', but excludes invisible text." (visible-buffer-substring (point-min) (point-max)))