aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorEli Zaretskii2020-09-03 20:16:33 +0300
committerEli Zaretskii2020-09-03 20:16:33 +0300
commita4e45a13b65c496a0c53b58992a4be2e3d923325 (patch)
tree6099898ab7c01152d43130432f4e2fccb7dac855 /test/src
parent8cb15183aa8faba4af52d7b87e5ee4dcd3b1104f (diff)
downloademacs-a4e45a13b65c496a0c53b58992a4be2e3d923325.tar.gz
emacs-a4e45a13b65c496a0c53b58992a4be2e3d923325.zip
Fix 'expand-file-name' for remote files
This reverts most of commit 14fb657ba82da346d36f05f88da26f1c5498b798 and its followup fixes, and instead fixes the original bugs in a different manner that doesn't affect any unrelated use cases. As part of this, the code which caused 'expand-file-name' to enforce a trailing slash on expanded directories is removed, as this kind of semantic processing is outside of 'expand-file-name's scope. * src/fileio.c (Fexpand_file_name): If expanding default_directory yields a remote file name, call its handlers. (Bug#26911) (Bug#34834) * doc/lispref/files.texi (File Name Expansion): Remove the requirement that expanding a directory name yields a directory name, i.e. that the expansion must end in a slash. * etc/NEWS: Remove the announcement of the changed behavior of 'expand-file-name' wrt trailing slashes. * test/src/fileio-tests.el (fileio-tests--HOME-trailing-slash) (fileio-tests--expand-file-name-trailing-slash): Remove tests. * test/lisp/net/tramp-tests.el (tramp-test05-expand-file-name): No need to expect different results in Emacs 28 and later.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fileio-tests.el37
1 files changed, 0 insertions, 37 deletions
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index bedda83bbdb..ed381d151ee 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -107,43 +107,6 @@ Also check that an encoding error can appear in a symlink."
107 (setenv "HOME" "x:foo") 107 (setenv "HOME" "x:foo")
108 (should (equal (expand-file-name "~/bar") "x:/foo/bar"))))) 108 (should (equal (expand-file-name "~/bar") "x:/foo/bar")))))
109 109
110(ert-deftest fileio-tests--HOME-trailing-slash ()
111 "Test that expand-file-name of \"~\" respects trailing slash."
112 :expected-result (if (memq system-type '(windows-nt ms-dos))
113 :failed
114 :passed)
115 (let ((process-environment (copy-sequence process-environment)))
116 (dolist (home
117 (if (memq system-type '(windows-nt ms-dos))
118 '("c:/a/b/c" "c:/a/b/c/")
119 '("/a/b/c" "/a/b/c/")))
120 (setenv "HOME" home)
121 (should (equal (expand-file-name "~") (expand-file-name home))))))
122
123(ert-deftest fileio-tests--expand-file-name-trailing-slash ()
124 (dolist (fooslashalias '("foo/" "foo//" "foo/." "foo//." "foo///././."
125 "foo/a/.."))
126 (if (memq system-type '(windows-nt ms-dos))
127 (progn
128 (should (equal (expand-file-name fooslashalias "c:/") "c:/foo/"))
129 (should (equal (expand-file-name (concat "c:/" fooslashalias))
130 "c:/foo/"))
131 (should (equal (expand-file-name "." "c:/usr/spool/")
132 "c:/usr/spool/"))
133 (should (equal (expand-file-name "" "c:/usr/spool/")
134 "c:/usr/spool/")))
135 (should (equal (expand-file-name fooslashalias "/") "/foo/"))
136 (should (equal (expand-file-name (concat "/" fooslashalias)) "/foo/"))
137 (should (equal (expand-file-name "." "/usr/spool/") "/usr/spool/"))
138 (should (equal (expand-file-name "" "/usr/spool/") "/usr/spool/"))))
139 ;; Trailing "B/C/.." means B must be a directory.
140 (if (memq system-type '(windows-nt ms-dos))
141 (progn
142 (should (equal (expand-file-name "c:/a/b/c/..") "c:/a/b/"))
143 (should (equal (expand-file-name "c:/a/b/c/../") "c:/a/b/")))
144 (should (equal (expand-file-name "/a/b/c/..") "/a/b/"))
145 (should (equal (expand-file-name "/a/b/c/../") "/a/b/"))))
146
147(ert-deftest fileio-tests--insert-file-interrupt () 110(ert-deftest fileio-tests--insert-file-interrupt ()
148 (let ((text "-*- coding: binary -*-\n\xc3\xc3help") 111 (let ((text "-*- coding: binary -*-\n\xc3\xc3help")
149 f) 112 f)