alect-tests.el 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ;;; alect-tests.el --- Tests for alect-themes package
  2. ;; Copyright © 2013, 2016 Alex Kost <alezost@gmail.com>
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;;
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;;
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;; These tests can be run like this:
  17. ;;
  18. ;; cd /path/to/alect-themes
  19. ;; emacs -Q -nw -L . --batch --eval '(progn (load-file "tests/alect-tests.el") (ert-run-tests-batch-and-exit))'
  20. ;;; Code:
  21. (require 'ert)
  22. (require 'alect-themes)
  23. (ert-deftest alect-test-substitute-colors ()
  24. "Test functions for substituting colors."
  25. (should (equal (alect-substitute-color
  26. 'dark '(:foreground "pink" :background green-1) :foreground)
  27. '(:foreground "pink" :background green-1)))
  28. (should (equal (alect-substitute-color
  29. 'dark '(:foreground "pink" :background green-1) :background)
  30. '(:foreground "pink" :background "#32cd32")))
  31. (should (equal (alect-substitute-colors-in-plist
  32. 'light '(((:foreground "pink" :background green-1 :underline t
  33. :box (:line-width 1 :color fg :style nil)))))
  34. '(:foreground "pink" :background "#1c9e28" :underline t
  35. :box (:line-width 1 :color "#3f3f3f" :style nil))))
  36. (should (equal (alect-substitute-colors-in-faces
  37. 'light
  38. '((fringe ((t (:background "pink"))))
  39. (font-lock-string-face ((t :foreground green-1)))
  40. (button ((((class color) (min-colors 88) (:background blue)) (:foreground magenta))
  41. (((class color) (background dark)) :foreground "LightSkyBlue")
  42. (((class color) (min-colors 16)) (:bold t :background fg+2))
  43. (t (:slant italic :box (:line-width 1 :color red-1 :background cyan)))))))
  44. '((fringe ((t :background "pink")))
  45. (font-lock-string-face ((t :foreground "#1c9e28")))
  46. (button ((((class color) (min-colors 88) (:background blue)) :foreground "#a020f0")
  47. (((class color) (background dark)) :foreground "LightSkyBlue")
  48. (((class color) (min-colors 16)) :bold t :background "#101010")
  49. (t :slant italic :box (:line-width 1 :color "#e43838" :background cyan)))))))
  50. (should (equal (alect-substitute-colors-in-faces
  51. 'dark
  52. '((hl-line ((((class color) (min-colors 256)) :background bg)
  53. (t nil)))))
  54. '((hl-line ((((class color) (min-colors 256)) :background "#4f4f4f")
  55. (t nil)))))))
  56. (provide 'alect-tests)
  57. ;;; alect-tests.el ends here