aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorPaul Eggert2019-07-24 14:28:13 -0700
committerPaul Eggert2019-07-24 14:33:02 -0700
commita5063aa8b174db286a0e83b8ffdd4e65c521f733 (patch)
treedc439d78ecef638817f98cb7e43868fa2ab7b856 /test/src
parente089c3141a51bf70b91da21a01cdb4be0b63c08d (diff)
downloademacs-a5063aa8b174db286a0e83b8ffdd4e65c521f733.tar.gz
emacs-a5063aa8b174db286a0e83b8ffdd4e65c521f733.zip
Do not treat ~nosuchuser as an absolute file name
Derived from Ken Brown’s patch (Bug#36502#97). * doc/lispref/files.texi (Relative File Names): * etc/NEWS: Document this. * src/fileio.c (user_homedir): New function. (Fexpand_file_name, file_name_absolute_p): Use it. (search_embedded_absfilename): Simplify via file_name_absolute_p. * test/src/fileio-tests.el (fileio-tests--no-such-user): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fileio-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index 813ee5f798f..09a5b147e1d 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -136,3 +136,14 @@ Also check that an encoding error can appear in a symlink."
136 (name (expand-file-name "bar"))) 136 (name (expand-file-name "bar")))
137 (should (and (file-name-absolute-p name) 137 (should (and (file-name-absolute-p name)
138 (not (eq (aref name 0) ?~)))))) 138 (not (eq (aref name 0) ?~))))))
139
140(ert-deftest fileio-tests--no-such-user ()
141 "Test file-name-absolute-p on ~nosuchuser."
142 (unless (user-full-name "nosuchuser")
143 (should (not (file-name-absolute-p "~nosuchuser")))
144 (should (not (file-name-absolute-p "~nosuchuser/")))
145 (should (not (file-name-absolute-p "~nosuchuser//")))
146 (should (not (file-name-absolute-p "~nosuchuser/foo")))
147 (should (not (file-name-absolute-p "~nosuchuser/foo/")))
148 (should (not (file-name-absolute-p "~nosuchuser/foo//")))
149 (should (not (file-name-absolute-p "~nosuchuser/foo/bar")))))