diff options
| author | Bozhidar Batsov <bozhidar@toptal.com> | 2026-04-25 23:15:26 +0100 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar@toptal.com> | 2026-04-25 23:15:26 +0100 |
| commit | 31a5723acce2c4f31b77aaa611c3fe7c47387b93 (patch) | |
| tree | 13fd157923e9bebadc1235fd344de2e9ff8e40a9 /test | |
| parent | 1d330eb5bece7e0bad347cf2e93209e0e1d45bf0 (diff) | |
Fire the + glob keep warning once per project
The other two dirconfig warnings (alien-mode bypass and prefix-less
entries) are gated by per-project hash sets so they fire at most
once per Emacs session. The glob-keep warning was the odd one out —
it lived inside the uncached parser and re-fired on every cache
miss, and it emitted one display-warning per offending entry rather
than a single consolidated message.
Move it into the cached wrapper alongside the others, gate it on
projectile--glob-keep-warned-projects, and roll multiple offending
entries into one warning that lists them.
Diffstat (limited to 'test')
| -rw-r--r-- | test/projectile-test.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/projectile-test.el b/test/projectile-test.el index 9516ff1..4faf8ae 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) |
