From 9613a54d20883e56301f987f5495b962f3763cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Sat, 17 Jun 2023 17:00:51 +0200 Subject: [PATCH] test-org-src.el: Add two tests * testing/lisp/test-org-src.el (test-org-src/preserve-empty-lines): Test that empty lines are not indented. (test-org-src/indented-latex-fragments): Test special edit of multiline indented LaTeX fragment. --- testing/lisp/test-org-src.el | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/testing/lisp/test-org-src.el b/testing/lisp/test-org-src.el index 2a45ba66e..42edb364a 100644 --- a/testing/lisp/test-org-src.el +++ b/testing/lisp/test-org-src.el @@ -144,6 +144,47 @@ This is a tab:\t. (org-edit-src-exit) (buffer-string)))))) +(ert-deftest test-org-src/preserve-empty-lines () + "Editing block preserves empty lines." + (should + (equal " +#+begin_src emacs-lisp + The following line is empty + + abc +#+end_src" + (org-test-with-temp-text + " +#+begin_src emacs-lisp + The following line is empty + + abc +#+end_src" + (let ((org-edit-src-content-indentation 2) + (org-src-preserve-indentation nil)) + (org-edit-special) + (org-edit-src-exit) + (buffer-string))))) + (should + (equal " +#+begin_src emacs-lisp + The following line is empty + + abc +#+end_src" + (org-test-with-temp-text + " +#+begin_src emacs-lisp + The following line is empty + + abc +#+end_src" + (let ((org-edit-src-content-indentation 2) + (org-src-preserve-indentation nil)) + (org-edit-special) + (org-edit-src-exit) + (buffer-string))))) ) + (ert-deftest test-org-src/coderef-format () "Test `org-src-coderef-format' specifications." ;; Regular tests in a src block, an example block and an edit @@ -376,6 +417,17 @@ This is a tab:\t. (org-edit-src-exit) (buffer-string)))))) +(ert-deftest test-org-src/indented-latex-fragments () + "Test editing multiline indented LaTeX fragment." + (should + (equal + "- Item $abc\n efg$" + (org-test-with-temp-text + "- Item $abc\n efg$" + (org-edit-special) + (org-edit-src-exit) + (buffer-string))))) + (ert-deftest test-org-src/footnote-references () "Test editing footnote references." ;; Error when there is no definition to edit. -- 2.41.0