emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 73134cfbf1: test-org-src.el: Add two tests


From: ELPA Syncer
Subject: [elpa] externals/org 73134cfbf1: test-org-src.el: Add two tests
Date: Mon, 26 Jun 2023 06:59:12 -0400 (EDT)

branch: externals/org
commit 73134cfbf18117e49a3a97604bf6342042c9ca5e
Author: Sébastien Miquel <sebastien.miquel@posteo.eu>
Commit: Sébastien Miquel <sebastien.miquel@posteo.eu>

    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 2a45ba66e5..e31fcb946a 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<point>
+#+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
+<point>
+  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<point>\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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]