aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/uniquify-tests.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/lisp/uniquify-tests.el b/test/lisp/uniquify-tests.el
index abd61fa3504..e533c4b644c 100644
--- a/test/lisp/uniquify-tests.el
+++ b/test/lisp/uniquify-tests.el
@@ -88,6 +88,21 @@
88 '("a/dir/" "b/dir/"))) 88 '("a/dir/" "b/dir/")))
89 (mapc #'kill-buffer bufs))))) 89 (mapc #'kill-buffer bufs)))))
90 90
91(ert-deftest uniquify-home ()
92 "uniquify works, albeit confusingly, in the presence of directories named \"~\""
93 (let (bufs)
94 (save-excursion
95 (push (find-file-noselect "~") bufs)
96 (push (find-file-noselect "./~") bufs)
97 (should (equal (mapcar #'buffer-name bufs)
98 '("~<test>" "~<>")))
99 (push (find-file-noselect "~/foo") bufs)
100 (push (find-file-noselect "./~/foo") bufs)
101 (should (equal (mapcar #'buffer-name bufs)
102 '("foo<~>" "foo</nonexistent>" "~<test>" "~<>")))
103 (while bufs
104 (kill-buffer (pop bufs))))))
105
91(ert-deftest uniquify-rename-to-dir () 106(ert-deftest uniquify-rename-to-dir ()
92 "Giving a buffer a name which matches a directory doesn't rename the buffer" 107 "Giving a buffer a name which matches a directory doesn't rename the buffer"
93 (let ((uniquify-buffer-name-style 'forward) 108 (let ((uniquify-buffer-name-style 'forward)
@@ -125,5 +140,23 @@ uniquify-trailing-separator-p is ignored"
125 (should (equal (buffer-name) "| foo")) 140 (should (equal (buffer-name) "| foo"))
126 (kill-buffer))) 141 (kill-buffer)))
127 142
143(require 'project)
144(ert-deftest uniquify-project-transform ()
145 "`project-uniquify-dirname-transform' works"
146 (let ((uniquify-dirname-transform #'project-uniquify-dirname-transform)
147 (project-vc-name "foo1/bar")
148 bufs)
149 (save-excursion
150 (should (file-exists-p "../README"))
151 (push (find-file-noselect "../README") bufs)
152 (push (find-file-noselect "other/README") bufs)
153 (should (equal (mapcar #'buffer-name bufs)
154 '("README<other>" "README<bar>")))
155 (push (find-file-noselect "foo2/bar/README") bufs)
156 (should (equal (mapcar #'buffer-name bufs)
157 '("README<foo2/bar>" "README<other>" "README<foo1/bar>")))
158 (while bufs
159 (kill-buffer (pop bufs))))))
160
128(provide 'uniquify-tests) 161(provide 'uniquify-tests)
129;;; uniquify-tests.el ends here 162;;; uniquify-tests.el ends here