emacs-ipython-notebook/tests/test-ein-modes.el
Takafumi Arakaki 52dad47fc1 Make eintest:assert-keymap-fboundp more robust
Otherwise, ein:notebook-mode-map--assert-fboundp fails.
Note that it looks like that this test already failed in the
worksheet branch, but I didn't notice.  Also note that
running test only in test-ein-modes.el pass without this fix.
2012-08-23 23:09:39 +02:00

27 lines
989 B
EmacsLisp

(eval-when-compile (require 'cl))
(require 'ert)
(require 'ein-dev)
(ein:dev-require-all)
(eval-when-compile (ein:dev-require-all)) ; do it also at compile time.
(defun eintest:assert-keymap-fboundp (keymap)
(let (assert-fboundp)
(setq assert-fboundp
(lambda (event value) (if (keymapp value)
(map-keymap assert-fboundp value)
(when value ; nil is also valid in keymap
(should (commandp value))))))
(map-keymap assert-fboundp keymap)))
(defmacro eintest:test-keymap (keymap)
`(ert-deftest ,(intern (format "%s--assert-fboundp" keymap)) ()
(eintest:assert-keymap-fboundp ,keymap)))
(eintest:test-keymap ein:notebooklist-mode-map)
(eintest:test-keymap ein:notebook-mode-map)
(eintest:test-keymap ein:connect-mode-map)
(eintest:test-keymap ein:traceback-mode-map)
(eintest:test-keymap ein:shared-output-mode-map)
(eintest:test-keymap ein:pager-mode-map)