[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/realgud 8beb4f5 009/140: Merge pull request #182 from r
From: |
Rocky Bernstein |
Subject: |
[elpa] externals/realgud 8beb4f5 009/140: Merge pull request #182 from roymath/master |
Date: |
Sat, 25 May 2019 19:35:20 -0400 (EDT) |
branch: externals/realgud
commit 8beb4f5f2b2fd893dee853d23b09b979dcd30ba3
Merge: ad333ac 83d471f
Author: R. Bernstein <address@hidden>
Commit: GitHub <address@hidden>
Merge pull request #182 from roymath/master
fixed unload; added ert-based tests for realgud
---
realgud.el | 42 ++++++++-----------------------
test/test-realgud.el | 70 ++++++++++++++++++++++++++++++----------------------
2 files changed, 50 insertions(+), 62 deletions(-)
diff --git a/realgud.el b/realgud.el
index dde1b50..eb370df 100644
--- a/realgud.el
+++ b/realgud.el
@@ -113,42 +113,20 @@
)
(defun realgud:loaded-features()
- "Return a list of loaded debugger features. These are the
-features that start with 'realgud-' and also include standalone debugger
features
-like 'pydbgr'."
- (let ((result nil)
- (feature-str))
- (dolist (feature features result)
- (setq feature-str (symbol-name feature))
- (cond ((eq 't
- (string-prefix-p feature-str "realgud-"))
- (setq result (cons feature-str result)))
- ((eq 't
- (string-prefix-p feature-str "nodejs"))
- (setq result (cons feature-str result)))
- ((eq 't
- ;; No trailing '-' to get a plain "trepan".
- (string-prefix-p feature-str "trepan"))
- (setq result (cons feature-str result)))
- ((eq 't
- ;; No trailing '-' to get a plain "trepanx".
- (string-prefix-p feature-str "trepanx"))
- (setq result (cons feature-str result)))
- ('t nil))
- )
- )
-)
+ "Return a list of loaded debugger features. These are the features
+that start with 'realgud-' and 'realgud:'"
+
+ (delq nil
+ (mapcar (lambda (x) (and (string-match-p
"^\\(realgud:\\|realgud-\\)" (symbol-name x)) x))
+ features)))
(defun realgud:unload-features()
"Remove all features loaded from this package. Used in
`realgud:reload-features'. See that."
- (interactive "")
- (let ((result (realgud:loaded-features)))
- (dolist (feature result result)
- (unless (symbolp feature) (setq feature (make-symbol feature)))
- (if (featurep feature)
- (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 2e7d09e..6cb1cab 100644
--- a/test/test-realgud.el
+++ b/test/test-realgud.el
@@ -1,31 +1,41 @@
-;; Press C-x C-e at the end of the next line to run this file test
non-interactively
-;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory
(locate-library "test-simple.elc")) buffer-file-name)
+;; 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:
+;; (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
+ (mapcar (lambda (x) (and (string-match-p
"^\\(realgud:\\|realgud-\\)" (symbol-name x)) x))
+ features)))
+
+(ert-deftest test-feature-unload()
+
+ ;; 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;
+ (should-not (= 0 (length (realgud-test-helper))))
+ (should (member 'realgud-pdb features))
+ ;; test at least 1 by name
+ (should (member 'realgud-pdb features))
+
+ ;; 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))))
+ (should (member 'realgud-pdb features)))
-(require 'test-simple)
-(load-file "../realgud.el")
-
-(declare-function realgud:loaded-features 'realgud)
-(declare-function realgud:unload-features 'realgud-regexp)
-(declare-function __FILE__ 'load-relative)
-
-(test-simple-start)
-
-(eval-when-compile
- (defvar test-realgud:features)
-)
-
-(note "realgud")
-
-(note "realgud:loaded-features")
-(set (make-local-variable 'test-realgud:features) (realgud:loaded-features))
-;; (dolist (feature '(realgud-trepan
-;; realgud-core))
-;; (assert-t (not (not (member feature test-realgud:features)))) )
-
-(note "realgud-unload-features")
-(load-file "../realgud.el")
-(assert-nil (not (realgud:loaded-features)))
-(assert-nil (not (realgud:unload-features)))
-(realgud:loaded-features)
-
-(end-tests)
- [elpa] branch externals/realgud created (now 7c0acdc), Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud d026e8b 001/140: Start macro for delayed-, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud dcb87ed 004/140: Merge pull request #177 from realgud/fringe-arrow, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 3d0fcb8 002/140: Match nested prompts in python trepan debuggers, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud ad333ac 006/140: realgud-bp-line-{en/di}sabled-face change..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud b3719fa 005/140: Add autoloads for defalias debugger invocations, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 839954a 016/140: Add more default commands modelled from gdb, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud f884fe7 003/140: Simplify and perhaps generalize, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 7c0d2c4 007/140: fixed unload; added ert-based tests for realgud, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 0647be7 015/140: Spelling typos, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 8beb4f5 009/140: Merge pull request #182 from roymath/master,
Rocky Bernstein <=
- [elpa] externals/realgud 211c01a 014/140: Fix misfeatures in install-from-git.sh..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 3f1b98f 010/140: (realgud:load-features) now features loaded, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 50dc7db 022/140: Info ..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud c7594f0 032/140: wrong 'let' syntax - caught thanks to the jodonnell's test!, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 37ba671 037/140: Comment better a track test, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud eeb4c2f 013/140: Bug in last commit., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 811e7b9 036/140: < -> <=. See comment before, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 2295d94 024/140: making eval print to the message area, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 83d471f 008/140: return the set of features removed, in realgud:unload-features(), Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud f41b7a7 017/140: When a breakpoint is seen, add source..., Rocky Bernstein, 2019/05/25