From: Vladimír Vondruš Date: Sun, 9 Jan 2022 18:32:30 +0000 (+0100) Subject: documentation/doxygen: explicitly check for warning logs. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=da856addd0c779e4917784ccd6966f6dc8305092;p=blog.git documentation/doxygen: explicitly check for warning logs. The output was quite a mess already, and that's just because I didn't know about assertLogs() until now. --- diff --git a/documentation/doxygen.py b/documentation/doxygen.py index e1483d28..e29d4f36 100755 --- a/documentation/doxygen.py +++ b/documentation/doxygen.py @@ -409,7 +409,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. out.params.update(parsed.params) if parsed.return_value: if out.return_value: - logging.warning("{}: superfluous @return section found, ignoring: {} ".format(state.current, ''.join(i.itertext()))) + logging.warning("{}: superfluous @return section found, ignoring: {}".format(state.current, ''.join(i.itertext()).rstrip())) else: out.return_value = parsed.return_value if parsed.return_values: @@ -812,7 +812,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. # Return value is separated from the text flow if i.attrib['kind'] == 'return': if out.return_value: - logging.warning("{}: superfluous @return section found, ignoring: {} ".format(state.current, ''.join(i.itertext()))) + logging.warning("{}: superfluous @return section found, ignoring: {}".format(state.current, ''.join(i.itertext()).rstrip())) else: out.return_value = parse_desc(state, i) @@ -2176,26 +2176,28 @@ def is_a_stupid_empty_markdown_page(compounddef: ET.Element): return compounddef.find('compoundname').text.startswith('md_') and compounddef.find('compoundname').text.endswith(compounddef.find('title').text) and not compounddef.find('briefdescription') and not compounddef.find('detaileddescription') def extract_metadata(state: State, xml): - basename = os.path.basename(xml) + # parse_desc() / parse_inline_desc() is called from here, be sure to set + # current filename so it's reflected in possible warnings + state.current = os.path.basename(xml) # These early returns should be kept consistent with parse_xml() - if basename == 'Doxyfile.xml': - logging.debug("Ignoring {}".format(basename)) + if state.current == 'Doxyfile.xml': + logging.debug("Ignoring {}".format(state.current)) return - logging.debug("Extracting metadata from {}".format(basename)) + logging.debug("Extracting metadata from {}".format(state.current)) try: tree = ET.parse(xml) except ET.ParseError as e: - logging.error("{}: XML parse error, skipping whole file: {}".format(basename, e)) + logging.error("{}: XML parse error, skipping whole file: {}".format(state.current, e)) return root = tree.getroot() # From index.xml we need just list of all example files in correct order, # nothing else - if basename == 'index.xml': + if state.current == 'index.xml': for i in root: if i.attrib['kind'] == 'example': compound = Empty() @@ -2207,16 +2209,16 @@ def extract_metadata(state: State, xml): # From other files we expect if root.tag != 'doxygen': - logging.warning("{}: root element expected to be but is <{}>, skipping whole file".format(basename, root.tag)) + logging.warning("{}: root element expected to be but is <{}>, skipping whole file".format(state.current, root.tag)) return compounddef: ET.Element = root[0] if compounddef.tag != 'compounddef': - logging.warning("{}: first child element expected to be but is <{}>, skipping whole file".format(basename, compounddef.tag)) + logging.warning("{}: first child element expected to be but is <{}>, skipping whole file".format(state.current, compounddef.tag)) return assert len([i for i in root]) == 1 if compounddef.attrib['kind'] not in ['namespace', 'group', 'class', 'struct', 'union', 'dir', 'file', 'page']: - logging.debug("No useful info in {}, skipping".format(basename)) + logging.debug("No useful info in {}, skipping".format(state.current)) return # In order to show also undocumented members, go through all empty diff --git a/documentation/test_doxygen/compound_listing/Class_8h.html b/documentation/test_doxygen/compound_listing/Class_8h.html index 0d902bc5..2cd3964b 100644 --- a/documentation/test_doxygen/compound_listing/Class_8h.html +++ b/documentation/test_doxygen/compound_listing/Class_8h.html @@ -78,6 +78,10 @@ union Root::Directory::Sub::Class::Bar
A protected subclass.
+
+ struct Root::Directory::Sub::Warning +
+
A struct producing warnings.
diff --git a/documentation/test_doxygen/compound_listing/Directory/Sub/Class.h b/documentation/test_doxygen/compound_listing/Directory/Sub/Class.h index d5ca95cb..2e0f4486 100644 --- a/documentation/test_doxygen/compound_listing/Directory/Sub/Class.h +++ b/documentation/test_doxygen/compound_listing/Directory/Sub/Class.h @@ -89,17 +89,6 @@ class Class { /** @brief A protected variable */ std::string logger; - /** @{ */ /* Group w/o a name */ - - /** @brief A member that gets ignored because the group has no name */ - int member; - - /* Since 1.8.17, the original short-hand group closing doesn't work - anymore. FFS. */ - /** - * @} - */ - /** @{ @name Group full of non-public stuff which should be marked as such */ /** @brief Protected flag in a group */ @@ -140,6 +129,20 @@ class Class { void foobar(); }; +/** @brief A struct producing warnings */ +struct Warning { + /** @{ */ /* Group w/o a name */ + + /** @brief A member that gets ignored because the group has no name */ + int member; + + /* Since 1.8.17, the original short-hand group closing doesn't work + anymore. FFS. */ + /** + * @} + */ +}; + /** @relatedalso Class * @brief An enum */ diff --git a/documentation/test_doxygen/compound_listing/annotated.html b/documentation/test_doxygen/compound_listing/annotated.html index b09eef7f..6927170d 100644 --- a/documentation/test_doxygen/compound_listing/annotated.html +++ b/documentation/test_doxygen/compound_listing/annotated.html @@ -55,6 +55,7 @@
  • class Private This shouldn't appear in the docs.
  • +
  • struct Warning A struct producing warnings.
  • class Class A class.
  • diff --git a/documentation/test_doxygen/compound_listing/structRoot_1_1Directory_1_1Sub_1_1Warning.html b/documentation/test_doxygen/compound_listing/structRoot_1_1Directory_1_1Sub_1_1Warning.html new file mode 100644 index 00000000..846e3da5 --- /dev/null +++ b/documentation/test_doxygen/compound_listing/structRoot_1_1Directory_1_1Sub_1_1Warning.html @@ -0,0 +1,48 @@ + + + + + Root::Directory::Sub::Warning struct | My Project + + + + + +
    +
    + + diff --git a/documentation/test_doxygen/contents_autobrief_heading/namespaceNamespace.html b/documentation/test_doxygen/contents_autobrief_heading/namespaceNamespace.html index b8734d1f..14842f4f 100644 --- a/documentation/test_doxygen/contents_autobrief_heading/namespaceNamespace.html +++ b/documentation/test_doxygen/contents_autobrief_heading/namespaceNamespace.html @@ -22,6 +22,14 @@

    Namespace namespace

    +

    ===============

    + +

    The Thing

    diff --git a/documentation/test_doxygen/contents_autobrief_heading/namespaceNamespace_1814.html b/documentation/test_doxygen/contents_autobrief_heading/namespaceNamespace_1814.html new file mode 100644 index 00000000..b8734d1f --- /dev/null +++ b/documentation/test_doxygen/contents_autobrief_heading/namespaceNamespace_1814.html @@ -0,0 +1,30 @@ + + + + + Namespace namespace | My Project + + + + + +
    +
    +
    +
    +
    +

    + Namespace namespace +

    +
    +
    +
    +
    + + diff --git a/documentation/test_doxygen/contents_autobrief_hr/namespaceNamespace.html b/documentation/test_doxygen/contents_autobrief_hr/namespaceNamespace.html index 75ca144b..a4f37a1c 100644 --- a/documentation/test_doxygen/contents_autobrief_hr/namespaceNamespace.html +++ b/documentation/test_doxygen/contents_autobrief_hr/namespaceNamespace.html @@ -33,12 +33,12 @@ -

    SOME HEAVY LICENSE HEADER WITH SOME HEAVY WORDS


    +

    SOME HEAVY LICENSE HEADER WITH SOME HEAVY WORDS


    Functions

    -
    - void foo() +
    + void foo()
    Some normal brief documentation.
    diff --git a/documentation/test_doxygen/contents_autobrief_hr/namespaceNamespace_1814.html b/documentation/test_doxygen/contents_autobrief_hr/namespaceNamespace_1814.html new file mode 100644 index 00000000..75ca144b --- /dev/null +++ b/documentation/test_doxygen/contents_autobrief_hr/namespaceNamespace_1814.html @@ -0,0 +1,51 @@ + + + + + Namespace namespace | My Project + + + + + +
    +
    +
    +
    +
    +

    + Namespace namespace +

    + +

    SOME HEAVY LICENSE HEADER WITH SOME HEAVY WORDS


    +
    +

    Functions

    +
    +
    + void foo() +
    +
    Some normal brief documentation.
    +
    +
    +
    +
    +
    +
    + + diff --git a/documentation/test_doxygen/contents_sections_headings/Doxyfile b/documentation/test_doxygen/contents_sections_headings/Doxyfile index 6576c771..01f509ea 100644 --- a/documentation/test_doxygen/contents_sections_headings/Doxyfile +++ b/documentation/test_doxygen/contents_sections_headings/Doxyfile @@ -1,4 +1,4 @@ -INPUT = File.h input.dox +INPUT = File.h Warnings.h input.dox QUIET = YES GENERATE_HTML = NO GENERATE_LATEX = NO diff --git a/documentation/test_doxygen/contents_sections_headings/File.h b/documentation/test_doxygen/contents_sections_headings/File.h index 3690b455..96a861dc 100644 --- a/documentation/test_doxygen/contents_sections_headings/File.h +++ b/documentation/test_doxygen/contents_sections_headings/File.h @@ -27,14 +27,3 @@ Mooore. @return Does not return anything. */ void foo(int bar); - -/** -@brief This produces warnings - -#### Markdown heading 4 that's rendered the same as 3 - -Markdown heading, underlined, is misparsed -########################################## - -*/ -void bar(int foo); diff --git a/documentation/test_doxygen/contents_sections_headings/File_8h.html b/documentation/test_doxygen/contents_sections_headings/File_8h.html index 815db321..4975083a 100644 --- a/documentation/test_doxygen/contents_sections_headings/File_8h.html +++ b/documentation/test_doxygen/contents_sections_headings/File_8h.html @@ -41,10 +41,6 @@ void foo(int bar)
    A function.
    -
    - void bar(int foo) -
    -
    This produces warnings.
    @@ -73,13 +69,6 @@

    A top-level header

    A second-level header
    A third-level header

    Usage

    This is usage.

    More

    A subsection.

    More.

    Mooore.

    -
    -

    - void bar(int foo) -

    -

    This produces warnings.

    -
    Markdown heading 4 that's rendered the same as 3

    Markdown heading, underlined, is misparsed

    -
    diff --git a/documentation/test_doxygen/contents_sections_headings/Warnings.h b/documentation/test_doxygen/contents_sections_headings/Warnings.h new file mode 100644 index 00000000..ce4a8a81 --- /dev/null +++ b/documentation/test_doxygen/contents_sections_headings/Warnings.h @@ -0,0 +1,14 @@ +/** @file + * @brief A file producing warnings + */ + +/** +@brief This produces warnings + +#### Markdown heading 4 that's rendered the same as 3 + +Markdown heading, underlined, is misparsed +########################################## + +*/ +void bar(int foo); diff --git a/documentation/test_doxygen/contents_sections_headings/Warnings_8h.html b/documentation/test_doxygen/contents_sections_headings/Warnings_8h.html new file mode 100644 index 00000000..51c0aef4 --- /dev/null +++ b/documentation/test_doxygen/contents_sections_headings/Warnings_8h.html @@ -0,0 +1,61 @@ + + + + + Warnings.h file | My Project + + + + + +
    +
    +
    +
    +
    +

    + Warnings.h file +

    +

    A file producing warnings.

    + +
    +

    Functions

    +
    +
    + void bar(int foo) +
    +
    This produces warnings.
    +
    +
    +
    +

    Function documentation

    +
    +

    + void bar(int foo) +

    +

    This produces warnings.

    +
    Markdown heading 4 that's rendered the same as 3

    Markdown heading, underlined, is misparsed

    +
    +
    +
    +
    +
    +
    + + diff --git a/documentation/test_doxygen/cpp_friends/File.h b/documentation/test_doxygen/cpp_friends/File.h index 848ae8d7..f909d7e9 100644 --- a/documentation/test_doxygen/cpp_friends/File.h +++ b/documentation/test_doxygen/cpp_friends/File.h @@ -26,17 +26,11 @@ class Class { friend struct FriendStruct; friend union FriendUnion; - /** @brief Ignored friend class with a warning because it has docs */ - friend class FriendClassWarning; - /** @brief A friend function */ friend void friendFunction(int a, void* b); /** @{ @name Group with friend functions */ - /** @brief Ignored friend class with a warning because it has docs */ - friend class GroupedFriendClassWarning; - /** @brief A friend grouped function */ friend void friendGroupedFunction(); @@ -47,6 +41,23 @@ class Class { */ }; +/** @brief A class producing warnings */ +struct Warning { + /** @brief Ignored friend class with a warning because it has docs */ + friend class FriendClassWarning; + + /** @{ @name Group with friend functions */ + + /** @brief Ignored friend class with a warning because it has docs */ + friend class GroupedFriendClassWarning; + + /* Since 1.8.17, the original short-hand group closing doesn't work + anymore. FFS. */ + /** + * @} + */ +}; + /** @brief Class with template parameters */ template class Template { protected: /* Shouldn't matter */ diff --git a/documentation/test_doxygen/cpp_friends/structWarning.html b/documentation/test_doxygen/cpp_friends/structWarning.html new file mode 100644 index 00000000..c28c927e --- /dev/null +++ b/documentation/test_doxygen/cpp_friends/structWarning.html @@ -0,0 +1,32 @@ + + + + + Warning struct | My Project + + + + + +
    +
    +
    +
    +
    +

    + Warning struct +
    #include <File.h>
    +

    +

    A class producing warnings.

    +
    +
    +
    +
    + + diff --git a/documentation/test_doxygen/test_compound.py b/documentation/test_doxygen/test_compound.py index a6e2e82f..ab362249 100644 --- a/documentation/test_doxygen/test_compound.py +++ b/documentation/test_doxygen/test_compound.py @@ -63,6 +63,15 @@ class Listing(IntegrationTestCase): self.run_doxygen(wildcard='classRoot_1_1Directory_1_1Sub_1_1Class.xml') self.assertEqual(*self.actual_expected_contents('classRoot_1_1Directory_1_1Sub_1_1Class.html')) + def test_class_no_group_name_warning(self): + with self.assertLogs() as cm: + self.run_doxygen(wildcard='structRoot_1_1Directory_1_1Sub_1_1Warning.xml') + + self.assertEqual(*self.actual_expected_contents('structRoot_1_1Directory_1_1Sub_1_1Warning.html')) + self.assertEqual(cm.output, [ + "ERROR:root:structRoot_1_1Directory_1_1Sub_1_1Warning.xml: member groups without @name are not supported, ignoring" + ]) + def test_page_no_toc(self): self.run_doxygen(wildcard='page-no-toc.xml') self.assertEqual(*self.actual_expected_contents('page-no-toc.html')) @@ -81,8 +90,14 @@ class Detailed(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('structTemplate_3_01void_01_4.html')) def test_class_template_warnings(self): - self.run_doxygen(wildcard='structTemplateWarning.xml') + with self.assertLogs() as cm: + self.run_doxygen(wildcard='structTemplateWarning.xml') + self.assertEqual(*self.actual_expected_contents('structTemplateWarning.html')) + self.assertEqual(cm.output, [ + "WARNING:root:structTemplateWarning.xml: unexpected @param / @return / @retval / @exception found in top-level description, ignoring", + "WARNING:root:structTemplateWarning.xml: template parameter description doesn't match parameter names: {'WTF': 'And this one does not exist'}" + ]) def test_function(self): self.run_doxygen(wildcard='namespaceFoo.xml') @@ -93,8 +108,15 @@ class Detailed(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('namespaceEno.html')) def test_function_enum_warnings(self): - self.run_doxygen(wildcard='namespaceWarning.xml') + with self.assertLogs() as cm: + self.run_doxygen(wildcard='namespaceWarning.xml') + self.assertEqual(*self.actual_expected_contents('namespaceWarning.html')) + self.assertEqual(cm.output, [ + "WARNING:root:namespaceWarning.xml: superfluous @return section found, ignoring: Returns something, but second time. This is ignored.", + "WARNING:root:namespaceWarning.xml: superfluous @return section found, ignoring: Returns something, third time, in a different paragraph. Ignored as well.", + "WARNING:root:namespaceWarning.xml: function parameter description doesn't match parameter names: {'wrong': ('This parameter is not here', '')}" + ]) def test_typedef(self): self.run_doxygen(wildcard='namespaceType.xml') diff --git a/documentation/test_doxygen/test_contents.py b/documentation/test_doxygen/test_contents.py index 277216da..5215edf8 100644 --- a/documentation/test_doxygen/test_contents.py +++ b/documentation/test_doxygen/test_contents.py @@ -89,8 +89,15 @@ class Code(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('index.html')) def test_warnings(self): - self.run_doxygen(wildcard='warnings.xml') + with self.assertLogs() as cm: + self.run_doxygen(wildcard='warnings.xml') + self.assertEqual(*self.actual_expected_contents('warnings.html')) + self.assertEqual(cm.output, [ + "WARNING:root:warnings.xml: no filename attribute in , assuming C++", + "WARNING:root:warnings.xml: inline code has multiple lines, fallback to a code block", + "WARNING:root:warnings.xml: inline code has multiple lines, fallback to a code block" + ]) class CodeLanguage(IntegrationTestCase): @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), @@ -108,8 +115,15 @@ class CodeLanguage(IntegrationTestCase): @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"), "https://github.com/doxygen/doxygen/pull/621") def test_warnings(self): - self.run_doxygen(wildcard='warnings.xml') + with self.assertLogs() as cm: + self.run_doxygen(wildcard='warnings.xml') + self.assertEqual(*self.actual_expected_contents('warnings.html')) + self.assertEqual(cm.output, [ + "WARNING:root:warnings.xml: no filename attribute in , assuming C++", + "WARNING:root:warnings.xml: unrecognized language of .whatthehell in , highlighting disabled", + "WARNING:root:warnings.xml: @include / @snippet / @skip[line] produced an empty code block, probably a wrong match expression?" + ]) class Image(IntegrationTestCase): def test(self): @@ -118,11 +132,16 @@ class Image(IntegrationTestCase): self.assertTrue(os.path.exists(os.path.join(self.path, 'html', 'tiny.png'))) def test_warnings(self): - self.run_doxygen(wildcard='warnings.xml') + with self.assertLogs() as cm: + self.run_doxygen(wildcard='warnings.xml') + self.assertEqual(*self.actual_expected_contents('warnings.html')) + self.assertEqual(cm.output, [ + "WARNING:root:warnings.xml: image nonexistent.png was not found in XML_OUTPUT" + ]) @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.15"), - "fully fixed after 1:8.15") + "fully fixed after 1.8.15") def test_imagelink(self): self.run_doxygen(wildcard='imagelink.xml') self.assertEqual(*self.actual_expected_contents('imagelink.html')) @@ -283,19 +302,58 @@ class AutobriefCppComments(IntegrationTestCase): class AutobriefHr(IntegrationTestCase): @unittest.skipUnless(LooseVersion(doxygen_version()) < LooseVersion("1.8.15"), "1.8.15 doesn't put into anymore") + def test_1814(self): + with self.assertLogs() as cm: + self.run_doxygen(wildcard='namespaceNamespace.xml') + + self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html', 'namespaceNamespace_1814.html')) + # Twice because it's a namespace docs and once it's parsed in + # extract_metadata() and once in parse_xml() + self.assertEqual(cm.output, 2*[ + "WARNING:root:namespaceNamespace.xml: JAVADOC_AUTOBRIEF / QT_AUTOBRIEF produced a brief description with block elements. That's not supported, ignoring the whole contents of
    " + ]) + + @unittest.skipUnless(LooseVersion(doxygen_version()) >= LooseVersion("1.8.15"), + "1.8.15 doesn't put into anymore") def test(self): + # No warnings should be produced here + # TODO use self.assertNoLongs() on 3.10+ self.run_doxygen(wildcard='namespaceNamespace.xml') self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html')) class AutobriefMultiline(IntegrationTestCase): def test(self): - self.run_doxygen(wildcard='namespaceNamespace.xml') + with self.assertLogs() as cm: + self.run_doxygen(wildcard='namespaceNamespace.xml') + self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html')) + # Twice because it's a namespace docs and once it's parsed in + # extract_metadata() and once in parse_xml(). Can't put it into a + # function doc because the @{ then wouldn't work there as it has no + # associated @name. + self.assertEqual(cm.output, 2*[ + "WARNING:root:namespaceNamespace.xml: JAVADOC_AUTOBRIEF / QT_AUTOBRIEF produced a multi-line brief description. That's not supported, using just the first paragraph of

    First line of a brief output

    Second line of a brief output gets ignored with a warning.

    ", + ]) class AutobriefHeading(IntegrationTestCase): @unittest.skipUnless(LooseVersion(doxygen_version()) < LooseVersion("1.8.15"), "1.8.15 doesn't put into anymore") + def test_1814(self): + with self.assertLogs() as cm: + self.run_doxygen(wildcard='namespaceNamespace.xml') + + self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html', 'namespaceNamespace_1814.html')) + # Twice because it's a namespace docs and once it's parsed in + # extract_metadata() and once in parse_xml() + self.assertEqual(cm.output, 2*[ + "WARNING:root:namespaceNamespace.xml: JAVADOC_AUTOBRIEF / QT_AUTOBRIEF produced a brief description with block elements. That's not supported, ignoring the whole contents of

    ===============

    The Thing

    ", + ]) + + @unittest.skipUnless(LooseVersion(doxygen_version()) >= LooseVersion("1.8.15"), + "1.8.15 doesn't put into anymore") def test(self): + # No warnings should be produced here + # TODO use self.assertNoLongs() on 3.10+ self.run_doxygen(wildcard='namespaceNamespace.xml') self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html')) @@ -309,14 +367,23 @@ class SectionsHeadings(IntegrationTestCase): self.run_doxygen(wildcard='indexpage.xml') self.assertEqual(*self.actual_expected_contents('index.html')) - def test_warnings(self): - self.run_doxygen(wildcard='warnings.xml') - self.assertEqual(*self.actual_expected_contents('warnings.html')) - def test_functions(self): self.run_doxygen(wildcard='File_8h.xml') self.assertEqual(*self.actual_expected_contents('File_8h.html')) + def test_warnings(self): + with self.assertLogs() as cm: + self.run_doxygen(wildcard='*arnings*.xml') + + self.assertEqual(*self.actual_expected_contents('warnings.html')) + self.assertEqual(*self.actual_expected_contents('Warnings_8h.html')) + self.assertEqual(cm.output, [ + "WARNING:root:Warnings_8h.xml: more than three levels of sections in member descriptions are not supported, stopping at
    ", + "WARNING:root:Warnings_8h.xml: a Markdown heading underline was apparently misparsed by Doxygen, prefix the headings with # instead", + "WARNING:root:warnings.xml: more than five levels of Markdown headings for top-level docs are not supported, stopping at
    ", + "WARNING:root:warnings.xml: a Markdown heading underline was apparently misparsed by Doxygen, prefix the headings with # instead", + ]) + class AnchorInBothGroupAndNamespace(IntegrationTestCase): def test(self): self.run_doxygen(wildcard='*.xml') @@ -330,8 +397,19 @@ class AnchorHtmlNoPrefixBug(IntegrationTestCase): class UnexpectedSections(IntegrationTestCase): def test(self): - self.run_doxygen(wildcard='File_8h.xml') + with self.assertLogs() as cm: + self.run_doxygen(wildcard='File_8h.xml') + self.assertEqual(*self.actual_expected_contents('File_8h.html')) + self.assertEqual(cm.output, [ + "WARNING:root:File_8h.xml: unexpected @tparam / @param / @return / @retval / @exception found inside a @section, ignoring", + "WARNING:root:File_8h.xml: unexpected @param / @return / @retval / @exception found in top-level description, ignoring", + "WARNING:root:File_8h.xml: unexpected @tparam / @retval / @exception found in macro description, ignoring", + "WARNING:root:File_8h.xml: unexpected @tparam / @param / @return / @retval / @exception found in enum description, ignoring", + "WARNING:root:File_8h.xml: unexpected @tparam / @param / @return / @retval / @exception found in enum value description, ignoring", + "WARNING:root:File_8h.xml: unexpected @param / @return / @retval / @exception found in typedef description, ignoring", + "WARNING:root:File_8h.xml: unexpected @param / @return / @retval / @exception found in variable description, ignoring", + ]) class Dot(IntegrationTestCase): def test(self): diff --git a/documentation/test_doxygen/test_cpp.py b/documentation/test_doxygen/test_cpp.py index 7886627c..fed05c75 100644 --- a/documentation/test_doxygen/test_cpp.py +++ b/documentation/test_doxygen/test_cpp.py @@ -65,6 +65,15 @@ class Friends(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('classClass.html')) self.assertEqual(*self.actual_expected_contents('classTemplate.html')) + def test_warnings(self): + with self.assertLogs() as cm: + self.run_doxygen(wildcard='structWarning.xml') + self.assertEqual(*self.actual_expected_contents('structWarning.html')) + self.assertEqual(cm.output, [ + "WARNING:root:structWarning.xml: doxygen is unable to cross-link friend class GroupedFriendClassWarning, ignoring, sorry", + "WARNING:root:structWarning.xml: doxygen is unable to cross-link friend class FriendClassWarning, ignoring, sorry" + ]) + class SignalsSlots(IntegrationTestCase): def test(self): self.run_doxygen(wildcard='classClass.xml') diff --git a/documentation/test_doxygen/test_doxyfile.py b/documentation/test_doxygen/test_doxyfile.py index e944e893..070f4f87 100644 --- a/documentation/test_doxygen/test_doxyfile.py +++ b/documentation/test_doxygen/test_doxyfile.py @@ -132,8 +132,12 @@ copy a link to the result using ⌘ def test_subdirs(self): state = State(copy.deepcopy(default_config)) - with self.assertRaises(NotImplementedError): - parse_doxyfile(state, 'test_doxygen/doxyfile/Doxyfile-subdirs') + with self.assertLogs() as cm: + with self.assertRaises(NotImplementedError): + parse_doxyfile(state, 'test_doxygen/doxyfile/Doxyfile-subdirs') + self.assertEqual(cm.output, [ + "CRITICAL:root:test_doxygen/doxyfile/Doxyfile-subdirs: CREATE_SUBDIRS is not supported, sorry. Disable it and try again." + ]) class UpgradeCustomVariables(BaseTestCase): def test(self):