Add tests ein:get-*--nil and fix a bug

This commit is contained in:
Takafumi Arakaki 2012-08-14 22:10:01 +02:00
parent 3f8f995910
commit 06b1c74a5a
2 changed files with 16 additions and 1 deletions

View file

@ -158,7 +158,7 @@ where CELL locates."
(defun ein:get-kernel--shared-output ()
(let ((cell (ein:get-cell-at-point--shared-output)))
(when (slot-boundp cell :kernel)
(when (and (object-p cell) (slot-boundp cell :kernel))
(oref cell :kernel))))
(defun ein:get-cell-at-point--shared-output ()

View file

@ -86,6 +86,21 @@ def func():
"Check if `ein:version' can be parsed by `version-to-list'."
(version-to-list ein:version))
;; Generic getter
(defmacro eintest:generic-getter-should-return-nil (func)
"In an \"empty\" context, generic getter should return nil."
`(ert-deftest ,(intern (format "%s--nil name" func)) ()
(with-temp-buffer
(should (not (,func))))))
(eintest:generic-getter-should-return-nil ein:get-url-or-port)
(eintest:generic-getter-should-return-nil ein:get-notebook)
(eintest:generic-getter-should-return-nil ein:get-kernel)
(eintest:generic-getter-should-return-nil ein:get-cell-at-point)
(eintest:generic-getter-should-return-nil ein:get-traceback-data)
;;; File name translation