[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map 76b8e2ab6c 85/97: Add tests for inheritance
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map 76b8e2ab6c 85/97: Add tests for inheritance |
Date: |
Thu, 20 Jan 2022 07:59:28 -0500 (EST) |
branch: elpa/bind-map
commit 76b8e2ab6c5d5e105eb5d83686e0b552fe029550
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Add tests for inheritance
---
bind-map-tests.el | 77 +++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 60 insertions(+), 17 deletions(-)
diff --git a/bind-map-tests.el b/bind-map-tests.el
index c83149cf2d..3736725957 100644
--- a/bind-map-tests.el
+++ b/bind-map-tests.el
@@ -41,30 +41,33 @@
tmpmap2-active
tmpmap2-prefix
bind-map-major-modes-alist
+ minor-mode-alist
minor-mode-map-alist)
- (bind-map tmpmap2
- :major-modes (emacs-lisp-mode)
- :keys ("C-a")
- :evil-keys ("a")
- :evil-states (motion))
- (evil-normalize-keymaps)
- (emacs-lisp-mode)
- (define-key tmpmap2 "a" "b")
- (message "%s" (pp bind-map-major-modes-alist))
- (should (equal (cdr (assoc 'tmpmap2-active bind-map-major-modes-alist))
- '(emacs-lisp-mode)))
- (should tmpmap2-active)
- (should (string= (key-binding "\C-aa") "b"))
- (should (keymapp (lookup-key (evil-get-auxiliary-keymap tmpmap2-root-map
'motion) "a")))
- (should (string= (lookup-key (evil-get-auxiliary-keymap tmpmap2-root-map
'motion) "aa") "b"))
- (should (string= "b" (key-binding "\C-aa")))))
+ (with-temp-buffer
+ (bind-map tmpmap2
+ :major-modes (emacs-lisp-mode)
+ :keys ("C-a")
+ :evil-keys ("a")
+ :evil-states (motion))
+ (evil-normalize-keymaps)
+ (emacs-lisp-mode)
+ (define-key tmpmap2 "a" "b")
+ (message "%s" (pp bind-map-major-modes-alist))
+ (should (equal (cdr (assoc 'tmpmap2-active bind-map-major-modes-alist))
+ '(emacs-lisp-mode)))
+ (should tmpmap2-active)
+ (should (string= (key-binding "\C-aa") "b"))
+ (should (keymapp (lookup-key (evil-get-auxiliary-keymap tmpmap2-root-map
'motion) "a")))
+ (should (string= (lookup-key (evil-get-auxiliary-keymap tmpmap2-root-map
'motion) "aa") "b"))
+ (should (string= "b" (key-binding "\C-aa"))))))
(ert-deftest bind-map-test-minor-mode-keys ()
"Test binding for minor-modes."
(let ((tmpmap3 (make-sparse-keymap))
(tmpmap3-root-map (make-sparse-keymap))
(fake-minor-mode t)
- minor-mode-map-alist)
+ minor-mode-map-alist
+ minor-mode-alist)
(bind-map tmpmap3
:minor-modes (fake-minor-mode)
:keys ("C-a")
@@ -86,3 +89,43 @@
:major-modes (mm6))
(should (equal (cdr (assq 'tmpmap4-active bind-map-major-modes-alist))
'(mm1 mm2 mm3 mm4 mm5 mm6)))))
+
+(ert-deftest bind-map-test-minor-mode-inheritance ()
+ (with-temp-buffer
+ (let ((tmpmap5 (make-sparse-keymap))
+ (tmpmap6 (make-sparse-keymap))
+ (fake-minor-mode t)
+ minor-mode-alist
+ minor-mode-map-alist)
+ (bind-map tmpmap5
+ :keys ("C-a")
+ :evil-keys ("a")
+ :evil-states (normal))
+ (bind-map-for-mode-inherit tmpmap6 tmpmap5
+ :minor-modes (fake-minor-mode))
+ (define-key tmpmap6 "a" 'asdf)
+ (should (string= (key-binding "\C-aa") 'asdf))
+ (evil-local-mode 1)
+ (evil-motion-state)
+ (message "%s" evil-state)
+ (should (string= (key-binding "aa") 'asdf)))))
+
+(ert-deftest bind-map-test-major-mode-inheritance ()
+ (with-temp-buffer
+ (let ((tmpmap7 (make-sparse-keymap))
+ (tmpmap8 (make-sparse-keymap))
+ minor-mode-alist
+ minor-mode-map-alist)
+ (bind-map tmpmap7
+ :keys ("C-a")
+ :evil-keys ("a")
+ :evil-states (normal))
+ (bind-map-for-mode-inherit tmpmap8 tmpmap7
+ :major-modes (emacs-lisp-mode))
+ (define-key tmpmap8 "a" 'asdf)
+ (evil-normalize-keymaps)
+ (emacs-lisp-mode)
+ (should (string= (key-binding "\C-aa") 'asdf))
+ (evil-local-mode 1)
+ (evil-motion-state)
+ (should (string= (key-binding "aa") 'asdf)))))
- [nongnu] elpa/bind-map af26966c9a 57/97: Make macro expansion prettier, (continued)
- [nongnu] elpa/bind-map af26966c9a 57/97: Make macro expansion prettier, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 393879d260 58/97: Satisfy compiler, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 2fafc10f7d 45/97: Rename a var and a function and tweak a docstring, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map e94572b50b 74/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 00b7778826 68/97: Fix minor-mode tests, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 9ae3e9b113 72/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 40ed95d4d5 80/97: Add bindings keyword, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6f84c0254f 78/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map c335674139 60/97: Add files for travis, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 89747f7240 75/97: Fix evil-local-mode-hook logic, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 76b8e2ab6c 85/97: Add tests for inheritance,
ELPA Syncer <=
- [nongnu] elpa/bind-map 6ba28e31aa 83/97: Revert change to prefix-cmd handling, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map fe76f92777 91/97: Add default keys and default evil-keys, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 26a3b5571d 88/97: Make return val consistent in bind-map, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map bf4181e3a4 95/97: Add types to defcustoms, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 510a24138d 97/97: Merge pull request #6 from skangas/bump-version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 21f972e52d 08/97: Clarify some parts of README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map d609a7d784 12/97: Add cl-lib requirement, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 27ed3304d2 19/97: Revert one of the changes in the previous commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 9f88b251f1 14/97: Fix typo, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 5077cb72cb 39/97: Add :override-minor-modes option for :keys, ELPA Syncer, 2022/01/20