aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.dev>2026-04-26 01:31:03 +0300
committerGitHub <noreply@github.com>2026-04-26 01:31:03 +0300
commit6bb29099114cf68077c4a15f1bde1b323cba5fe6 (patch)
tree535e740dea50d8dfc23a052b6835a7b60696e270 /test
parent1d330eb5bece7e0bad347cf2e93209e0e1d45bf0 (diff)
parent4d6c1a16af2c12bc369de7c5e4078cd0281a5271 (diff)
Merge pull request #1995 from bbatsov/dirconfig-polish
Polish: align dirconfig warnings, robust cache key, small cleanups
Diffstat (limited to 'test')
-rw-r--r--test/projectile-test.el27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/projectile-test.el b/test/projectile-test.el
index 9516ff1..b62224a 100644
--- a/test/projectile-test.el
+++ b/test/projectile-test.el
@@ -559,6 +559,10 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'.
:to-equal '(:legacy-ignore . "#may-be-a-comment")))))
(describe "projectile-parse-dirconfig-file"
+ (before-each
+ (clrhash projectile--dirconfig-cache)
+ (clrhash projectile--glob-keep-warned-projects)
+ (clrhash projectile--prefixless-dirconfig-warned-projects))
(it "parses dirconfig and returns directories to ignore and keep"
(spy-on 'file-exists-p :and-return-value t)
(spy-on 'file-truename :and-call-fake (lambda (filename) filename))
@@ -614,13 +618,14 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'.
(let ((projectile-dirconfig-comment-prefix ?#))
(expect (projectile-parse-dirconfig-file)
:to-equal (make-projectile-dirconfig :ignore '("keep-this")))))
- (it "warns when a + keep entry contains glob metacharacters"
+ (it "warns once per project even when multiple + entries contain globs"
(spy-on 'file-exists-p :and-return-value t)
(spy-on 'insert-file-contents :and-call-fake
(lambda (_filename)
- (save-excursion (insert "+/*.json\n+/src\n"))))
+ (save-excursion (insert "+/*.json\n+/src\n+/[abc]/lib\n"))))
(spy-on 'display-warning)
(projectile-parse-dirconfig-file)
+ (projectile-parse-dirconfig-file)
(expect 'display-warning :to-have-been-called-times 1))
(it "does not warn for plain + subdirectory entries"
(spy-on 'file-exists-p :and-return-value t)
@@ -741,7 +746,23 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'.
(projectile-parse-dirconfig-file)
(expect (gethash root projectile--dirconfig-cache) :not :to-be nil)
(projectile-invalidate-cache nil)
- (expect (gethash root projectile--dirconfig-cache) :to-be nil))))))
+ (expect (gethash root projectile--dirconfig-cache) :to-be nil)))))
+ (it "re-parses when projectile-dirconfig-file points to a different file"
+ (projectile-test-with-sandbox
+ (projectile-test-with-files
+ ("project/")
+ (let ((root (file-truename (expand-file-name "project/"))))
+ (with-temp-file (expand-file-name ".projectile" root)
+ (insert "-foo\n"))
+ (with-temp-file (expand-file-name ".projectile-alt" root)
+ (insert "-bar\n"))
+ (spy-on 'projectile-project-root :and-return-value root)
+ (let ((projectile-dirconfig-file ".projectile"))
+ (expect (projectile-dirconfig-ignore (projectile-parse-dirconfig-file))
+ :to-equal '("foo")))
+ (let ((projectile-dirconfig-file ".projectile-alt"))
+ (expect (projectile-dirconfig-ignore (projectile-parse-dirconfig-file))
+ :to-equal '("bar"))))))))
(describe "prefix-less dirconfig warning"
(before-each