summaryrefslogtreecommitdiff
path: root/test/lisp/help-fns-tests.el
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2019-08-24 01:02:04 +0200
committerStefan Kangas <stefankangas@gmail.com>2020-02-04 02:04:20 +0100
commit557b790e0a3fcb2cd4196a3119da3e92647f8def (patch)
treef2b6aaf62ae10fea500af2c09296eab5f5a1ab37 /test/lisp/help-fns-tests.el
parentf9504ffba2e2604338c243dd77c877bbb8162e4a (diff)
downloademacs-557b790e0a3fcb2cd4196a3119da3e92647f8def.tar.gz
Add new help command describe-keymap
* lisp/help-fns.el (describe-keymap): New command to show key bindings for a given keymap. (Bug#30660) * doc/emacs/help.texi (Misc Help): Document the new command. * doc/lispref/keymaps.texi (Scanning Keymaps): Add a cross-reference to the above documentation. * etc/NEWS: Announce the new command. * test/lisp/help-fns-tests.el (help-fns-test-describe-keymap/symbol) (help-fns-test-describe-keymap/value) (help-fns-test-describe-keymap/not-keymap) (help-fns-test-describe-keymap/let-bound) (help-fns-test-describe-keymap/dynamically-bound-no-file): New tests. Co-authored-by: Drew Adams <drew.adams@oracle.com>
Diffstat (limited to 'test/lisp/help-fns-tests.el')
-rw-r--r--test/lisp/help-fns-tests.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index ef42d4bda29..1d6c062979f 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -123,4 +123,32 @@ Return first line of the output of (describe-function-1 FUNC)."
(goto-char (point-min))
(should (looking-at "^font-lock-comment-face is "))))
+
+;;; Tests for describe-keymap
+(ert-deftest help-fns-test-describe-keymap/symbol ()
+ (describe-keymap 'minibuffer-local-must-match-map)
+ (with-current-buffer "*Help*"
+ (should (looking-at "^minibuffer-local-must-match-map is"))))
+
+(ert-deftest help-fns-test-describe-keymap/value ()
+ (describe-keymap minibuffer-local-must-match-map)
+ (with-current-buffer "*Help*"
+ (should (looking-at "^key"))))
+
+(ert-deftest help-fns-test-describe-keymap/not-keymap ()
+ (should-error (describe-keymap nil))
+ (should-error (describe-keymap emacs-version)))
+
+(ert-deftest help-fns-test-describe-keymap/let-bound ()
+ (let ((foobar minibuffer-local-must-match-map))
+ (describe-keymap foobar)
+ (with-current-buffer "*Help*"
+ (should (looking-at "^key")))))
+
+(ert-deftest help-fns-test-describe-keymap/dynamically-bound-no-file ()
+ (setq help-fns-test--describe-keymap-foo minibuffer-local-must-match-map)
+ (describe-keymap 'help-fns-test--describe-keymap-foo)
+ (with-current-buffer "*Help*"
+ (should (looking-at "^help-fns-test--describe-keymap-foo is"))))
+
;;; help-fns-tests.el ends here