test-ein-modes.el 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. (eval-when-compile (require 'cl))
  2. (require 'ert)
  3. (require 'ein-dev)
  4. (ein:dev-require-all :ignore-p (lambda (f) (equal f "ein-mumamo.el")))
  5. (eval-when-compile
  6. ;; do it also at compile time.
  7. (ein:dev-require-all :ignore-p (lambda (f) (equal f "ein-mumamo.el"))))
  8. (defun eintest:assert-keymap-fboundp (keymap)
  9. (let (assert-fboundp)
  10. (setq assert-fboundp
  11. (lambda (event value)
  12. (cond
  13. ((keymapp value)
  14. (map-keymap assert-fboundp value))
  15. ((and (listp value) (eq (car value) 'menu-item))
  16. (funcall assert-fboundp (cadr value) (caddr value)))
  17. (value ; nil is also valid in keymap
  18. (should (commandp value))))))
  19. (map-keymap assert-fboundp keymap)))
  20. (defmacro eintest:test-keymap (keymap)
  21. `(ert-deftest ,(intern (format "%s--assert-fboundp" keymap)) ()
  22. (eintest:assert-keymap-fboundp ,keymap)))
  23. (eintest:test-keymap ein:notebooklist-mode-map)
  24. (eintest:test-keymap ein:notebook-mode-map)
  25. (eintest:test-keymap ein:connect-mode-map)
  26. (eintest:test-keymap ein:traceback-mode-map)
  27. (eintest:test-keymap ein:shared-output-mode-map)
  28. (eintest:test-keymap ein:pager-mode-map)