Add a testcase for deterministic msgid order

This commit is contained in:
cocoatomo 2018-02-18 09:05:32 +09:00
parent 582c829fa8
commit 07d2cdd47b
5 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,5 @@
{% extends "layout.html" %}
{% block body %}
<h1>{{ _('Template 1') }}</h1>
<p>{%trans%}This is Template 1.{%endtrans%}</p>
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "layout.html" %}
{% block body %}
<h1>{{ _('Template 2') }}</h1>
<p>{%trans%}This is Template 2.{%endtrans%}</p>
{% endblock %}

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
templates_path = ['_templates']

View File

@ -165,3 +165,18 @@ def test_gettext_template(app):
result = (app.outdir / 'sphinx.pot').text(encoding='utf-8')
assert "Welcome" 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)