|
@@ -63,20 +63,32 @@ variable, and communication channel under `info'."
|
|
|
|
|
|
(ert-deftest test-org-export/org-export-copy-buffer ()
|
|
(ert-deftest test-org-export/org-export-copy-buffer ()
|
|
"Test `org-export-copy-buffer' specifications."
|
|
"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
|
|
(org-test-with-temp-text-in-file
|
|
"* Heading"
|
|
"* Heading"
|
|
(let ((file (buffer-file-name)))
|
|
(let ((file (buffer-file-name)))
|
|
(with-current-buffer (org-export-copy-buffer)
|
|
(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)
|
|
(save-buffer)
|
|
(should
|
|
(should
|
|
(equal
|
|
(equal
|
|
"* Heading"
|
|
"* Heading"
|
|
(with-temp-buffer
|
|
(with-temp-buffer
|
|
(insert-file-contents file)
|
|
(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 ()
|
|
(ert-deftest test-org-export/bind-keyword ()
|
|
"Test reading #+BIND: keywords."
|
|
"Test reading #+BIND: keywords."
|