2015-11-19 05:24:27 +00:00
|
|
|
;;; evil-evilified-state-utest.el --- Spacemacs Unit Test File
|
2015-06-26 03:49:53 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-06-26 03:49:53 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
;; ---------------------------------------------------------------------------
|
2015-11-19 05:24:27 +00:00
|
|
|
;; evilified-state--find-new-event
|
2015-06-26 03:49:53 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
2015-06-30 04:06:39 +00:00
|
|
|
(ert-deftest test-evilify-find-new-event--s-to-S ()
|
|
|
|
(let ((input ?s))
|
2015-11-19 05:24:27 +00:00
|
|
|
(should (equal ?S (evilified-state--find-new-event input)))))
|
2015-06-27 03:52:37 +00:00
|
|
|
|
2015-06-30 04:06:39 +00:00
|
|
|
(ert-deftest test-evilify-find-new-event--S-to-C-s ()
|
|
|
|
(let ((input ?S))
|
2015-11-19 05:24:27 +00:00
|
|
|
(should (equal ?\C-s (evilified-state--find-new-event input)))))
|
2015-06-27 03:52:37 +00:00
|
|
|
|
2015-06-30 04:06:39 +00:00
|
|
|
(ert-deftest test-evilify-find-new-event--C-s-to-C-S-s ()
|
|
|
|
(let ((input ?\C-s)
|
|
|
|
(output (+ (expt 2 25) ?\C-s)))
|
2015-11-19 05:24:27 +00:00
|
|
|
(should (equal output (evilified-state--find-new-event input)))))
|
2015-06-27 03:52:37 +00:00
|
|
|
|
2015-06-30 04:06:39 +00:00
|
|
|
(ert-deftest test-evilify-find-new-event--C-S-s-error-return-nil ()
|
|
|
|
(let ((input (+ (expt 2 25) ?\C-s)))
|
2015-11-19 05:24:27 +00:00
|
|
|
(should (equal nil (evilified-state--find-new-event input)))))
|
2015-06-27 03:52:37 +00:00
|
|
|
|
2015-09-30 02:06:19 +00:00
|
|
|
(ert-deftest test-evilify-find-new-event--Space-remap ()
|
2015-06-30 04:06:39 +00:00
|
|
|
(let ((input 32))
|
2015-11-19 05:24:27 +00:00
|
|
|
(should (equal ?' (evilified-state--find-new-event input)))))
|
2015-06-28 03:49:18 +00:00
|
|
|
|
2015-09-30 02:06:19 +00:00
|
|
|
(ert-deftest test-evilify-find-new-event--/-remap ()
|
2015-06-30 04:06:39 +00:00
|
|
|
(let ((input ?/))
|
2015-11-19 05:24:27 +00:00
|
|
|
(should (equal ?\\ (evilified-state--find-new-event input)))))
|
2015-06-27 03:52:37 +00:00
|
|
|
|
2015-09-30 02:06:19 +00:00
|
|
|
(ert-deftest test-evilify-find-new-event--:-remap ()
|
2015-06-30 04:06:39 +00:00
|
|
|
(let ((input ?:))
|
2015-11-19 05:24:27 +00:00
|
|
|
(should (equal ?| (evilified-state--find-new-event input)))))
|
2015-06-28 03:49:18 +00:00
|
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
2015-11-19 05:24:27 +00:00
|
|
|
;; evilified-state--sort-keymap
|
2015-06-28 03:49:18 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
2015-06-30 04:06:39 +00:00
|
|
|
(ert-deftest test-evilify-sort-keymap-1 ()
|
|
|
|
(let ((map '(keymap
|
|
|
|
(menu-bar keymap
|
|
|
|
(Menu menu-item "Title"
|
|
|
|
(keymap "Map"
|
|
|
|
(Action1 menu-item "Action1" action1)
|
|
|
|
(Action2 menu-item "Action2" action2))))
|
|
|
|
(23 . func1)
|
|
|
|
(M-tab . func9)
|
|
|
|
(remap keymap (func1 . func4) (func2. func5) (func3 . func6))
|
|
|
|
(s-tab . func8)
|
|
|
|
(24 keymap (52 keymap (97 . func2)) (97 . func3))
|
|
|
|
(33 . func4)
|
|
|
|
(58 . func5)
|
|
|
|
(122 . func6)
|
|
|
|
(M-return . func7)
|
|
|
|
(C-tab . func10))))
|
|
|
|
(should (equal '((122 . func6)
|
|
|
|
(58 . func5)
|
|
|
|
(33 . func4)
|
|
|
|
(24 keymap (52 keymap (97 . func2)) (97 . func3))
|
|
|
|
(23 . func1)
|
|
|
|
(C-tab . func10)
|
|
|
|
(M-return . func7)
|
|
|
|
(M-tab . func9)
|
|
|
|
(menu-bar
|
|
|
|
keymap
|
|
|
|
(Menu menu-item "Title"
|
|
|
|
(keymap "Map"
|
|
|
|
(Action1 menu-item "Action1" action1)
|
|
|
|
(Action2 menu-item "Action2" action2))))
|
|
|
|
(remap keymap (func1 . func4) (func2. func5) (func3 . func6))
|
|
|
|
(s-tab . func8))
|
2015-11-19 05:24:27 +00:00
|
|
|
(evilified-state--sort-keymap map)))))
|
2015-06-30 04:06:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
(ert-deftest test-evilify-sort-keymap-2 ()
|
|
|
|
(let ((map '(keymap
|
|
|
|
(s-tab . func8)
|
|
|
|
(23 . func1)
|
|
|
|
(122 . func6)
|
|
|
|
(remap keymap (func1 . func4) (func2. func5) (func3 . func6))
|
|
|
|
(33 . func4)
|
|
|
|
(M-return . func7)
|
|
|
|
(menu-bar keymap
|
|
|
|
(Menu menu-item "Title"
|
|
|
|
(keymap "Map"
|
|
|
|
(Action1 menu-item "Action1" action1)
|
|
|
|
(Action2 menu-item "Action2" action2))))
|
|
|
|
(58 . func5)
|
|
|
|
(M-tab . func9)
|
|
|
|
(24 keymap (52 keymap (97 . func2)) (97 . func3))
|
|
|
|
(C-tab . func10))))
|
|
|
|
(should (equal '((122 . func6)
|
|
|
|
(58 . func5)
|
|
|
|
(33 . func4)
|
|
|
|
(24 keymap (52 keymap (97 . func2)) (97 . func3))
|
|
|
|
(23 . func1)
|
|
|
|
(C-tab . func10)
|
|
|
|
(M-return . func7)
|
|
|
|
(M-tab . func9)
|
|
|
|
(menu-bar
|
|
|
|
keymap
|
|
|
|
(Menu menu-item "Title"
|
|
|
|
(keymap "Map"
|
|
|
|
(Action1 menu-item "Action1" action1)
|
|
|
|
(Action2 menu-item "Action2" action2))))
|
|
|
|
(remap keymap (func1 . func4) (func2. func5) (func3 . func6))
|
|
|
|
(s-tab . func8))
|
2015-11-19 05:24:27 +00:00
|
|
|
(evilified-state--sort-keymap map)))))
|