emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 47429dc: Add test for bugs 7131, 27762


From: Tino Calancha
Subject: [Emacs-diffs] master 47429dc: Add test for bugs 7131, 27762
Date: Wed, 19 Jul 2017 04:48:26 -0400 (EDT)

branch: master
commit 47429dcb4afd502e5bff9d37a09b030c0b7e0eb0
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    Add test for bugs 7131, 27762
    
    Require 'ls-lisp' at top of the file.
    * test/lisp/dired-tests.el (dired-test-bug7131, dired-test-bug27762):
    New tests.
    (dired-test-bug27693): Delete Dired buffer at the end.
---
 test/lisp/dired-tests.el | 63 ++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 53 insertions(+), 10 deletions(-)

diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 87a83c4..791ba07 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -21,7 +21,7 @@
 (require 'ert)
 (require 'dired)
 (require 'nadvice)
-
+(require 'ls-lisp)
 
 (ert-deftest dired-autoload ()
   "Tests to see whether dired-x has been autoloaded"
@@ -116,15 +116,58 @@
 
 (ert-deftest dired-test-bug27693 ()
   "Test for http://debbugs.gnu.org/27693 ."
-  (require 'ls-lisp)
-  (let ((size "")
-       ls-lisp-use-insert-directory-program)
-    (dired (list (expand-file-name "lisp" source-directory) "simple.el" 
"subr.el"))
-    (setq size (number-to-string
-                (file-attribute-size
-                 (file-attributes (dired-get-filename)))))
-    (search-backward-regexp size nil t)
-    (should (looking-back "[[:space:]]" (1- (point))))))
+  (let ((dir (expand-file-name "lisp" source-directory))
+        (size "")
+        ls-lisp-use-insert-directory-program buf)
+    (unwind-protect
+        (progn
+          (setq buf (dired (list dir "simple.el" "subr.el"))
+                size (number-to-string
+                      (file-attribute-size
+                       (file-attributes (dired-get-filename)))))
+          (search-backward-regexp size nil t)
+          (should (looking-back "[[:space:]]" (1- (point)))))
+      (when (buffer-live-p buf) (kill-buffer buf)))))
+
+(ert-deftest dired-test-bug7131 ()
+  "Test for http://debbugs.gnu.org/7131 ."
+  :expected-result :failed
+  (let* ((dir (expand-file-name "lisp" source-directory))
+         (buf (dired dir)))
+    (unwind-protect
+        (progn
+          (setq buf (dired (list dir "simple.el")))
+          (dired-toggle-marks)
+          (should-not (cdr (dired-get-marked-files)))
+          (kill-buffer buf)
+          (setq buf (dired (list dir "simple.el"))
+                buf (dired dir))
+          (dired-toggle-marks)
+          (should (cdr (dired-get-marked-files))))
+      (when (buffer-live-p buf) (kill-buffer buf)))))
+
+(ert-deftest dired-test-bug27762 ()
+  "Test for http://debbugs.gnu.org/27762 ."
+  :expected-result :failed
+  (let* ((dir source-directory)
+         (default-directory dir)
+         (files (mapcar (lambda (f) (concat "src/" f))
+                        (directory-files
+                         (expand-file-name "src") nil "\\.*\\.c\\'")))
+         ls-lisp-use-insert-directory-program buf)
+    (unwind-protect
+        (let ((file1 "src/cygw32.c")
+              (file2 "src/atimer.c"))
+          (setq buf (dired (nconc (list dir) files)))
+          (dired-goto-file (expand-file-name file2 default-directory))
+          (should-not (looking-at "^   -")) ; Must be 2 spaces not 3.
+          (setq files (cons file1 (delete file1 files)))
+          (kill-buffer buf)
+          (setq buf (dired (nconc (list dir) files)))
+          (should (looking-at "src"))
+          (next-line) ; File names must be aligned.
+          (should (looking-at "src")))
+      (when (buffer-live-p buf) (kill-buffer buf)))))
 
 (provide 'dired-tests)
 ;; dired-tests.el ends here



reply via email to

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