summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2022-12-01 04:05:49 +0200
committerDmitry Gutov <dgutov@yandex.ru>2022-12-01 04:09:14 +0200
commit785fa801596ad7bb9f838cac865f00de29e253d1 (patch)
tree0b060b78b9c920717a35c91a68cc330c3be85a5b /test
parent7a1f1825fd3108479556c57f153d11f305da1736 (diff)
downloademacs-785fa801596ad7bb9f838cac865f00de29e253d1.tar.gz
New user option: project-vc-extra-root-markers
* lisp/progmodes/project.el: Commentary update. (project-vc, project-vc-include-untracked, project-vc-name): Update docstrings. Rename 'VC project' to 'VC-aware project'. (project-vc-extra-root-markers): New option (bug#41572). (project-try-vc): Use it. Construct a single regexp from all and validate it using the MATCH argument of 'directory-files'. Call 'locate-dominating-file' directly. (project-ignores): Support VC-aware project instances with nil value of VC backend. * test/lisp/progmodes/project-tests.el (project-vc-recognizes-git) (project-vc-extra-root-markers-supports-wildcards) New tests. (project-tests--this-file): New variable.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/project-tests.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lisp/progmodes/project-tests.el b/test/lisp/progmodes/project-tests.el
index d4b6bca7e8f..55f3f499b39 100644
--- a/test/lisp/progmodes/project-tests.el
+++ b/test/lisp/progmodes/project-tests.el
@@ -110,4 +110,33 @@ When `project-ignores' includes a name matching project dir."
(list
(expand-file-name "some-file" dir)))))))
+(defvar project-tests--this-file (or (bound-and-true-p byte-compile-current-file)
+ (and load-in-progress load-file-name)
+ buffer-file-name))
+
+(ert-deftest project-vc-recognizes-git ()
+ "Check that Git repository is detected."
+ (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+ (let* ((vc-handled-backends '(Git))
+ (dir (file-name-directory project-tests--this-file))
+ (_ (vc-file-clearprops dir))
+ (project-vc-extra-root-markers nil)
+ (project (project-current nil dir)))
+ (should-not (null project))
+ (should (equal
+ "test/lisp/progmodes/project-tests.el"
+ (file-relative-name
+ project-tests--this-file
+ (project-root project))))))
+
+(ert-deftest project-vc-extra-root-markers-supports-wildcards ()
+ "Check that one can add wildcard entries."
+ (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+ (let* ((dir (file-name-directory project-tests--this-file))
+ (_ (vc-file-clearprops dir))
+ (project-vc-extra-root-markers '("files-x-tests.*"))
+ (project (project-current nil dir)))
+ (should-not (null project))
+ (should (string-match-p "/test/lisp/\\'" (project-root project)))))
+
;;; project-tests.el ends here