test-ein-iexec.el 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. (eval-when-compile (require 'cl))
  2. (require 'ert)
  3. (require 'ein-iexec)
  4. (require 'ein-testing-notebook)
  5. ;;; `ein:iexec-should-execute-p'
  6. (defun* eintest:iexec-should-execute-p (cell &key (this-command t) beg end)
  7. "Simple wrapper for `ein:iexec-should-execute-p' which
  8. returns `t' by default, if the CELL is code cell."
  9. (unless beg (setq beg (ein:cell-input-pos-min cell)))
  10. (unless end (setq end (ein:cell-input-pos-max cell)))
  11. (ein:iexec-should-execute-p cell beg end))
  12. ;; cell types
  13. (ert-deftest ein:iexec-should-execute-p-codecell ()
  14. (ein:testing-with-one-cell 'code
  15. (should (eintest:iexec-should-execute-p cell))))
  16. (ert-deftest ein:iexec-should-execute-p-markdowncell ()
  17. (ein:testing-with-one-cell 'markdown
  18. (should-not (eintest:iexec-should-execute-p cell))))
  19. (ert-deftest ein:iexec-should-execute-p-dead-cell ()
  20. (ein:testing-with-one-cell 'code
  21. (should-not (eintest:iexec-should-execute-p (ein:cell-copy cell)))))
  22. ;; other
  23. (ert-deftest ein:iexec-should-execute-p-non-interactive ()
  24. (ein:testing-with-one-cell 'code
  25. (should-not (eintest:iexec-should-execute-p cell :this-command nil))))
  26. (ert-deftest ein:iexec-should-execute-p-beg-too-small ()
  27. (ein:testing-with-one-cell 'code
  28. (should-not (eintest:iexec-should-execute-p cell :beg (point-min)))))
  29. (ert-deftest ein:iexec-should-execute-p-end-too-big ()
  30. (ein:testing-with-one-cell 'code
  31. (should-not (eintest:iexec-should-execute-p cell :end (point-max)))))