test: check latex document beginning

* Check some commands in latex basic test:

  * \begin{document}
  * \maketitle
  * \sphinxtableofcontents

* Add a test on shorthandoff insertion

Signed-off-by: Alizée Penel <alizee@lse.epita.fr>
This commit is contained in:
Alizée Penel 2018-06-20 00:36:13 +02:00
parent a3bfccc11f
commit a8f23b1d44
No known key found for this signature in database
GPG Key ID: 1C1838F4682C4EAB

View File

@ -178,11 +178,27 @@ def test_latex_basic(app, status, warning):
print(result)
print(status.getvalue())
print(warning.getvalue())
assert r'\begin{document}' in result
assert r'\maketitle' in result
assert r'\sphinxtableofcontents' in result
assert r'\title{The basic Sphinx documentation for testing}' in result
assert r'\release{}' in result
assert r'\renewcommand{\releasename}{}' in result
@pytest.mark.sphinx('latex', testroot='basic', confoverrides={'language':'de'})
def test_latex_shorthandoff(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'test.tex').text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
assert ('\\ifdefined\\shorthandoff\n'
' \\ifnum\\catcode`\\=\\string=\\active\\shorthandoff{=}\\fi\n'
' \\ifnum\\catcode`\\"=\\active\\shorthandoff{"}\\fi\n'
'\\fi\n' in result)
@pytest.mark.sphinx('latex', testroot='latex-title')
def test_latex_title_after_admonitions(app, status, warning):
app.builder.build_all()