emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pacmacs 8166e4d3d7 363/472: Merge pull request #181 from c


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs 8166e4d3d7 363/472: Merge pull request #181 from codingteam/terrified-timer-reset-173
Date: Thu, 6 Jan 2022 21:59:39 -0500 (EST)

branch: elpa/pacmacs
commit 8166e4d3d73011267cd13335d4a5c698f87b2adb
Merge: ebeba826ce 70d381a0ca
Author: Alexey Kutepov <reximkut@gmail.com>
Commit: Alexey Kutepov <reximkut@gmail.com>

    Merge pull request #181 from codingteam/terrified-timer-reset-173
    
    Reset terrified timer on eating BP
---
 pacmacs.el           |  7 +++++--
 test/pacmacs-test.el | 10 ++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/pacmacs.el b/pacmacs.el
index 03356b11d1..84e60017cc 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -439,9 +439,12 @@
   terrified-ghost)
 
 (defun pacmacs--terrify-all-ghosts ()
+  (dolist (terrified-ghost pacmacs--terrified-ghosts)
+    (pacmacs--terrify-ghost terrified-ghost))
+
   (dolist (ghost pacmacs--ghosts)
-    (add-to-list 'pacmacs--terrified-ghosts
-                 (pacmacs--terrify-ghost ghost)))
+    (push (pacmacs--terrify-ghost ghost)
+          pacmacs--terrified-ghosts))
   (setq pacmacs--ghosts nil))
 
 (defun pacmacs--unterrify-timed-out-ghosts ()
diff --git a/test/pacmacs-test.el b/test/pacmacs-test.el
index f146abea6f..1b1e08c238 100644
--- a/test/pacmacs-test.el
+++ b/test/pacmacs-test.el
@@ -116,3 +116,13 @@
            (list :terrified-timer 0)))
   (should (pacmacs--terrified-ghost-timed-out-p
            (list :terrified-timer -1))))
+
+(ert-deftest pacmacs--terrify-all-ghosts-test ()
+  (let* ((pacmacs--terrified-ghosts (number-sequence 1 5))
+         (pacmacs--ghosts (number-sequence 1 6)))
+    (with-mock
+     (mock (pacmacs--terrify-ghost *) => 42 :times 11)
+     (pacmacs--terrify-all-ghosts)
+
+     (should (null pacmacs--ghosts))
+     (should (= 11 (length pacmacs--terrified-ghosts))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]