[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map f46bf57d7f 52/97: Add major-mode test
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map f46bf57d7f 52/97: Add major-mode test |
Date: |
Thu, 20 Jan 2022 07:59:19 -0500 (EST) |
branch: elpa/bind-map
commit f46bf57d7f99844518442fddcd8c68fb9f7a2338
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Add major-mode test
---
bind-map-tests.el | 44 +++++++++++++++++++++++++++++++++++---------
1 file changed, 35 insertions(+), 9 deletions(-)
diff --git a/bind-map-tests.el b/bind-map-tests.el
index bcb806307c..f06ecc1554 100644
--- a/bind-map-tests.el
+++ b/bind-map-tests.el
@@ -22,30 +22,56 @@
(ert-deftest bind-map-test-global-keys ()
"Test binding in global maps."
- (let ((map (make-sparse-keymap)))
- (bind-map map
+ (let ((tmpmap (make-sparse-keymap)))
+ (bind-map tmpmap
:keys ("C-a")
:evil-keys ("a")
:evil-states (motion))
- (define-key map "a" "b")
+ (define-key tmpmap "a" "b")
(should (keymapp (lookup-key global-map "\C-a")))
(should (string= (lookup-key global-map "\C-aa") "b"))
(should (keymapp (lookup-key evil-motion-state-map "a")))
(should (string= (lookup-key evil-motion-state-map "aa") "b"))
(should (not (string= (lookup-key evil-visual-state-map "aa") "b")))))
+(ert-deftest bind-map-test-major-mode-keys ()
+ "Test binding for major-modes."
+ (let ((tmpmap (make-sparse-keymap))
+ (tmpmap-root-map (make-sparse-keymap))
+ tmpmap-active
+ tmpmap-prefix
+ bind-map-major-modes-alist
+ minor-mode-map-alist)
+ (bind-map tmpmap
+ :major-modes (emacs-lisp-mode)
+ :keys ("C-a")
+ :evil-keys ("a")
+ :evil-states (motion))
+ (evil-normalize-keymaps)
+ (emacs-lisp-mode)
+ (define-key tmpmap "a" "b")
+ (message "%s" (pp bind-map-major-modes-alist))
+ (should (equal (cdr (assoc 'tmpmap-active bind-map-major-modes-alist))
+ '(emacs-lisp-mode)))
+ (should tmpmap-active)
+ (should (string= (key-binding "\C-aa") "b"))
+ (should (keymapp (lookup-key (evil-get-auxiliary-keymap tmpmap-root-map
'motion) "a")))
+ (should (string= (lookup-key (evil-get-auxiliary-keymap tmpmap-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 ((map (make-sparse-keymap))
- (map-root-map (make-sparse-keymap))
+ (let ((tmpmap (make-sparse-keymap))
+ (tmpmap-root-map (make-sparse-keymap))
(fake-minor-mode t)
minor-mode-map-alist)
- (bind-map map
+ (bind-map tmpmap
:minor-modes (fake-minor-mode)
:keys ("C-a")
:evil-keys ("a")
:evil-states (motion))
- (define-key map "a" "b")
+ (evil-normalize-keymaps)
+ (define-key tmpmap "a" "b")
(should (string= (key-binding "\C-aa") "b"))
- (should (keymapp (lookup-key (evil-get-auxiliary-keymap map-root-map
'motion) "a")))
- (should (string= (lookup-key (evil-get-auxiliary-keymap map-root-map
'motion) "aa") "b"))))
+ (should (keymapp (lookup-key (evil-get-auxiliary-keymap tmpmap-root-map
'motion) "a")))
+ (should (string= (lookup-key (evil-get-auxiliary-keymap tmpmap-root-map
'motion) "aa") "b"))))
- [nongnu] elpa/bind-map 26a3b5571d 88/97: Make return val consistent in bind-map, (continued)
- [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
- [nongnu] elpa/bind-map 07eef581ef 15/97: Add URL, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map ce4e8e7f64 21/97: Fix typos in docstrings, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map f46bf57d7f 52/97: Add major-mode test,
ELPA Syncer <=
- [nongnu] elpa/bind-map e3fa3cc383 26/97: Fix compiler warning, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 4489504e47 29/97: Check evil-keys before calling evil-define-*, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map fb234332ff 32/97: Signal error if supplied map is not a keymap, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 3f6eba7b5b 56/97: Make sure active-var is bound before setting, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 99236303f6 84/97: Rename bind-map-for-modes-derived, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 96802ece2b 76/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 4ceb7deb3a 90/97: Remove messages from tests, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 3b5a27e429 47/97: Tweak docstrings, ELPA Syncer, 2022/01/20