branch: externals/auctex commit 891bba7c125e7fff5e0c345e5aab1a28a809902e Author: Mosè Giordano <m...@gnu.org> Commit: Mosè Giordano <m...@gnu.org>
Add ERT test for error parsing * tests/tex/compilation-log.txt: Add minimal example of compilation log that failed to be parsed correctly with the old parsing function. * tests/tex/error-parsing.el: New ERT test. --- tests/tex/compilation-log.txt | 8 ++++++ tests/tex/error-parsing.el | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 0 deletions(-) diff --git a/tests/tex/compilation-log.txt b/tests/tex/compilation-log.txt new file mode 100644 index 0000000..f28dbf1 --- /dev/null +++ b/tests/tex/compilation-log.txt @@ -0,0 +1,8 @@ +(./test.tex +(/opt/texlive/2015/texmf-dist/tex/context/base/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +) + +Package foo Warning: This is a warning! + +[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)) diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el new file mode 100644 index 0000000..aa01629 --- /dev/null +++ b/tests/tex/error-parsing.el @@ -0,0 +1,55 @@ +;;; 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) + (insert-file-contents TeX-test-compilation-log) + (TeX-parse-all-errors) + TeX-error-list) + '((warning "./test.tex" nil "Package foo Warning: This is a warning!" + 0 "Package foo Warning: This is a warning!\n" + nil nil nil 170))))) + +;;; error-parsing.el ends here