aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar David Edmondson <dme@dme.org>2012-01-26 07:19:38 +0000
committerGravatar David Bremner <bremner@debian.org>2012-01-26 08:35:15 -0400
commit2f50524e27db2ca58f6543a2c73a5719d8d7f491 (patch)
tree0d929155f10693bacb9e258af2bc8838d9adc564 /test
parentc70c7f86b83601231bac94db8a6596a1d729ae24 (diff)
test: `notmuch-test-run' should protect against buffer switching.
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.
Diffstat (limited to 'test')
-rw-r--r--test/test-lib.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/test-lib.el b/test/test-lib.el
index 5b32e0ab..6271da22 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -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)))