Initial commit.

This commit is contained in:
2016-02-18 14:53:30 +01:00
commit 8e93ca7a95
2215 changed files with 341269 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
# Copyright (C) 2010-2014 Free Software Foundation, Inc.
# This file is part of AUCTeX.
# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
### Commentary:
## Some targets:
## check: re-run all tests, writing to .log files.
## check-maybe: run all tests whose .log file needs updating
## filename.log: run tests from filename.el if .log file needs updating
## filename: re-run tests from filename.el, with no logging
## Adapted from test/automated/Makefile.in of GNU Emacs.
### Code:
SHELL = /bin/sh
EMACS = emacs
# AUCTeX source directory.
SRCDIR = ".."
# Command line flags for Emacs.
EMACSOPT = -batch -L $(SRCDIR)
# Prevent any settings in the user environment causing problems.
unexport EMACSDATA EMACSDOC EMACSPATH
## To run tests under a debugger, set this to eg: "gdb --args".
GDB =
# The actual Emacs command run in the targets below.
# Prevent any setting of EMACSLOADPATH in user environment causing problems.
emacs = EMACSLOADPATH= LC_ALL=C $(GDB) "$(EMACS)" $(EMACSOPT)
.PHONY: all check
all: check
# In GNU Emacs there is a bashism here to direct output to file and to standard
# output at the same time.
WRITE_LOG = 2>&1 | tee $@
%.log: %.el
$(emacs) -l ert -l $< -f ert-run-tests-batch-and-exit ${WRITE_LOG}
ELFILES = $(wildcard */*.el)
LOGFILES = $(patsubst %.el,%.log, ${ELFILES})
TESTS = ${LOGFILES:.log=}
## If we have to interrupt a hanging test, preserve the log so we can
## see what the problem was.
.PRECIOUS: %.log
.PHONY: ${TESTS}
## The short aliases that always re-run the tests, with no logging.
define test_template
$(1):
@test ! -f $(1).log || mv $(1).log $(1).log~
@${MAKE} $(1).log WRITE_LOG=
endef
$(foreach test,${TESTS},$(eval $(call test_template,${test})))
## Re-run all the tests every time.
check:
-@for f in */*.log; do test ! -f $$f || mv $$f $$f~; done
@${MAKE} ${LOGFILES}
.PHONY: clean
clean:
-rm -f */*.log */*.log~
# Makefile ends here.

View File

@@ -0,0 +1 @@
Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod \(0 = 1\) tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.

View File

@@ -0,0 +1,5 @@
Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod
\(0 = 1\) tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem
ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi
consequatur.

View File

@@ -0,0 +1,109 @@
;;; latex-test.el --- tests for LaTeX mode
;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(require 'latex)
(defun AUCTeX-set-ert-path (&rest sym-val)
"Set first element of SYM-VAL to the next one, and so on.
The value is the path to the test file, make sure it is expanded
in the right directory even when the ERT test from the command
line and from another directory."
(while sym-val
(set (pop sym-val)
(expand-file-name (pop sym-val)
(when load-file-name
(file-name-directory load-file-name))))))
(AUCTeX-set-ert-path
'LaTeX-indent-tabular-test/in
"tabular-in.tex"
'LaTeX-indent-tabular-test/out
"tabular-out.tex"
'LaTeX-filling/in
"latex-filling-in.tex"
'LaTeX-filling/out
"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=
(with-temp-buffer
(insert-file-contents LaTeX-indent-tabular-test/in)
(LaTeX-mode)
(indent-region (point-min) (point-max))
(buffer-string))
(with-temp-buffer
(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
;; there.
(ert-deftest LaTeX-filling ()
(should (string=
(with-temp-buffer
(insert-file-contents LaTeX-filling/in)
(LaTeX-mode)
(let ((fill-column 70))
(fill-paragraph))
(buffer-string))
(with-temp-buffer
(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

View File

@@ -0,0 +1,17 @@
\[
x
\]
\[
\begin{split}
x &= y \\
y &= z
\end{split}
\]
\begin{itemize}
\item Some text here
\[
x
\]
\end{itemize}

View File

@@ -0,0 +1,17 @@
\[
x
\]
\[
\begin{split}
x &= y \\
y &= z
\end{split}
\]
\begin{itemize}
\item Some text here
\[
x
\]
\end{itemize}

View File

@@ -0,0 +1,41 @@
\documentclass{article}
\begin{document}
\begin{tabular}{llll}
Lorem ipsum dolor & sit amet, ei mei
paulo tation honestatis,
intellegam & accommodare ne vim, ut
mel solum putant
atomorum. Posse & dolores has ut,\\
prompta & disputando & ne mel, ne
viderer ceteros
vel. & No petentium
\\
reformidans mel. & Quo no sale
natum, cu
pericula & deterruisset
usu. Nec & bonorum detracto\\
detraxit & no. & Ne sea doming & deserunt.
\end{tabular}
\begin{tabular}{ll}
1 & 2 & 3
\\
& 4 & 5
\\
6 & 7
& 8\\
9 &
10
& 11
\end{tabular}
\begin{align}
1 & 2
3 & 4
5\\
6 &
7
8 &
9
\end{align}
\end{document}

View File

@@ -0,0 +1,41 @@
\documentclass{article}
\begin{document}
\begin{tabular}{llll}
Lorem ipsum dolor & sit amet, ei mei
paulo tation honestatis,
intellegam & accommodare ne vim, ut
mel solum putant
atomorum. Posse & dolores has ut,\\
prompta & disputando & ne mel, ne
viderer ceteros
vel. & No petentium
\\
reformidans mel. & Quo no sale
natum, cu
pericula & deterruisset
usu. Nec & bonorum detracto\\
detraxit & no. & Ne sea doming & deserunt.
\end{tabular}
\begin{tabular}{ll}
1 & 2 & 3
\\
& 4 & 5
\\
6 & 7
& 8\\
9 &
10
& 11
\end{tabular}
\begin{align}
1 & 2
3 & 4
5\\
6 &
7
8 &
9
\end{align}
\end{document}

View File

@@ -0,0 +1,36 @@
;;; command-expansion.el --- tests for TeX command expansion
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(require 'tex-buf)
(ert-deftest TeX-command-expansion ()
"Check whether \"%%%%\" is correctly expanded when before \"%`\"."
(should (string=
(let ((TeX-command-list
(list (cons "Test" '("%%%% %`%'" TeX-run-command t t)))))
(TeX-command-expand (nth 1 (assoc "Test" TeX-command-list))
'TeX-master-file))
"%% \"\\input\"")))
;;; command-expansion.el ends here