From 6d610980583f26247504058790c00be93ca901f3 Mon Sep 17 00:00:00 2001 From: Jakob Lykke Andersen Date: Tue, 3 Oct 2017 14:35:10 +0200 Subject: [PATCH] C++, add test case for sphinx-doc/sphinx#4096 --- CHANGES | 1 + tests/roots/test-domain-cpp/roles2.rst | 5 +++++ tests/test_domain_cpp.py | 7 +++++++ 3 files changed, 13 insertions(+) create mode 100644 tests/roots/test-domain-cpp/roles2.rst diff --git a/CHANGES b/CHANGES index ada1a5190..293e90604 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ Bugs fixed * #4085: Failed PDF build from image in parsed-literal using ``:align:`` option * #4100: Remove debug print from autodoc extension * #3987: Changing theme from alabaster causes HTML build to fail +* #4096: C++, don't crash when using the wrong role type. Thanks to mitya57. Testing -------- diff --git a/tests/roots/test-domain-cpp/roles2.rst b/tests/roots/test-domain-cpp/roles2.rst new file mode 100644 index 000000000..644b827ca --- /dev/null +++ b/tests/roots/test-domain-cpp/roles2.rst @@ -0,0 +1,5 @@ +Check that we don't crash just because we misuse a role. + +.. cpp:class:: A + +:cpp:func:`A` diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py index 08ca6f962..2932f356f 100644 --- a/tests/test_domain_cpp.py +++ b/tests/test_domain_cpp.py @@ -508,6 +508,13 @@ def test_attributes(): # raise DefinitionError("") +@pytest.mark.sphinx(testroot='domain-cpp') +def test_build_domain_cpp_misuse_of_roles(app, status, warning): + app.builder.build_all() + + # TODO: properly check for the warnings we expect + + @pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'add_function_parentheses': True}) def test_build_domain_cpp_with_add_function_parentheses_is_True(app, status, warning): app.builder.build_all()