emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 aedb9e3ec37: Add tests for Bug#62207


From: Robert Pluim
Subject: emacs-29 aedb9e3ec37: Add tests for Bug#62207
Date: Sat, 18 Mar 2023 05:43:10 -0400 (EDT)

branch: emacs-29
commit aedb9e3ec37512e4e2c1a6066613b2b5fcaf2aa6
Author: Robert Pluim <rpluim@gmail.com>
Commit: Robert Pluim <rpluim@gmail.com>

    Add tests for Bug#62207
    
    * test/src/keymap-tests.el (keymap-unset-test-remove-and-inheritance):
    New test.
---
 test/src/keymap-tests.el | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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
        "a" #'next-line
        "a" #'previous-line)))
 
+(ert-deftest keymap-unset-test-remove-and-inheritance ()
+  "Check various behaviors of keymap-unset.  (Bug#62207)"
+  (let ((map (make-sparse-keymap))
+        (parent (make-sparse-keymap)))
+    (set-keymap-parent map parent)
+    ;; Removing an unset key should not add a key.
+    (keymap-set parent "u" #'undo)
+    (keymap-unset map "u" t)
+    (should (equal (keymap-lookup map "u") #'undo))
+    ;; Non-removed child bindings should shadow parent
+    (keymap-set map "u" #'identity)
+    (keymap-unset map "u")
+    ;; From the child, but nil.
+    (should-not (keymap-lookup map "u"))
+    (keymap-unset map "u" t)
+    ;; From the parent this time/
+    (should (equal (keymap-lookup map "u") #'undo))))
+
 (provide 'keymap-tests)
 
 ;;; keymap-tests.el ends here



reply via email to

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