test-ein-shared-output.el 1005 B

1234567891011121314151617181920212223242526272829
  1. (require 'ein-shared-output)
  2. (defmacro eintest:shared-output-with-buffer (&rest body)
  3. (declare (indent 0))
  4. `(with-current-buffer (ein:shared-output-create-buffer)
  5. (ein:shared-output-get-or-create)
  6. ,@body))
  7. (defmacro eintest:shared-output-is-empty-context-of (func)
  8. `(ert-deftest ,(intern (format "%s--shared-output" func)) ()
  9. (eintest:shared-output-with-buffer
  10. (should-not (,func)))))
  11. ;; Generic getter
  12. (ert-deftest ein:get-cell-at-point--shared-output ()
  13. (eintest:shared-output-with-buffer
  14. (should (eq (ein:get-cell-at-point)
  15. (ein:shared-output-get-cell))))
  16. (with-temp-buffer
  17. (should-not (ein:get-cell-at-point--shared-output))))
  18. ;; FIXME: Add tests with non-empty shared output buffer.
  19. (eintest:shared-output-is-empty-context-of ein:get-url-or-port)
  20. (eintest:shared-output-is-empty-context-of ein:get-notebook)
  21. (eintest:shared-output-is-empty-context-of ein:get-kernel)
  22. (eintest:shared-output-is-empty-context-of ein:get-traceback-data)