emacs-ipython-notebook/test/test-ein-iexec.el
John Miller 9d5309af59 Trying something new with testing.
Let's do this with ert-runner instead of python. Maybe it will work for once.
2018-02-27 14:38:13 -06:00

43 lines
1.4 KiB
EmacsLisp
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(eval-when-compile (require 'cl))
(require 'ert)
(require 'ein-iexec)
(require 'ein-testing-notebook)
;;; `ein:iexec-should-execute-p'
(defun* eintest:iexec-should-execute-p (cell &key (this-command t) beg end)
"Simple wrapper for `ein:iexec-should-execute-p' which
returns `t' by default, if the CELL is code cell."
(unless beg (setq beg (ein:cell-input-pos-min cell)))
(unless end (setq end (ein:cell-input-pos-max cell)))
(ein:iexec-should-execute-p cell beg end))
;; cell types
(ert-deftest ein:iexec-should-execute-p-codecell ()
(ein:testing-with-one-cell 'code
(should (eintest:iexec-should-execute-p cell))))
(ert-deftest ein:iexec-should-execute-p-markdowncell ()
(ein:testing-with-one-cell 'markdown
(should-not (eintest:iexec-should-execute-p cell))))
(ert-deftest ein:iexec-should-execute-p-dead-cell ()
(ein:testing-with-one-cell 'code
(should-not (eintest:iexec-should-execute-p (ein:cell-copy cell)))))
;; other
(ert-deftest ein:iexec-should-execute-p-non-interactive ()
(ein:testing-with-one-cell 'code
(should-not (eintest:iexec-should-execute-p cell :this-command nil))))
(ert-deftest ein:iexec-should-execute-p-beg-too-small ()
(ein:testing-with-one-cell 'code
(should-not (eintest:iexec-should-execute-p cell :beg (point-min)))))
(ert-deftest ein:iexec-should-execute-p-end-too-big ()
(ein:testing-with-one-cell 'code
(should-not (eintest:iexec-should-execute-p cell :end (point-max)))))