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

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

[elpa] externals/realgud 83d471f 008/140: return the set of features rem


From: Rocky Bernstein
Subject: [elpa] externals/realgud 83d471f 008/140: return the set of features removed, in realgud:unload-features()
Date: Sat, 25 May 2019 19:35:20 -0400 (EDT)

branch: externals/realgud
commit 83d471f0a286094f398b972d57de5c96ac0fc252
Author: Roy Mathew <address@hidden>
Commit: Roy Mathew <address@hidden>

    return the set of features removed, in realgud:unload-features()
---
 realgud.el           |  6 ++++--
 test/test-realgud.el | 27 +++++++++++++++++----------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/realgud.el b/realgud.el
index e5c8a6d..eb370df 100644
--- a/realgud.el
+++ b/realgud.el
@@ -123,8 +123,10 @@ that start with 'realgud-' and 'realgud:'"
 (defun realgud:unload-features()
   "Remove all features loaded from this package. Used in
 `realgud:reload-features'. See that."
-  (dolist (feature (realgud:loaded-features))
-       (unload-feature feature t)))
+  (let ((removal-set (realgud:loaded-features)))
+       (dolist (feature removal-set)
+         (unload-feature feature t))
+       removal-set)) ; return removed set
 
 (defun realgud:reload-features()
   "Reload all features loaded from this package. Useful if have
diff --git a/test/test-realgud.el b/test/test-realgud.el
index d5cf437..6cb1cab 100644
--- a/test/test-realgud.el
+++ b/test/test-realgud.el
@@ -1,10 +1,14 @@
-;; Manually run the test as follows:
-;; emacs --batch --no-site-file --no-splash --script setup.el --chdir 
PACAKGESDIR/realgud  -l test/test-realgud.el -f ert-run-tests-batch-and-exit
+;; Manually run these tests as follows:
+;;
+;; emacs --batch --no-site-file --no-splash \
+;;   --script setup.el --chdir PACAKGESDIR/realgud \
+;;   -l test/test-realgud.el -f ert-run-tests-batch-and-exit
 ;;
 ;; where setup.el looks something like:
-;; (add-to-list 'load-path "$HOME/.emacs.d/elpa/test-simple-20170117.411")
-;; (add-to-list 'load-path "$HOME/.emacs.d/elpa/load-relative-20160716.438")
-;; (add-to-list 'load-path "$HOME/.emacs.d/elpa/loc-changes-20160801.1008")
+;; (let ((elpa-dir (expand-file-name "~/.emacs.d/elpa")))
+;;   (add-to-list 'load-path (concat elpa-dir "/test-simple-20170117.411"))
+;;   (add-to-list 'load-path (concat elpa-dir "/load-relative-20160716.438"))
+;;   (add-to-list 'load-path (concat elpa-dir "/loc-changes-20160801.1008")))
 
 (defun realgud-test-helper()
   (delq nil
@@ -13,20 +17,23 @@
 
 (ert-deftest test-feature-unload()
 
-  ; no realgud features exist by default
+  ;; no realgud features exist by default
   (should (= 0 (length (realgud-test-helper))))
   (should-not (member 'realgud-pdb features))
 
   (load-file "realgud.el") ; manually load the first time
 
-  ; we should now have realgud features;
+  ;; we should now have realgud features;
   (should-not (= 0 (length (realgud-test-helper))))
   (should (member 'realgud-pdb features))
-  ; test at least 1 by name
+  ;; test at least 1 by name
   (should (member 'realgud-pdb features))
 
-  (realgud:unload-features) ; unload all and test
-  (should (= 0 (length (realgud-test-helper))))
+  ;; unload all and test
+  (let ((removed (realgud:unload-features)))
+       (should-not (= 0 (length removed)))) ; check that we return removed 
values
+  (let ((removed (realgud:unload-features))) ; should not err out if called on 
empty.
+       (should (= 0 (length removed))))
 
   (realgud:load-features) ; load and test
   (should-not (= 0 (length (realgud-test-helper))))



reply via email to

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