2018-02-27 14:38:13 -06:00
|
|
|
|
(require 'ein-notebooklist)
|
2018-09-26 10:07:50 -04:00
|
|
|
|
(require 'ein-testing-notebook)
|
2018-02-27 14:38:13 -06:00
|
|
|
|
|
|
|
|
|
(defun eintest:notebooklist-make-empty (&optional url-or-port)
|
|
|
|
|
"Make empty notebook list buffer."
|
2020-01-13 11:38:21 -05:00
|
|
|
|
(let ((url-or-port (or url-or-port ein:testing-notebook-dummy-url)))
|
|
|
|
|
(cl-letf (((symbol-function 'ein:need-kernelspecs) #'ignore)
|
|
|
|
|
((symbol-function 'ein:content-query-sessions) #'ignore))
|
|
|
|
|
(ein:notebooklist-open--finish url-or-port #'ignore
|
|
|
|
|
(make-ein:$content :url-or-port url-or-port
|
|
|
|
|
:notebook-version "5.7.0"
|
|
|
|
|
:path "")))))
|
2018-02-27 14:38:13 -06:00
|
|
|
|
|
|
|
|
|
(defmacro eintest:notebooklist-is-empty-context-of (func)
|
|
|
|
|
`(ert-deftest ,(intern (format "%s--notebooklist" func)) ()
|
|
|
|
|
(with-current-buffer (eintest:notebooklist-make-empty)
|
|
|
|
|
(should-not (,func)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Generic getter
|
|
|
|
|
|
|
|
|
|
(ert-deftest ein:get-url-or-port--notebooklist ()
|
2018-09-26 10:07:50 -04:00
|
|
|
|
(with-current-buffer (eintest:notebooklist-make-empty)
|
|
|
|
|
(should (equal (ein:get-url-or-port) ein:testing-notebook-dummy-url))))
|
2018-02-27 14:38:13 -06:00
|
|
|
|
|
|
|
|
|
(eintest:notebooklist-is-empty-context-of ein:get-notebook)
|
|
|
|
|
(eintest:notebooklist-is-empty-context-of ein:get-kernel)
|
|
|
|
|
(eintest:notebooklist-is-empty-context-of ein:get-cell-at-point)
|
|
|
|
|
(eintest:notebooklist-is-empty-context-of ein:get-traceback-data)
|