summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-01-13 18:54:09 +0100
committerStefan Kangas <stefan@marxist.se>2021-01-13 18:54:09 +0100
commita9658cd5b07e88a5d413cbb4dfd8f9d9d0c8bbf5 (patch)
tree6c4703b44fd8f46052abce1dddb3ab26741dc5e3 /test
parentbe9b7e83bc4191aff01c692be0f7a156ec4056da (diff)
downloademacs-a9658cd5b07e88a5d413cbb4dfd8f9d9d0c8bbf5.tar.gz
Lift {global,local}-key-binding to Lisp
* lisp/subr.el (local-key-binding, global-key-binding): New defuns. * src/keymap.c (Flocal_key_binding, Fglobal_key_binding): Remove DEFUNs. (syms_of_keymap): Remove defsubrs for above DEFUNs. * test/lisp/subr-tests.el (subr-test-local-key-binding) (subr-test-global-key-binding): New tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/subr-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index e0826208b60..fc5a1eba6d8 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -87,6 +87,17 @@
;; Returns the symbol.
(should (eq (define-prefix-command 'foo-bar) 'foo-bar)))
+(ert-deftest subr-test-local-key-binding ()
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (should (keymapp (local-key-binding [menu-bar])))
+ (should-not (local-key-binding [f12]))))
+
+(ert-deftest subr-test-global-key-binding ()
+ (should (eq (global-key-binding [f1]) 'help-command))
+ (should (eq (global-key-binding "x") 'self-insert-command))
+ (should-not (global-key-binding [f12])))
+
;;;; Mode hooks.