From dc8b336d0254d751ffcb2466a20a650ca9c5f86a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 14 Oct 2023 09:34:40 +0200 Subject: * lisp/files.el (file-name-non-special): Handle quoted tilde. (Bug#65685) * test/lisp/files-tests.el (files-tests-file-name-non-special-expand-file-name-tilde): New test. --- test/lisp/files-tests.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index aadb60e1de7..8f6495a293c 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -662,6 +662,23 @@ unquoted file names." (files-tests--with-temp-non-special-and-file-name-handler (tmpfile nospecial) (should (equal (expand-file-name nospecial) nospecial)))) +(ert-deftest files-tests-file-name-non-special-expand-file-name-tilde () + (let ((process-environment + (cons (format "HOME=%s" temporary-file-directory) process-environment)) + abbreviated-home-dir) + (files-tests--with-temp-non-special (tmpfile nospecial) + (let (file-name-handler-alist) + (setq nospecial (file-name-quote (abbreviate-file-name tmpfile)))) + (should (equal (expand-file-name nospecial) + (expand-file-name (file-name-unquote nospecial t))))) + (files-tests--with-temp-non-special-and-file-name-handler (tmpfile nospecial) + (let (file-name-handler-alist) + (setq nospecial (file-name-quote (abbreviate-file-name tmpfile)))) + (should-not + (equal (expand-file-name nospecial) + ;; The file name handler deletes the ".special" extension. + (expand-file-name (file-name-unquote nospecial t))))))) + (ert-deftest files-tests-file-name-non-special-file-accessible-directory-p () (files-tests--with-temp-non-special (tmpdir nospecial-dir t) (should (file-accessible-directory-p nospecial-dir))) -- cgit v1.2.1