Initial commit

This commit is contained in:
Mateus Pinto Rodrigues
2017-11-11 15:15:10 -02:00
commit 58c3bd6728
1202 changed files with 434097 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
;;; 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\"")))
(ert-deftest TeX-command-expansion-errors ()
"Test error handling in `TeX-command-expand'."
(should-error
;; This error is actually thrown by `TeX-engine-in-engine-alist', but we want
;; to be sure that `TeX-command-expand' fails when the engine is not valid.
(let ((TeX-engine 'non-existing-engine))
(TeX-command-expand "%l" 'TeX-master-file))))
(ert-deftest TeX-view-command-raw-errors ()
"Tests to trigger errors in `TeX-view-command-raw'."
;; Viewer specification should be either a command line string or a Lisp
;; function name to be executed. This test makes sure that the functions
;; throws an error if the selected viewer has a wrong specification (for
;; example a function call, not the function name) such that the returned
;; value `command' isn't a string. This prevents an infinite loop in
;; `TeX-command-expand'.
(should-error
(with-temp-buffer
(let ((TeX-view-program-list '(("viewer"
(wrong-specification))))
(TeX-view-program-selection
'((output-pdf "viewer"))))
(TeX-mode)
(TeX-view-command-raw)))
:type 'error)
;; Signal an error when a nonexistent viewer is selected.
(should-error
(with-temp-buffer
(let ((TeX-view-program-selection
'((output-pdf "does-not-exist"))))
(TeX-mode)
(TeX-view-command-raw)))
:type 'error)
;; Signal an error if the binary associated to the viewer cannot be found.
(should-error
(with-temp-buffer
(let ((TeX-view-program-list
'(("viewer" "viewer %o" "**this-program-does-not-exist**")))
(TeX-view-program-selection
'((output-pdf "viewer"))))
(TeX-mode)
(TeX-view-command-raw)))
:type 'error)
;; Error if there is no selected viewer for current buffer.
(should-error
(with-temp-buffer
(let (TeX-view-program-selection)
(TeX-mode)
(TeX-view-command-raw)))
:type 'error))
;;; command-expansion.el ends here

View File

@@ -0,0 +1,72 @@
(./test.tex (./nice-class.cls
Document Class: nice-class 1970/01/01 v42 A good class
Package nice-class Warning: ******************************************
(nice-class) * THIS IS JUST A WARNING WITH A PESKY
(nice-class) * UNMATCHED CLOSED PARENTHESIS :-)
(nice-class) ****************************************** on input line 32.
)
(/opt/texlive/2015/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
./test.tex:2: Class nice-class Error: ***********************************
(nice-class) * This is a very bad error!
(nice-class) ************************************.
See the suftesi class documentation for explanation.
Type H <return> for immediate help.
...
l.2 \begin{document}
(/other/packages/loaded.sty)
ABD: EveryShipout initializing macros
Package foo Warning: This is a warning! on input line 3.
[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
(./secondary-file.tex [8] [9] [10 <./path/to/file>]
Underfull \hbox (badness 6608) in paragraph at lines 131--132
[]|\T1/jkpl/m/n/10.95 (+20) Something bla
[11] [12])
LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4.
LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> not available
(Font) size <5> substituted on input line 70.
[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
(./test.lof
Underfull \vbox (badness 1048) has occurred while \output is active [7]
Overfull \hbox (0.93071pt too wide) detected at line 31
[]\T1/jkpl/m/n/10.95 144
)
(./file name/with spaces.tex
chapter 5.
<use image/an_image.pdf> [82] [83 <./image/an_image.pdf>] [84] [85] [86] (./image/another.tex
<image/another.pdf, id=1357, 208.78pt x 146.5475pt> <use image/another.pdf>)
<image/another2.pdf, id=1358, 542.025pt x 481.8pt> <use image/another2.pdf>
Underfull \vbox (badness 3942) has occurred while \output is active [87 <./image/another.pdf> <./image/another2.pdf>] [88] (./image/beta.tex
<image/beta.pdf, id=1410, 289.08pt x 201.75375pt>
<use image/beta.pdf>) [89] [90 <./image/beta.pdf>]
Overfull \hbox (13.59138pt too wide) in paragraph at lines 367--368
[]\T1/pplj/m/n/10.95 Un qua-dri-vet-to-re co-va-rian-te $\OMS/zplm/m/n/10.95 f\OML/zplm/m/it/10.95 A[]\OMS/zplm/m/n/10.95 g$ \T1/pplj/m/n/10.95 e un in-sie-me di quat-tro quan-ti-ta $\OT1/zplm/m/n/10.95 (\OML/zplm/m/it/10.95 A[]; A[]; A[]; A[]\OT1/zplm/m/n/10.95 )$
[91] [92]
[93])
! Undefined control sequence.
l.11 \doesnotexist
(./foo.aux) )
LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input line 48.
LaTeX Warning: There were undefined references.
)

View File

@@ -0,0 +1,165 @@
;;; error-parsing.el --- tests for error parsing
;; Copyright (C) 2016 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)
(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 is run 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
'TeX-test-compilation-log
"compilation-log.txt")
(ert-deftest TeX-error-parsing ()
"Test error parsing functions."
(should (equal
(with-temp-buffer
(setq TeX-debug-warnings t
TeX-debug-bad-boxes t)
(insert-file-contents TeX-test-compilation-log)
(TeX-parse-all-errors)
TeX-error-list)
'((warning
"./nice-class.cls" 32
"Package nice-class Warning: ******************************************"
0
"Package nice-class Warning: ******************************************
(nice-class) * THIS IS JUST A WARNING WITH A PESKY
(nice-class) * UNMATCHED CLOSED PARENTHESIS :-)
(nice-class) ****************************************** on input line 32.\n"
nil 32 nil 376 nil)
(error
"./test.tex" 2
"Class nice-class Error: ***********************************" 0
"\n(nice-class) * This is a very bad error!
(nice-class) ************************************.
See the suftesi class documentation for explanation.
Type H <return> for immediate help.
...
l.2 \\begin{document}
(/other/packages/loaded.sty)
ABD: EveryShipout initializing macros"
"\\begin{document}\n\n(/other/packages/loaded.sty)" nil nil 971 nil)
(warning "./test.tex" 3
"Package foo Warning: This is a warning! on input line 3." 0
"Package foo Warning: This is a warning! on input line 3.\n"
nil 3 nil 1030 nil)
(bad-box
"./secondary-file.tex" 131
"Underfull \\hbox (badness 6608) in paragraph at lines 131--132"
0 "\n[]|\\T1/jkpl/m/n/10.95 (+20) Something bla" "bla"
132 t 1268 nil)
(warning "./test.tex" 4
"LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4."
0
"LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4.\n"
"wrong" 4 nil 1351 nil)
(warning "./test.tex" 70 "LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> not available"
0 "LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> not available
(Font) size <5> substituted on input line 70.\n" nil 70 nil 1485 nil)
(bad-box "./test.lof" nil "Underfull \\vbox (badness 1048) has occurred while \\output is active [7]"
0 "\nUnderfull \\vbox (badness 1048) has occurred while \\output is active [7]"
nil nil t 1651 nil)
;; It is possible there are two different bad box warnings in two
;; consecutive lines (for example it happens if the first one is a
;; vertical bad box which doesn't provide additional information),
;; this test makes sure the second warning is not mistaken as
;; context of the first one.
(bad-box "./test.lof" 31 "Overfull \\hbox (0.93071pt too wide) detected at line 31"
0 "\n []\\T1/jkpl/m/n/10.95 144" "144" 31 t 1733 nil)
;; The line of this warning ends with a new file opened. This test
;; makes sure point stays exactly at the end of the warning so that
;; the next the next warning in the list has the right file
;; (otherwise it would be nil).
(bad-box "./file name/with spaces.tex" nil "Underfull \\vbox (badness 3942) has occurred while \\output is active [87 <./image/another.pdf> <./image/another2.pdf>]"
0 "\nUnderfull \\vbox (badness 3942) has occurred while \\output is active [87 <./image/another.pdf> <./image/another2.pdf>]"
nil nil t 2142 nil)
(bad-box "./file name/with spaces.tex" 367 "Overfull \\hbox (13.59138pt too wide) in paragraph at lines 367--368"
0 "\n[]\\T1/pplj/m/n/10.95 Un qua-dri-vet-to-re co-va-rian-te $\\OMS/zplm/m/n/10.95 f\\OML/zplm/m/it/10.95 A[]\\OMS/zplm/m/n/10.95 g$ \\T1/pplj/m/n/10.95 e un in-sie-me di quat-tro quan-ti-ta $\\OT1/zplm/m/n/10.95 (\\OML/zplm/m/it/10.95 A[]; A[]; A[]; A[]\\OT1/zplm/m/n/10.95 )$" "$"
368 t 2600 nil)
(error "./test.tex" 11 "Undefined control sequence." 0
"\nl.11 \\doesnotexist\n\n(./foo.aux) )"
"\\doesnotexist\n" nil nil 2682 nil)
(warning "./test.tex" 48
"LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input line 48." 0
"LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input line 48.\n"
"Knuth:TeXbook-1984" 48 nil 2756 nil)
(warning "./test.tex" nil "LaTeX Warning: There were undefined references."
0 "LaTeX Warning: There were undefined references.\n" nil nil nil 2805 nil)
))))
(ert-deftest TeX-error-parsing-expl3-warnings ()
"Test parsing of expl3 warnings."
(should (equal
(with-temp-buffer
(setq TeX-debug-warnings t
TeX-debug-bad-boxes t)
(insert
"*************************************************
* xsim warning: \"rerun\"
*
* Exercise properties may have changed. Rerun to get them synchronized.
*************************************************
")
(TeX-parse-all-errors)
TeX-error-list)
'((warning nil nil "* xsim warning: \"rerun\"" 0
"* xsim warning: \"rerun\"\n* \n* Exercise properties may have changed. Rerun to get them synchronized.\n*************************************************\n"
nil nil nil 200 nil)))))
;; See https://lists.gnu.org/archive/html/auctex/2017-04/msg00007.html.
(ert-deftest TeX-LaTeX2e-date ()
"Test parsing of different LaTeX2e date formats."
(should
(equal
(with-temp-buffer
(insert "LaTeX2e <2017-04-15>")
(goto-char (point-min))
(let ((TeX-command-buffer (buffer-name)))
(TeX-LaTeX-sentinel nil "LaTeX")
TeX-command-next))
"View"))
(should
(equal
(with-temp-buffer
(insert "LaTeX2e <2017/01/01> patch level 3")
(goto-char (point-min))
(let ((TeX-command-buffer (buffer-name)))
(TeX-LaTeX-sentinel nil "LaTeX")
TeX-command-next))
"View")))
;;; error-parsing.el ends here