mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
C, simplify tests
This commit is contained in:
parent
088cef98bc
commit
71a656498b
@ -1,10 +0,0 @@
|
|||||||
.. c:member:: int member;
|
|
||||||
.. c:var:: int var;
|
|
||||||
.. c:function:: void f();
|
|
||||||
.. .. c:macro:: NO_SEMICOLON;
|
|
||||||
.. c:struct:: Struct;
|
|
||||||
.. c:union:: Union;
|
|
||||||
.. c:enum:: Enum;
|
|
||||||
.. c:enumerator:: Enumerator;
|
|
||||||
.. c:type:: Type;
|
|
||||||
.. c:type:: int TypeDef;
|
|
@ -526,8 +526,15 @@ def test_attributes():
|
|||||||
# raise DefinitionError("")
|
# raise DefinitionError("")
|
||||||
|
|
||||||
|
|
||||||
|
def split_warnigns(warning):
|
||||||
|
ws = warning.getvalue().split("\n")
|
||||||
|
assert len(ws) >= 1
|
||||||
|
assert ws[-1] == ""
|
||||||
|
return ws[:-1]
|
||||||
|
|
||||||
|
|
||||||
def filter_warnings(warning, file):
|
def filter_warnings(warning, file):
|
||||||
lines = warning.getvalue().split("\n")
|
lines = split_warnigns(warning)
|
||||||
res = [l for l in lines if "domain-c" in l and "{}.rst".format(file) in l and
|
res = [l for l in lines if "domain-c" in l and "{}.rst".format(file) in l and
|
||||||
"WARNING: document isn't included in any toctree" not in l]
|
"WARNING: document isn't included in any toctree" not in l]
|
||||||
print("Filtered warnings for file '{}':".format(file))
|
print("Filtered warnings for file '{}':".format(file))
|
||||||
@ -581,10 +588,22 @@ def test_build_domain_c_anon_dup_decl(app, status, warning):
|
|||||||
assert "WARNING: c:identifier reference target not found: @b" in ws[1]
|
assert "WARNING: c:identifier reference target not found: @b" in ws[1]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
|
@pytest.mark.sphinx(confoverrides={'nitpicky': True})
|
||||||
def test_build_domain_c_semicolon(app, status, warning):
|
def test_build_domain_c_semicolon(app, warning):
|
||||||
app.builder.build_all()
|
text = """
|
||||||
ws = filter_warnings(warning, "semicolon")
|
.. c:member:: int member;
|
||||||
|
.. c:var:: int var;
|
||||||
|
.. c:function:: void f();
|
||||||
|
.. .. c:macro:: NO_SEMICOLON;
|
||||||
|
.. c:struct:: Struct;
|
||||||
|
.. c:union:: Union;
|
||||||
|
.. c:enum:: Enum;
|
||||||
|
.. c:enumerator:: Enumerator;
|
||||||
|
.. c:type:: Type;
|
||||||
|
.. c:type:: int TypeDef;
|
||||||
|
"""
|
||||||
|
restructuredtext.parse(app, text)
|
||||||
|
ws = split_warnigns(warning)
|
||||||
assert len(ws) == 0
|
assert len(ws) == 0
|
||||||
|
|
||||||
|
|
||||||
@ -659,6 +678,8 @@ def test_noindexentry(app):
|
|||||||
|
|
||||||
@pytest.mark.sphinx(testroot='domain-c-intersphinx', confoverrides={'nitpicky': True})
|
@pytest.mark.sphinx(testroot='domain-c-intersphinx', confoverrides={'nitpicky': True})
|
||||||
def test_intersphinx(tempdir, app, status, warning):
|
def test_intersphinx(tempdir, app, status, warning):
|
||||||
|
# a splitting of test_ids_vs_tags0 into the primary directives in a remote project,
|
||||||
|
# and then the references in the test project
|
||||||
origSource = """\
|
origSource = """\
|
||||||
.. c:member:: int _member
|
.. c:member:: int _member
|
||||||
.. c:var:: int _var
|
.. c:var:: int _var
|
||||||
|
Loading…
Reference in New Issue
Block a user