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.
This commit is contained in:
Sébastien Miquel 2023-06-17 17:00:51 +02:00
parent f8b0b2babf
commit 73134cfbf1
1 changed files with 52 additions and 0 deletions

View File

@ -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.