test: `notmuch-test-run' should protect against buffer switching.
[notmuch] / test / test-lib.el
index 5b32e0abe4d524f272922f119fce3bcea6d57fec..6271da22de4b97c2dbca1d37957a3b437af4833f 100644 (file)
@@ -92,7 +92,9 @@ nothing."
 (defmacro notmuch-test-run (&rest body)
   "Evaluate a BODY of test expressions and output the result."
   `(with-temp-buffer
 (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)))
        (insert (if (stringp result)
                   result
                 (prin1-to-string result)))