forked from millejoh/emacs-ipython-notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-ein-kill-ring.el
41 lines (35 loc) · 1.38 KB
/
test-ein-kill-ring.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(eval-when-compile (require 'cl))
(require 'ert)
(require 'ein-kill-ring)
(ert-deftest ein:kill-ring-simple ()
(let (ein:kill-ring
ein:kill-ring-yank-pointer)
(ein:kill-new 1)
(should (equal (ein:current-kill 0) 1))))
(defun eintest:kill-ring-simple-repeat-setup ()
(loop for i from 0 below 5
do (ein:kill-new i)
do (should (equal (ein:current-kill 0) i))))
(ert-deftest ein:kill-ring-simple-repeat ()
(let (ein:kill-ring
ein:kill-ring-yank-pointer)
(eintest:kill-ring-simple-repeat-setup)
(should (equal ein:kill-ring ein:kill-ring-yank-pointer))
(should (equal ein:kill-ring '(4 3 2 1 0)))))
(ert-deftest ein:kill-ring-repeat-n-1 ()
(let (ein:kill-ring
ein:kill-ring-yank-pointer)
(eintest:kill-ring-simple-repeat-setup)
(loop for i in '(3 2 1 0 4 3 2)
do (should (equal (ein:current-kill 1) i)))
(should-not (equal ein:kill-ring ein:kill-ring-yank-pointer))
(should (equal ein:kill-ring '(4 3 2 1 0)))
(should (equal ein:kill-ring-yank-pointer '(2 1 0)))))
(ert-deftest ein:kill-ring-exceeds-max ()
(let (ein:kill-ring
ein:kill-ring-yank-pointer
(ein:kill-ring-max 3))
(eintest:kill-ring-simple-repeat-setup)
(should (equal ein:kill-ring ein:kill-ring-yank-pointer))
(should (equal (length ein:kill-ring) ein:kill-ring-max))
(should (equal ein:kill-ring '(4 3 2)))))