auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. dda49328337a847629e61


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. dda49328337a847629e615d483d7b712bea85016
Date: Wed, 31 Mar 2021 14:16:12 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  dda49328337a847629e615d483d7b712bea85016 (commit)
      from  c2a40eb8e32ac79e779bf7d7c0b2c896a08736bb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dda49328337a847629e615d483d7b712bea85016
Author: Arash Esbati <arash@gnu.org>
Date:   Wed Mar 31 20:08:40 2021 +0200

    Add new fontification test
    
    * tests/latex/font-latex-test.el
    (font-latex-general-fontification): Add test for general
    fontification of vanilla LaTeX files.

diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
index 5e5fccf..577ec77 100644
--- a/tests/latex/font-latex-test.el
+++ b/tests/latex/font-latex-test.el
@@ -83,4 +83,182 @@ $a$")
       (should (font-latex-extend-region-backwards-quotation))
       (should (= font-lock-beg 5)))))
 
+(ert-deftest font-latex-general-fontification ()
+  "Test general fontification in a LaTeX file."
+  (with-temp-buffer
+    (let ((TeX-install-font-lock 'font-latex-setup)
+          (font-latex-fontify-sectioning 'color))
+      (insert "\
+\\documentclass[10pt]{article}
+\\begin{document}
+\\section{Macros}
+Inline verbatim test:  \\verb|x|
+Inline math test:      $x$, \\(x\\)
+Marginpar test:        \\marginpar{x}
+Sedate macro test:     \\sedate
+\\section{Font Specifiers}
+Roman face test:       \\textrm{x}
+Bold face test:        \\textbf{x}
+Italic face test:      \\textit{x}
+Bold italic face test: \\textit{\\textbf{x}}
+Emphasize face test:   \\emph{x}
+Declarations test:     \\ttfamily x {\\ttfamily x}
+                       \\itshape  x {\\itshape x}
+                       \\bfseries x {\\bfseries x}
+\\section{Environments}
+\\subsection{Math}
+\\begin{math}
+  x
+\\end{math}
+\\[
+  x
+\\]
+\\[x\\]
+\\begin{displaymath}
+  x
+\\end{displaymath}
+\\begin{equation}
+  x
+\\end{equation}
+\\subsection{Misc.}
+\\begin{verbatim}
+x
+\\end{verbatim}
+\\begin{description}
+\\item[x] x
+\\end{description}
+\\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:\n")
+      (LaTeX-mode)
+      (font-lock-ensure)
+      (goto-char (point-min))
+
+      ;; Test for \documentclass:
+      (search-forward-regexp "\\\\document\\(?1:c\\)lass\\[")
+      (should (font-latex-faces-present-p 'font-lock-keyword-face
+                                          (match-beginning 1)))
+      (forward-char)
+      ;; Optional argument
+      (should (font-latex-faces-present-p 'font-lock-variable-name-face))
+      (search-forward "{")
+      (forward-char)
+      ;; Mandatory argument:
+      (should (font-latex-faces-present-p 'font-lock-function-name-face))
+      (end-of-line)
+
+      ;; Test for \section macro itself:
+      (search-forward-regexp "\\\\sec\\(?1:t\\)ion{")
+      (should (font-latex-faces-present-p 'font-lock-keyword-face
+                                          (match-beginning 1)))
+      (goto-char (match-end 0))
+      (forward-char)
+      ;; Test for the argument of \section:
+      (should (font-latex-faces-present-p 'font-lock-type-face))
+      (end-of-line)
+
+      ;; Test for inline verb:
+      (search-forward "\\verb|")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (end-of-line)
+
+      ;; Test for inline math:
+      (search-forward "$")
+      (should (font-latex-faces-present-p 'font-latex-math-face))
+      (search-forward "\\(")
+      (should (font-latex-faces-present-p 'font-latex-math-face))
+      (end-of-line)
+
+      ;; Test for marginpar:
+      (search-forward "\\marginpar{")
+      (should (font-latex-faces-present-p 'font-lock-constant-face))
+      (end-of-line)
+
+      ;; Test for unfontified macro:
+      (search-forward "\\seda")
+      (should (font-latex-faces-present-p 'font-latex-sedate-face))
+      (end-of-line)
+
+      ;; Test for font specifiers:
+      (search-forward "\\textrm{")
+      (should (font-latex-faces-present-p 'font-lock-type-face))
+      (end-of-line)
+      (search-forward "\\textbf{")
+      (should (font-latex-faces-present-p 'font-latex-bold-face))
+      (end-of-line)
+      (search-forward "\\textit{")
+      (should (font-latex-faces-present-p 'font-latex-italic-face))
+      (end-of-line)
+      (search-forward "\\textit{\\textbf{")
+      (should (font-latex-faces-present-p '(font-latex-italic-face
+                                            font-latex-bold-face)))
+      (end-of-line)
+      (search-forward "\\emph{")
+      (should (font-latex-faces-present-p 'font-latex-italic-face))
+      (end-of-line)
+      (search-forward "\\ttfam")
+      (should (font-latex-faces-present-p 'font-lock-type-face))
+      (search-forward "\\ttfamily ")
+      (should (font-latex-faces-present-p 'font-lock-type-face))
+      (end-of-line)
+      (search-forward "\\itsha")
+      (should (font-latex-faces-present-p 'font-latex-italic-face))
+      (search-forward "\\itshape ")
+      (should (font-latex-faces-present-p 'font-latex-italic-face))
+      (end-of-line)
+      (search-forward "\\bfseri")
+      (should (font-latex-faces-present-p 'font-latex-bold-face))
+      (search-forward "\\bfseries ")
+      (should (font-latex-faces-present-p 'font-latex-bold-face))
+      (end-of-line)
+
+      ;; Test for math environments:
+      (search-forward-regexp "\\\\be\\(?1:g\\)in{ma\\(?2:t\\)h}")
+      (should (font-latex-faces-present-p 'font-lock-keyword-face
+                                          (match-beginning 1)))
+      (should (font-latex-faces-present-p 'font-lock-function-name-face
+                                          (match-beginning 2)))
+      (forward-line)
+      (skip-chars-forward "[:blank:]")
+      (should (font-latex-faces-present-p 'font-latex-math-face))
+      (LaTeX-find-matching-end)
+
+      (search-forward "\\[")
+      (forward-line)
+      (skip-chars-forward "[:blank:]")
+      (should (font-latex-faces-present-p 'font-latex-math-face))
+
+      (search-forward "\\[")
+      (should (font-latex-faces-present-p 'font-latex-math-face))
+      (end-of-line)
+
+      (search-forward "\\begin{displaymath}")
+      (forward-line)
+      (skip-chars-forward "[:blank:]")
+      (should (font-latex-faces-present-p 'font-latex-math-face))
+      (LaTeX-find-matching-end)
+
+      (search-forward "\\begin{equation}")
+      (forward-line)
+      (skip-chars-forward "[:blank:]")
+      (should (font-latex-faces-present-p 'font-latex-math-face))
+      (LaTeX-find-matching-end)
+
+      ;; Test for misc. environments:
+      (search-forward "\\begin{verbatim}")
+      (forward-line)
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (LaTeX-find-matching-end)
+
+      ;; Check the fontification of \item macro itself:
+      (search-forward-regexp "\\\\it\\(?1:e\\)m\\[")
+      (should (font-latex-faces-present-p 'font-lock-keyword-face
+                                          (match-beginning 1)))
+      ;; Now for the optional argument:
+      (should (font-latex-faces-present-p 'font-lock-variable-name-face))
+      (LaTeX-find-matching-end)  )))
+
 ;;; font-latex-test.el ends here

-----------------------------------------------------------------------

Summary of changes:
 tests/latex/font-latex-test.el | 178 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 178 insertions(+)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]