2012-07-29 13:56:20 +02:00
|
|
|
|
(eval-when-compile (require 'cl))
|
|
|
|
|
(require 'ert)
|
|
|
|
|
|
|
|
|
|
(require 'ein-iexec)
|
2012-08-24 19:28:06 +02:00
|
|
|
|
(require 'ein-testing-notebook)
|
2012-07-29 13:56:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; `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 ()
|
2012-08-24 19:28:06 +02:00
|
|
|
|
(ein:testing-with-one-cell 'code
|
2012-07-29 13:56:20 +02:00
|
|
|
|
(should (eintest:iexec-should-execute-p cell))))
|
|
|
|
|
|
|
|
|
|
(ert-deftest ein:iexec-should-execute-p-markdowncell ()
|
2012-08-24 19:28:06 +02:00
|
|
|
|
(ein:testing-with-one-cell 'markdown
|
2012-07-29 13:56:20 +02:00
|
|
|
|
(should-not (eintest:iexec-should-execute-p cell))))
|
|
|
|
|
|
|
|
|
|
(ert-deftest ein:iexec-should-execute-p-dead-cell ()
|
2012-08-24 19:28:06 +02:00
|
|
|
|
(ein:testing-with-one-cell 'code
|
2012-07-29 13:56:20 +02:00
|
|
|
|
(should-not (eintest:iexec-should-execute-p (ein:cell-copy cell)))))
|
|
|
|
|
|
|
|
|
|
;; other
|
|
|
|
|
|
|
|
|
|
(ert-deftest ein:iexec-should-execute-p-non-interactive ()
|
2012-08-24 19:28:06 +02:00
|
|
|
|
(ein:testing-with-one-cell 'code
|
2012-07-29 13:56:20 +02:00
|
|
|
|
(should-not (eintest:iexec-should-execute-p cell :this-command nil))))
|
|
|
|
|
|
|
|
|
|
(ert-deftest ein:iexec-should-execute-p-beg-too-small ()
|
2012-08-24 19:28:06 +02:00
|
|
|
|
(ein:testing-with-one-cell 'code
|
2012-07-29 13:56:20 +02:00
|
|
|
|
(should-not (eintest:iexec-should-execute-p cell :beg (point-min)))))
|
|
|
|
|
|
|
|
|
|
(ert-deftest ein:iexec-should-execute-p-end-too-big ()
|
2012-08-24 19:28:06 +02:00
|
|
|
|
(ein:testing-with-one-cell 'code
|
2012-07-29 13:56:20 +02:00
|
|
|
|
(should-not (eintest:iexec-should-execute-p cell :end (point-max)))))
|