emacs-devel
[Top][All Lists]
Advanced

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

Re: Question about test failure on Hydra


From: Tino Calancha
Subject: Re: Question about test failure on Hydra
Date: Tue, 01 Aug 2017 13:39:50 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Stephen Berman <address@hidden> writes:

> On Mon, 31 Jul 2017 06:26:55 +0300 Eli Zaretskii <address@hidden> wrote:
>
> (dired test-dir) reverts an existing Dired buffer, because of setting
> dired-auto-revert-buffer to t.  (When I step through the code, it is
> after reverting that point moves to the subdirectory line, which the
> should make "sanity check" true (and does, both when I step through the
> code and just run the test in any way).  When I comment out the
> dired-auto-revert-buffer line, then point stays at point-min, which
> makes the sanity check fail (dired-file-name-at-point returns nil),
When i comment out i see the point in point-max, and the test fails
same as you but: (dired-file-name-at-point returns nil)

> though not in the way Hydra reports (it shows point being on the ".."
> entry).)
If somehow, we have in such Dired buffer the point at ".." _before_
call `dired-revert', then _after_ revert the point is preserved:

(let ((test-dir (make-temp-file "test-dir-" t))
        (dired-auto-revert-buffer t)
        buffers buf)
    (with-current-buffer (setq buf (find-file-noselect test-dir))
      (make-directory "test-subdir"))
    (with-current-buffer buf (forward-line -1))
    (push (dired test-dir) buffers)
    (with-current-buffer buf (dired-get-filename t t)))
=> ".."
;; Return "test-subdir" when comment out line:
(with-current-buffer buf (forward-line -1))

We can insert additional `should' calls in the failing tests and
wait until next hydra failoure.

(Following just add more should forms into `dired-test-bug27243-01'; we
might do the same in `dired-test-bug27243-02' and `dired-test-bug27243-03').

--8<-----------------------------cut here---------------start------------->8---
commit 5483d883f753b5a2e0b45bff2a659b8d27a017a9
Author: Tino Calancha <address@hidden>
Date:   Tue Aug 1 13:18:28 2017 +0900

    * test/lisp/dired-tests.el (dired-test-bug27243-01): Add more should forms

diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index d6fe839708..0ee4e13783 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -122,11 +122,18 @@
 
 (ert-deftest dired-test-bug27243-01 ()
   "Test for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27243#5 ."
-  (let ((test-dir (make-temp-file "test-dir-" t))
+  (let ((test-dir (file-name-as-directory (make-temp-file "test-dir-" t)))
         (dired-auto-revert-buffer t) buffers)
+    (should-not (dired-buffers-for-dir test-dir))
     (with-current-buffer (find-file-noselect test-dir)
       (make-directory "test-subdir"))
+    ;; Point must be at end-of-buffer.
+    (with-current-buffer (car (dired-buffers-for-dir test-dir))
+      (should (eobp)))
     (push (dired test-dir) buffers)
+    ;; Previous dired call shouldn't create a new buffer: must visit the one
+    ;; created by `find-file-noselect' above.
+    (should (eq 1 (length (dired-buffers-for-dir test-dir))))
     (unwind-protect
         (let ((buf (current-buffer))
               (pt1 (point))
@@ -135,11 +142,10 @@
           (write-region "Test" nil test-file nil 'silent nil 'excl)
           ;; Sanity check: point should now be on the subdirectory.
           (should (equal (dired-file-name-at-point)
-                         (concat (file-name-as-directory test-dir)
-                                 (file-name-as-directory "test-subdir"))))
+                         (concat test-dir (file-name-as-directory 
"test-subdir"))))
           (push (dired-find-file) buffers)
           (let ((pt2 (point)))          ; Point is on test-file.
-            (switch-to-buffer buf)
+            (pop-to-buffer-same-window buf)
             ;; Sanity check: point should now be back on the subdirectory.
             (should (eq (point) pt1))
             (push (dired-find-file) buffers)
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-07-31
Repository revision: 3a8d0cc825635e07da2a90c4ac987b476fc9b05d



reply via email to

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