branch: externals/auctex commit cc72777fd26f2bd75904d1280d08c28113fc1556 Author: Mosè Giordano <m...@gnu.org> Commit: Mosè Giordano <m...@gnu.org>
More ERT tests * tests/latex/latex-test.el (LaTeX-math-indent) (LaTeX-change-environment-with-esc): New tests. * tests/latex/math-indent-in.tex: New test file. * tests/latex/math-indent-out.tex: Ditto. --- ChangeLog | 9 +++++++++ tests/latex/latex-test.el | 35 ++++++++++++++++++++++++++++++++++- tests/latex/math-indent-in.tex | 17 +++++++++++++++++ tests/latex/math-indent-out.tex | 17 +++++++++++++++++ 4 files changed, 77 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b94fca..8d03381 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2015-11-11 Mos� Giordano <m...@gnu.org> + + * tests/latex/latex-test.el (LaTeX-math-indent) + (LaTeX-change-environment-with-esc): New tests. + + * tests/latex/math-indent-in.tex: New test file. + + * tests/latex/math-indent-out.tex: Ditto. + 2015-11-10 Mos� Giordano <m...@gnu.org> * latex.el (LaTeX-fill-break-at-separators): Change default value diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el index 0ca942a..cc23caf 100644 --- a/tests/latex/latex-test.el +++ b/tests/latex/latex-test.el @@ -44,7 +44,11 @@ line and from another directory." 'LaTeX-filling/in "latex-filling-in.tex" 'LaTeX-filling/out - "latex-filling-out.tex") + "latex-filling-out.tex" + 'LaTeX-math-indent/in + "math-indent-in.tex" + 'LaTeX-math-indent/out + "math-indent-out.tex") (ert-deftest LaTeX-indent-tabular () (should (string= @@ -57,6 +61,20 @@ line and from another directory." (insert-file-contents LaTeX-indent-tabular-test/out) (buffer-string))))) +;; Another test for indentation, but for math mode, see +;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20227 Let's keep those tests +;; separated so it would be easier to find the culprit of a future failure. +(ert-deftest LaTeX-math-indent () + (should (string= + (with-temp-buffer + (insert-file-contents LaTeX-math-indent/in) + (LaTeX-mode) + (indent-region (point-min) (point-max)) + (buffer-string)) + (with-temp-buffer + (insert-file-contents LaTeX-math-indent/out) + (buffer-string))))) + ;; Test LaTeX code with math modes is indented as expected. This has mostly to ;; do with the value of `LaTeX-fill-break-at-separators' and how ;; `LaTeX-fill-move-to-break-point' handles it. If the test fails, try to look @@ -73,4 +91,19 @@ line and from another directory." (insert-file-contents LaTeX-filling/out) (buffer-string))))) +;; Test for bug#19281 (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19281): +;; make sure AUCTeX is able to insert and modify an environment containing a +;; TeX-esc and braces in its name. +(ert-deftest LaTeX-change-environment-with-esc () + (should (string= + (with-temp-buffer + (LaTeX-mode) + (LaTeX-insert-environment (concat TeX-esc "foo{bar}")) + (LaTeX-modify-environment "foobar") + (buffer-string)) + (with-temp-buffer + (LaTeX-mode) + (LaTeX-insert-environment "foobar") + (buffer-string))))) + ;;; latex-test.el ends here diff --git a/tests/latex/math-indent-in.tex b/tests/latex/math-indent-in.tex new file mode 100644 index 0000000..16acac6 --- /dev/null +++ b/tests/latex/math-indent-in.tex @@ -0,0 +1,17 @@ +\[ +x +\] + +\[ +\begin{split} +x &= y \\ +y &= z +\end{split} +\] + +\begin{itemize} +\item Some text here +\[ +x +\] +\end{itemize} diff --git a/tests/latex/math-indent-out.tex b/tests/latex/math-indent-out.tex new file mode 100644 index 0000000..e895be2 --- /dev/null +++ b/tests/latex/math-indent-out.tex @@ -0,0 +1,17 @@ +\[ + x +\] + +\[ + \begin{split} + x &= y \\ + y &= z + \end{split} +\] + +\begin{itemize} +\item Some text here + \[ + x + \] +\end{itemize}