aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGlenn Morris2017-11-21 12:27:36 -0500
committerGlenn Morris2017-11-21 12:27:36 -0500
commit92f0c4cd56d4dc1a92c116172404e65996c5884d (patch)
treeeb506e142f9ebace0013b3d5e25f4f4dfaad958f /test
parent8d450453fae4518f79f7f951d8c70e11f887a934 (diff)
downloademacs-92f0c4cd56d4dc1a92c116172404e65996c5884d.tar.gz
emacs-92f0c4cd56d4dc1a92c116172404e65996c5884d.zip
Avoid bogus abbreviated file names if HOME changes
* lisp/files.el (abbreviate-file-name): If HOME changes, ignore `abbreviated-home-dir'. (Bug#19657#20) * test/lisp/files-tests.el (files-test-abbreviated-home-dir): New.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/files-tests.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 285a884b695..732b3c02379 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -411,5 +411,19 @@ name (Bug#28412)."
411 (should (file-directory-p (concat (file-name-as-directory dest2) "a"))) 411 (should (file-directory-p (concat (file-name-as-directory dest2) "a")))
412 (delete-directory dir 'recursive))) 412 (delete-directory dir 'recursive)))
413 413
414(ert-deftest files-test-abbreviated-home-dir ()
415 "Test that changing HOME does not confuse `abbreviate-file-name'.
416See <https://debbugs.gnu.org/19657#20>."
417 (let* ((homedir temporary-file-directory)
418 (process-environment (cons (format "HOME=%s" homedir)
419 process-environment))
420 (abbreviated-home-dir nil)
421 (testfile (expand-file-name "foo" homedir))
422 (old (file-truename (abbreviate-file-name testfile)))
423 (process-environment (cons (format "HOME=%s"
424 (expand-file-name "bar" homedir))
425 process-environment)))
426 (should (equal old (file-truename (abbreviate-file-name testfile))))))
427
414(provide 'files-tests) 428(provide 'files-tests)
415;;; files-tests.el ends here 429;;; files-tests.el ends here