]> git.notmuchmail.org Git - notmuch/commitdiff
test: `notmuch-test-run' should protect against buffer switching.
authorDavid Edmondson <dme@dme.org>
Thu, 26 Jan 2012 07:19:38 +0000 (07:19 +0000)
committerDavid Bremner <bremner@debian.org>
Thu, 26 Jan 2012 12:35:15 +0000 (08:35 -0400)
The body of the test may cause the current buffer to change. Ensure
that the output goes to the correct buffer by switching back before
inserting it.

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
-     (let ((result (progn ,@body)))
+     (let ((buffer (current-buffer))
+          (result (progn ,@body)))
+       (switch-to-buffer buffer)
        (insert (if (stringp result)
                   result
                 (prin1-to-string result)))