aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDmitry Gutov2023-01-28 03:17:39 +0200
committerDmitry Gutov2023-01-28 03:20:29 +0200
commit128a999bfe7ebafd78e2b463586156fc6972181d (patch)
tree4658b7708be275494704bbdab35b5d16fe88ce02 /test
parent194bc97879d2b57545eda17dbeb0b2e46b215617 (diff)
downloademacs-128a999bfe7ebafd78e2b463586156fc6972181d.tar.gz
emacs-128a999bfe7ebafd78e2b463586156fc6972181d.zip
Make project-current not error out inside non-existent dirs
* lisp/progmodes/project.el (project-try-vc): Use condition-case to catch 'file-missing' (bug#61107). * test/lisp/progmodes/project-tests.el (project-vc-nonexistent-directory-no-error): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/project-tests.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/progmodes/project-tests.el b/test/lisp/progmodes/project-tests.el
index aea0666629d..5a206b67db1 100644
--- a/test/lisp/progmodes/project-tests.el
+++ b/test/lisp/progmodes/project-tests.el
@@ -152,4 +152,14 @@ When `project-ignores' includes a name matching project dir."
152 (should (equal '(".dir-locals.el" "foo") 152 (should (equal '(".dir-locals.el" "foo")
153 (mapcar #'file-name-nondirectory (project-files project)))))) 153 (mapcar #'file-name-nondirectory (project-files project))))))
154 154
155(ert-deftest project-vc-nonexistent-directory-no-error ()
156 "Check that is doesn't error out when the current dir does not exist."
157 (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
158 (let* ((dir (expand-file-name "foo-456/bar/" (ert-resource-directory)))
159 (_ (vc-file-clearprops dir))
160 (project-vc-extra-root-markers '(".dir-locals.el"))
161 (project (project-current nil dir)))
162 (should-not (null project))
163 (should (string-match-p "/test/lisp/progmodes/project-resources/\\'" (project-root project)))))
164
155;;; project-tests.el ends here 165;;; project-tests.el ends here