aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorRobert Pluim2023-03-18 10:33:39 +0100
committerRobert Pluim2023-03-18 10:37:15 +0100
commitaedb9e3ec37512e4e2c1a6066613b2b5fcaf2aa6 (patch)
treee88035d06092592384185daf1c0222969f14f9a6 /test/src
parentfaee8d507387f72e61fa809326e12703b4ba20b2 (diff)
downloademacs-aedb9e3ec37512e4e2c1a6066613b2b5fcaf2aa6.tar.gz
emacs-aedb9e3ec37512e4e2c1a6066613b2b5fcaf2aa6.zip
Add tests for Bug#62207
* test/src/keymap-tests.el (keymap-unset-test-remove-and-inheritance): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/keymap-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el
index aa710519825..29220c95395 100644
--- a/test/src/keymap-tests.el
+++ b/test/src/keymap-tests.el
@@ -475,6 +475,24 @@ g .. h foo
475 "a" #'next-line 475 "a" #'next-line
476 "a" #'previous-line))) 476 "a" #'previous-line)))
477 477
478(ert-deftest keymap-unset-test-remove-and-inheritance ()
479 "Check various behaviors of keymap-unset. (Bug#62207)"
480 (let ((map (make-sparse-keymap))
481 (parent (make-sparse-keymap)))
482 (set-keymap-parent map parent)
483 ;; Removing an unset key should not add a key.
484 (keymap-set parent "u" #'undo)
485 (keymap-unset map "u" t)
486 (should (equal (keymap-lookup map "u") #'undo))
487 ;; Non-removed child bindings should shadow parent
488 (keymap-set map "u" #'identity)
489 (keymap-unset map "u")
490 ;; From the child, but nil.
491 (should-not (keymap-lookup map "u"))
492 (keymap-unset map "u" t)
493 ;; From the parent this time/
494 (should (equal (keymap-lookup map "u") #'undo))))
495
478(provide 'keymap-tests) 496(provide 'keymap-tests)
479 497
480;;; keymap-tests.el ends here 498;;; keymap-tests.el ends here