mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 01:21:38 -05:00
Add test and fix inter-buffer yanking
This commit is contained in:
parent
b7c5dd4996
commit
e1fd1a1364
2 changed files with 18 additions and 2 deletions
|
@ -263,6 +263,8 @@ is `nil', BODY is executed with any cell types."
|
|||
((eq arg '-) -2)
|
||||
(t (1- arg)))))
|
||||
(clone (ein:cell-copy killed)))
|
||||
;; Cell can be from another buffer, so reset `ewoc'.
|
||||
(oset clone :ewoc (ein:$notebook-ewoc ein:notebook))
|
||||
(ein:notebook-insert-cell-below ein:notebook clone cell)
|
||||
(ein:cell-goto clone)))
|
||||
|
||||
|
|
|
@ -52,10 +52,10 @@
|
|||
(name . ,name)
|
||||
(worksheets . [((cells . ,(apply #'vector cells)))])))
|
||||
|
||||
(defun eintest:notebook-make-empty ()
|
||||
(defun eintest:notebook-make-empty (&optional name)
|
||||
"Make empty notebook and return its buffer."
|
||||
(eintest:notebook-from-json
|
||||
(json-encode (eintest:notebook-make-data nil))))
|
||||
(json-encode (eintest:notebook-make-data nil name))))
|
||||
|
||||
(ert-deftest ein:notebook-from-json-simple ()
|
||||
(with-current-buffer (eintest:notebook-from-json
|
||||
|
@ -141,6 +141,20 @@
|
|||
do (ein:notebook-yank-cell-command))
|
||||
(should (equal (ein:notebook-ncells ein:notebook) 3)))))
|
||||
|
||||
(ert-deftest ein:notebook-yank-cell-command-two-buffers ()
|
||||
(let (ein:kill-ring ein:kill-ring-yank-pointer)
|
||||
(with-current-buffer (eintest:notebook-make-empty "NB1")
|
||||
(ein:notebook-insert-cell-above-command)
|
||||
(should (equal (ein:notebook-ncells ein:notebook) 1))
|
||||
(ein:notebook-kill-cell-command)
|
||||
(should (equal (ein:notebook-ncells ein:notebook) 0))
|
||||
(flet ((y-or-n-p (&rest ignore) t))
|
||||
;; FIXME: are there anyway to skip confirmation?
|
||||
(kill-buffer)))
|
||||
(with-current-buffer (eintest:notebook-make-empty "NB2")
|
||||
(ein:notebook-yank-cell-command)
|
||||
(should (equal (ein:notebook-ncells ein:notebook) 1)))))
|
||||
|
||||
(ert-deftest ein:notebook-toggle-cell-type-simple ()
|
||||
(with-current-buffer (eintest:notebook-make-empty)
|
||||
(ein:notebook-insert-cell-above-command)
|
||||
|
|
Loading…
Add table
Reference in a new issue