[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/projectile 70d03fb699: Fix tests to not modify top level .
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/projectile 70d03fb699: Fix tests to not modify top level .dir-locals.el file |
Date: |
Wed, 14 Aug 2024 13:00:43 -0400 (EDT) |
branch: elpa/projectile
commit 70d03fb6997408306cca5e0dd6ce6022aed88386
Author: Jules Tamagnan <jtamagnan@gmail.com>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>
Fix tests to not modify top level .dir-locals.el file
---
projectile.el | 14 ++++++++------
test/projectile-test.el | 18 +++++++++++++-----
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/projectile.el b/projectile.el
index d89ecc45ca..eee1cbb30b 100644
--- a/projectile.el
+++ b/projectile.el
@@ -2503,9 +2503,10 @@ With a prefix arg INVALIDATE-CACHE invalidates the cache
first."
Parameters MODE VARIABLE VALUE are passed directly to
`add-dir-local-variable'."
(let ((inhibit-read-only t)
(default-directory (projectile-acquire-root)))
- (add-dir-local-variable mode variable value)
- (save-buffer)
- (kill-buffer)))
+ (save-selected-window
+ (add-dir-local-variable mode variable value)
+ (save-buffer)
+ (kill-buffer))))
;;;###autoload
(defun projectile-delete-dir-local-variable (mode variable)
@@ -2515,9 +2516,10 @@ Parameters MODE VARIABLE VALUE are passed directly to
`delete-dir-local-variable'."
(let ((inhibit-read-only t)
(default-directory (projectile-acquire-root)))
- (delete-dir-local-variable mode variable)
- (save-buffer)
- (kill-buffer)))
+ (save-selected-window
+ (delete-dir-local-variable mode variable)
+ (save-buffer)
+ (kill-buffer))))
;;;; Sorting project files
diff --git a/test/projectile-test.el b/test/projectile-test.el
index 7a2f10c034..1ae331d604 100644
--- a/test/projectile-test.el
+++ b/test/projectile-test.el
@@ -1051,20 +1051,28 @@ Just delegates OPERATION and ARGS for all operations
except for`shell-command`'.
"project/.projectile")
(append-to-file
"((nil . ((foo . bar))))" nil "project/.dir-locals.el")
- (with-current-buffer (find-file-noselect "project/.projectile"
t)
- (let ((enable-local-variables :all))
- (hack-dir-local-variables-non-file-buffer)
+ (let ((enable-local-variables :all))
+ (with-current-buffer (find-file-noselect
"project/.projectile" t)
+ ;; Reload the file to ensure that this file wasn't already
+ ;; opened from a previous test
+ (revert-buffer :ignore-auto :noconfirm)
+ ;; Heck that the variable is bound
(expect (boundp 'foo) :to-be 't)
-
+ ;; Remove the variable
(projectile-delete-dir-local-variable nil 'foo)
- (expect (boundp 'foo) :to-be nil) ))))))
+ ;; Reload the file
+ (revert-buffer :ignore-auto :noconfirm)
+ ;; Check that the variable is unbound
+ (expect (boundp 'foo) :to-be nil)))))))
(describe "projectile-add-dir-local-variable"
(it "Adds new dir-local variables"
(projectile-test-with-sandbox
(projectile-test-with-files
("project/"
+ "project/.dir-locals.el"
"project/.projectile")
+ (append-to-file "()" nil "project/.dir-locals.el")
(with-current-buffer (find-file-noselect "project/.projectile"
t)
(let ((enable-local-variables :all))
(expect (boundp 'fooo) :to-be nil)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/projectile 70d03fb699: Fix tests to not modify top level .dir-locals.el file,
ELPA Syncer <=