mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add a testcase for deterministic msgid order
This commit is contained in:
5
tests/roots/test-intl-template/_templates/template1.html
Normal file
5
tests/roots/test-intl-template/_templates/template1.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<h1>{{ _('Template 1') }}</h1>
|
||||||
|
<p>{%trans%}This is Template 1.{%endtrans%}</p>
|
||||||
|
{% endblock %}
|
||||||
5
tests/roots/test-intl-template/_templates/template2.html
Normal file
5
tests/roots/test-intl-template/_templates/template2.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<h1>{{ _('Template 2') }}</h1>
|
||||||
|
<p>{%trans%}This is Template 2.{%endtrans%}</p>
|
||||||
|
{% endblock %}
|
||||||
3
tests/roots/test-intl-template/conf.py
Normal file
3
tests/roots/test-intl-template/conf.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
templates_path = ['_templates']
|
||||||
0
tests/roots/test-intl-template/contents.rst
Normal file
0
tests/roots/test-intl-template/contents.rst
Normal file
@@ -165,3 +165,18 @@ def test_gettext_template(app):
|
|||||||
result = (app.outdir / 'sphinx.pot').text(encoding='utf-8')
|
result = (app.outdir / 'sphinx.pot').text(encoding='utf-8')
|
||||||
assert "Welcome" in result
|
assert "Welcome" in result
|
||||||
assert "Sphinx %(version)s" in result
|
assert "Sphinx %(version)s" in result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('gettext', testroot='intl-template')
|
||||||
|
def test_gettext_template_msgid_order_in_sphinxpot(app):
|
||||||
|
app.builder.build_all()
|
||||||
|
assert (app.outdir / 'sphinx.pot').isfile()
|
||||||
|
|
||||||
|
result = (app.outdir / 'sphinx.pot').text(encoding='utf-8')
|
||||||
|
assert re.search(
|
||||||
|
('msgid "Template 1".*'
|
||||||
|
'msgid "This is Template 1\.".*'
|
||||||
|
'msgid "Template 2".*'
|
||||||
|
'msgid "This is Template 2\.".*'),
|
||||||
|
result,
|
||||||
|
flags=re.S)
|
||||||
|
|||||||
Reference in New Issue
Block a user