summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/project-tests.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2023-01-28 03:17:39 +0200
committerDmitry Gutov <dgutov@yandex.ru>2023-01-28 03:20:29 +0200
commit128a999bfe7ebafd78e2b463586156fc6972181d (patch)
tree4658b7708be275494704bbdab35b5d16fe88ce02 /test/lisp/progmodes/project-tests.el
parent194bc97879d2b57545eda17dbeb0b2e46b215617 (diff)
downloademacs-128a999bfe7ebafd78e2b463586156fc6972181d.tar.gz
emacs-128a999bfe7ebafd78e2b463586156fc6972181d.tar.bz2
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/lisp/progmodes/project-tests.el')
-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."
(should (equal '(".dir-locals.el" "foo")
(mapcar #'file-name-nondirectory (project-files project))))))
+(ert-deftest project-vc-nonexistent-directory-no-error ()
+ "Check that is doesn't error out when the current dir does not exist."
+ (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+ (let* ((dir (expand-file-name "foo-456/bar/" (ert-resource-directory)))
+ (_ (vc-file-clearprops dir))
+ (project-vc-extra-root-markers '(".dir-locals.el"))
+ (project (project-current nil dir)))
+ (should-not (null project))
+ (should (string-match-p "/test/lisp/progmodes/project-resources/\\'" (project-root project)))))
+
;;; project-tests.el ends here