test-ein-kill-ring.el 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. (eval-when-compile (require 'cl))
  2. (require 'ert)
  3. (require 'ein-kill-ring)
  4. (ert-deftest ein:kill-ring-simple ()
  5. (let (ein:kill-ring
  6. ein:kill-ring-yank-pointer)
  7. (ein:kill-new 1)
  8. (should (equal (ein:current-kill 0) 1))))
  9. (defun eintest:kill-ring-simple-repeat-setup ()
  10. (loop for i from 0 below 5
  11. do (ein:kill-new i)
  12. do (should (equal (ein:current-kill 0) i))))
  13. (ert-deftest ein:kill-ring-simple-repeat ()
  14. (let (ein:kill-ring
  15. ein:kill-ring-yank-pointer)
  16. (eintest:kill-ring-simple-repeat-setup)
  17. (should (equal ein:kill-ring ein:kill-ring-yank-pointer))
  18. (should (equal ein:kill-ring '(4 3 2 1 0)))))
  19. (ert-deftest ein:kill-ring-repeat-n-1 ()
  20. (let (ein:kill-ring
  21. ein:kill-ring-yank-pointer)
  22. (eintest:kill-ring-simple-repeat-setup)
  23. (loop for i in '(3 2 1 0 4 3 2)
  24. do (should (equal (ein:current-kill 1) i)))
  25. (should-not (equal ein:kill-ring ein:kill-ring-yank-pointer))
  26. (should (equal ein:kill-ring '(4 3 2 1 0)))
  27. (should (equal ein:kill-ring-yank-pointer '(2 1 0)))))
  28. (ert-deftest ein:kill-ring-exceeds-max ()
  29. (let (ein:kill-ring
  30. ein:kill-ring-yank-pointer
  31. (ein:kill-ring-max 3))
  32. (eintest:kill-ring-simple-repeat-setup)
  33. (should (equal ein:kill-ring ein:kill-ring-yank-pointer))
  34. (should (equal (length ein:kill-ring) ein:kill-ring-max))
  35. (should (equal ein:kill-ring '(4 3 2)))))