aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorÁlvaro Ramírez2024-10-02 11:36:57 +0100
committerEli Zaretskii2024-10-19 10:51:34 +0300
commit7cbca90569472af5643905fca5b7ab2dea67f876 (patch)
tree311c369f1af13d2bc9e234b5071d55617f9748f6 /test
parentbcc4e64fa7aab9f44e3a7bcdf651a32ec52866c2 (diff)
downloademacs-7cbca90569472af5643905fca5b7ab2dea67f876.tar.gz
emacs-7cbca90569472af5643905fca5b7ab2dea67f876.zip
Hide default-directory absolute file name in dired-hide-details-mode
* lisp/dired.el (dired-hide-details-hide-absolute-location): New user option. (dired-insert-directory, dired-build-subdir-alist): Use it to hide absolute file name of the directory. (dired-hide-details-mode): Update doc string. * test/lisp/dired-tests.el (dired-test-hide-absolute-location-enabled) (dired-test-hide-absolute-location-disabled): New tests * etc/NEWS: Announce the new feature. Bug#72272
Diffstat (limited to 'test')
-rw-r--r--test/lisp/dired-tests.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 3b1f80d3d3d..5a9ba14b402 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -524,6 +524,52 @@
524 (when (file-directory-p testdir) 524 (when (file-directory-p testdir)
525 (delete-directory testdir t))))) 525 (delete-directory testdir t)))))
526 526
527(ert-deftest dired-test-hide-absolute-location-enabled ()
528 "Test for https://debbugs.gnu.org/72272 ."
529 (let* ((dired-hide-details-hide-absolute-location t)
530 (dir-name (expand-file-name "lisp" source-directory))
531 (buffer (prog1 (dired (list dir-name "dired.el" "play"))
532 (dired-insert-subdir (file-name-concat default-directory
533 "play")))))
534 (unwind-protect
535 (progn
536 (goto-char (point-min))
537 (re-search-forward dired-subdir-regexp)
538 (goto-char (match-beginning 1))
539 (should (equal "lisp" (file-name-nondirectory
540 (directory-file-name (dired-get-subdir)))))
541 (should (equal 'dired-hide-details-absolute-location
542 (get-text-property (match-beginning 1) 'invisible)))
543 (re-search-forward dired-subdir-regexp)
544 (goto-char (match-beginning 1))
545 (should (equal "play" (file-name-nondirectory
546 (directory-file-name (dired-get-subdir)))))
547 (should (equal 'dired-hide-details-absolute-location
548 (get-text-property (match-beginning 1) 'invisible))))
549 (kill-buffer buffer))))
550
551(ert-deftest dired-test-hide-absolute-location-disabled ()
552 "Test for https://debbugs.gnu.org/72272 ."
553 (let* ((dired-hide-details-hide-absolute-location nil)
554 (dir-name (expand-file-name "lisp" source-directory))
555 (buffer (prog1 (dired (list dir-name "dired.el" "play"))
556 (dired-insert-subdir (file-name-concat default-directory
557 "play")))))
558 (unwind-protect
559 (progn
560 (goto-char (point-min))
561 (re-search-forward dired-subdir-regexp)
562 (goto-char (match-beginning 1))
563 (should (equal "lisp" (file-name-nondirectory
564 (directory-file-name (dired-get-subdir)))))
565 (should-not (get-text-property (match-beginning 1) 'invisible))
566 (re-search-forward dired-subdir-regexp)
567 (goto-char (match-beginning 1))
568 (should (equal "play" (file-name-nondirectory
569 (directory-file-name (dired-get-subdir)))))
570 (should-not (get-text-property (match-beginning 1) 'invisible)))
571 (kill-buffer buffer))))
572
527;; `dired-insert-directory' output tests. 573;; `dired-insert-directory' output tests.
528(let* ((data-dir "insert-directory") 574(let* ((data-dir "insert-directory")
529 (test-dir (file-name-as-directory 575 (test-dir (file-name-as-directory