bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45748: [PATCH] * test/src/xdisp-tests.el Fix tests to work in batch


From: Basil L. Contovounesios
Subject: bug#45748: [PATCH] * test/src/xdisp-tests.el Fix tests to work in batch mode
Date: Sat, 16 Jan 2021 17:57:56 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Aaron Jensen <aaronjensen@gmail.com> writes:

> diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el
> index ec96d777ff..09c2fa83b3 100644
> --- a/test/src/xdisp-tests.el
> +++ b/test/src/xdisp-tests.el
> @@ -73,33 +73,36 @@ xdisp-tests--minibuffer-scroll
>      (should (equal (nth 1 posns) (nth 2 posns)))))
>  
>  (ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748

FWIW, you can also include the bug number in the test's docstring, if
you prefer.

> -  (with-temp-buffer
> +  (with-current-buffer-window "*test*" 'display-buffer-reuse-window nil

Ideally the tests wouldn't leave this buffer lying around after they
have run; see (info "(ert) Tests and Their Environment").

Also, why does this test not use with-current-buffer like the other
ones?

> +    (erase-buffer)
>      (insert "xxx")
> -    (let* ((window
> -            (display-buffer (current-buffer) '(display-buffer-in-child-frame 
> . nil)))
> -          (char-width (frame-char-width))
> -          (size (window-text-pixel-size nil t t)))
> -      (delete-frame (window-frame window))
> +    (let* ((char-width (frame-char-width))

Nit: this and subsequent let* can also be let.

> +           (size (window-text-pixel-size (get-buffer-window) t t)))

Is get-buffer-window necessary?

> +      (message "Size: %S" size)

This debugging leftover should probably be removed.

> +      (should (equal (/ (car size) char-width) 3)))))

Thanks,

-- 
Basil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]