summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorStephen Berman <stephen.berman@gmx.net>2019-04-25 19:17:23 +0200
committerStephen Berman <stephen.berman@gmx.net>2019-04-25 19:17:23 +0200
commit6d8e0fc5aa7673540486af9ecbfc0a3e23c305cf (patch)
tree75247e50c3873c8dfeb4ad9b4b4e80851d2abdbb /test/lisp
parent30030945c30c4710d0d70cabad9d1b512cede0ee (diff)
downloademacs-6d8e0fc5aa7673540486af9ecbfc0a3e23c305cf.tar.gz
Make wdired-mode ignore ls file indicators
* lisp/wdired.el (wdired--restore-dired-filename-prop): When dired-listing-switches includes "F" or "classify", don't treat appended indicator characters as part of the file name (bug#34915). * test/lisp/wdired-tests.el (wdired-test-bug34915): New test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/wdired-tests.el45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index dc67796cded..9682843db29 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -124,6 +124,51 @@ wdired-mode."
(kill-buffer buf)))
(delete-directory test-dir t)))))
+(ert-deftest wdired-test-bug34915 ()
+ "Test editing when dired-listing-switches includes -F.
+Appended file indicators should not count as part of the file
+name, either before or after editing. Since
+dired-move-to-end-of-filename handles indicator characters, it
+suffices to compare the return values of dired-get-filename and
+wdired-get-filename before and after editing."
+ ;; FIXME: Add a test for a door (indicator ">") only under Solaris?
+ (let* ((test-dir (make-temp-file "test-dir-" t))
+ (server-socket-dir test-dir)
+ (dired-listing-switches "-Fl")
+ (buf (find-file-noselect test-dir)))
+ (unwind-protect
+ (progn
+ (with-current-buffer buf
+ (dired-create-empty-file "foo")
+ (set-file-modes "foo" (file-modes-symbolic-to-number "+x"))
+ (make-symbolic-link "foo" "bar")
+ (make-directory "foodir")
+ (require 'dired-x)
+ (dired-smart-shell-command "mkfifo foopipe")
+ (server-force-delete)
+ (server-start) ; Add a socket file.
+ (kill-buffer buf))
+ (dired test-dir)
+ (dired-toggle-read-only)
+ (let (names)
+ ;; Test that the file names are the same in Dired and WDired.
+ (while (not (eobp))
+ (should (equal (dired-get-filename 'no-dir t)
+ (wdired-get-filename t)))
+ (insert "w")
+ (push (wdired-get-filename t) names)
+ (dired-next-line 1))
+ (wdired-finish-edit)
+ ;; Test that editing the file names ignores the indicator
+ ;; character.
+ (let (dir)
+ (while (and (dired-previous-line 1)
+ (setq dir (dired-get-filename 'no-dir t)))
+ (should (equal dir (pop names)))))))
+ (kill-buffer (get-buffer test-dir))
+ (server-force-delete)
+ (delete-directory test-dir t))))
+
(provide 'wdired-tests)
;;; wdired-tests.el ends here