Add a regression test for `org-export-with-buffer-copy'
* testing/lisp/test-ox.el (test-org-export/org-export-copy-buffer): Make sure that `org-export-with-buffer-copy' does not show up when Emacs is searching for buffers associated with file.
This commit is contained in:
parent
192742c9c5
commit
8901fd2261
|
@ -63,20 +63,32 @@ variable, and communication channel under `info'."
|
|||
|
||||
(ert-deftest test-org-export/org-export-copy-buffer ()
|
||||
"Test `org-export-copy-buffer' specifications."
|
||||
;; The buffer copy must not cause overwriting the original file
|
||||
;; buffer under any circumstances.
|
||||
;; The copy must not overwrite the original file.
|
||||
(org-test-with-temp-text-in-file
|
||||
"* Heading"
|
||||
(let ((file (buffer-file-name)))
|
||||
(with-current-buffer (org-export-copy-buffer)
|
||||
(insert "This must not go into actual file.")
|
||||
(insert "This must not go into the original file.")
|
||||
(save-buffer)
|
||||
(should
|
||||
(equal
|
||||
"* Heading"
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(buffer-string))))))))
|
||||
(buffer-string)))))))
|
||||
;; The copy must not show when re-opening the original file.
|
||||
(org-test-with-temp-text-in-file
|
||||
"* Heading"
|
||||
(let ((file (buffer-file-name))
|
||||
(buffer-copy (generate-new-buffer " *Org export copy*")))
|
||||
(org-export-with-buffer-copy
|
||||
:to-buffer buffer-copy
|
||||
(insert "This must not show as the original file.")
|
||||
(save-buffer))
|
||||
;; Unassign the original buffer from file.
|
||||
(setq buffer-file-name nil)
|
||||
(should-not
|
||||
(equal buffer-copy (get-file-buffer file))))))
|
||||
|
||||
(ert-deftest test-org-export/bind-keyword ()
|
||||
"Test reading #+BIND: keywords."
|
||||
|
|
Loading…
Reference in New Issue