[PATCH 2/4 v2] test: `notmuch-test-run' should protect against buffer switching.

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Wed Jan 25 09:36:04 PST 2012


On Wed, 25 Jan 2012 15:45:26 +0000, David Edmondson <dme at dme.org> wrote:
> 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.

LGTM

Regards,
  Dmitry

> ---
>  test/test-lib.el |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/test/test-lib.el b/test/test-lib.el
> index 36e793a..0efb02a 100644
> --- a/test/test-lib.el
> +++ b/test/test-lib.el
> @@ -89,7 +89,9 @@ nothing."
>  (defmacro notmuch-test-run (&rest body)
>    "Evaluate a BODY of test expressions and output the result."
>    `(with-temp-buffer
> -     (let ((result (progn , at body)))
> +     (let ((buffer (current-buffer))
> +	   (result (progn , at body)))
> +       (switch-to-buffer buffer)
>         (insert (if (stringp result)
>  		   result
>  		 (prin1-to-string result)))
> -- 
> 1.7.8.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list