emacs-winum/window-numbering-tests.el

38 lines
1.5 KiB
EmacsLisp
Raw Normal View History

2013-09-02 12:10:36 -04:00
(require 'ert)
(require 'window-numbering)
2008-04-11 15:22:15 -04:00
2013-09-02 12:10:36 -04:00
(ert-deftest window-numbering-assign ()
(let ((window-numbering-windows (make-vector 10 nil))
(window-numbering-numbers (make-hash-table :size 10))
(window-numbering-left '(1 2 3)))
(should (not (null (window-numbering-assign 'xx 7))))
(should (null (window-numbering-assign 'yy 7)))
(should (not (null (window-numbering-assign 'zz 8))))
(should (equal 8 (gethash 'zz window-numbering-numbers)))
(should (equal 7 (gethash 'xx window-numbering-numbers)))
(should (equal 'zz (aref window-numbering-windows 8)))
(should (equal 'xx (aref window-numbering-windows 7)))
))
2008-04-11 15:22:15 -04:00
2013-09-02 12:10:36 -04:00
(ert-deftest window-numbering-assign-auto ()
(let ((window-numbering-windows (make-vector 10 nil))
(window-numbering-numbers (make-hash-table :size 10))
(window-numbering-left '(1 2 3 4)))
(should (eq 1 (window-numbering-assign 'xx)))
(should (not (null (window-numbering-assign 'yy 3))))
(should (eq 2 (window-numbering-assign 'zz)))
(should (eq 4 (window-numbering-assign 'aa)))
))
2008-04-11 15:22:15 -04:00
2013-09-02 12:10:36 -04:00
(ert-deftest window-numbering-calculate-left ()
(should (equal '(6) (window-numbering-calculate-left
[t t t t t nil t t t t])))
(should (equal '(1 2 3) (window-numbering-calculate-left
[nil nil nil t t t t t t t])))
(should (equal '(1 2 3 4 5 6 7 8 9 0)
(window-numbering-calculate-left
[nil nil nil nil nil nil nil nil nil nil])))
2008-04-11 15:22:15 -04:00
)