From 8bc0f1e807df653634e77e5e5fc543a2e82191c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Fri, 7 Oct 2022 16:04:28 +0200 Subject: [PATCH] Add a regression test for 'org-export-copy-buffer' * testing/lisp/test-ox.el (test-org-export/org-export-copy-buffer): Make sure that 'find-file' after 'org-export-copy-buffer' re-opens the original file instead of the copy buffer. --- testing/lisp/test-ox.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 90a9eb3aa..60bf04316 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -63,20 +63,31 @@ 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))) + (with-current-buffer (org-export-copy-buffer) + (insert "This must not show as the original file.") + (save-buffer)) + (should + (equal "* Heading" + (with-temp-buffer + (find-file file) + (buffer-string))))))) (ert-deftest test-org-export/bind-keyword () "Test reading #+BIND: keywords." -- 2.37.3