From e308e2a055c5e615a9f7d4d21fc770ae3118079a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 18 Jan 2018 21:20:00 +0100 Subject: [PATCH] doxygen: dedicated test for ignoring empty documentation files. --- doxygen/dox2html5.py | 2 ++ doxygen/test/compound_ignored/Doxyfile | 11 ++++++++++ doxygen/test/compound_ignored/File.cpp | 4 ++++ doxygen/test/compound_ignored/File.h | 16 ++++++++++++++ doxygen/test/test_compound.py | 29 +++++++++++++++++--------- 5 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 doxygen/test/compound_ignored/Doxyfile create mode 100644 doxygen/test/compound_ignored/File.cpp create mode 100644 doxygen/test/compound_ignored/File.h diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index e8f5c29e..5dbf709a 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -720,6 +720,8 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. elif i.tag == 'formula': assert element.tag == 'para' # is inside a paragraph :/ + logging.debug("{}: rendering math: {}".format(state.current, i.text)) + # We should have decided about block/inline above assert formula_block is not None if formula_block: diff --git a/doxygen/test/compound_ignored/Doxyfile b/doxygen/test/compound_ignored/Doxyfile new file mode 100644 index 00000000..6165277c --- /dev/null +++ b/doxygen/test/compound_ignored/Doxyfile @@ -0,0 +1,11 @@ +INPUT = File.h File.cpp +QUIET = YES +GENERATE_HTML = NO +GENERATE_LATEX = NO +GENERATE_XML = YES + +M_PAGE_FINE_PRINT = +M_THEME_COLOR = +M_LINKS_NAVBAR1 = +M_LINKS_NAVBAR2 = + diff --git a/doxygen/test/compound_ignored/File.cpp b/doxygen/test/compound_ignored/File.cpp new file mode 100644 index 00000000..1f4d58e6 --- /dev/null +++ b/doxygen/test/compound_ignored/File.cpp @@ -0,0 +1,4 @@ +/** Undocumented file */ + +/** @brief A var that doesn't appear in the docs because it's in undoc file */ +int a; diff --git a/doxygen/test/compound_ignored/File.h b/doxygen/test/compound_ignored/File.h new file mode 100644 index 00000000..8da57c51 --- /dev/null +++ b/doxygen/test/compound_ignored/File.h @@ -0,0 +1,16 @@ +namespace { + +/** @brief Struct in an anonymous namespace */ +struct PrivateStruct { int a; /**< A var */ }; + +} + +/** @brief A class */ +class A { + private: + /** @brief Private class */ + class PrivateClass { int a; /**< A var */ }; +}; + +/** @brief A class with just brief docs */ +class Brief {}; diff --git a/doxygen/test/test_compound.py b/doxygen/test/test_compound.py index 9102b0b1..8eb08d7b 100644 --- a/doxygen/test/test_compound.py +++ b/doxygen/test/test_compound.py @@ -51,11 +51,6 @@ class Listing(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('File_8h.html')) self.assertEqual(*self.actual_expected_contents('Class_8h.html')) - @unittest.expectedFailure - def test_empty_file_doc_not_generated(self): - self.run_dox2html5(wildcard='Root_8h.xml') - self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'Root_8h.html'))) - def test_namespace(self): self.run_dox2html5(wildcard='namespaceRoot_1_1Directory.xml') self.assertEqual(*self.actual_expected_contents('namespaceRoot_1_1Directory.html')) @@ -68,11 +63,6 @@ class Listing(IntegrationTestCase): self.run_dox2html5(wildcard='classRoot_1_1Directory_1_1Sub_1_1Class.xml') self.assertEqual(*self.actual_expected_contents('classRoot_1_1Directory_1_1Sub_1_1Class.html')) - @unittest.expectedFailure - def test_empty_class_doc_not_generated(self): - self.run_dox2html5(wildcard='union*Bar*.xml') - self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'unionRoot_1_1Directory_1_1Sub_1_1Class_1_1Bar.html'))) - def test_page_no_toc(self): self.run_dox2html5(wildcard='page-no-toc.xml') self.assertEqual(*self.actual_expected_contents('page-no-toc.html')) @@ -120,3 +110,22 @@ class Detailed(IntegrationTestCase): def test_define(self): self.run_dox2html5(wildcard='File_8h.xml') self.assertEqual(*self.actual_expected_contents('File_8h.html')) + +class Ignored(IntegrationTestCase): + def __init__(self, *args, **kwargs): + super().__init__(__file__, 'ignored', *args, **kwargs) + + def test(self): + self.run_dox2html5(index_pages=[], wildcard='*.xml') + + self.assertTrue(os.path.exists(os.path.join(self.path, 'html', 'classA.html'))) + + self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'classA_1_1PrivateClass.html'))) + self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'File_8cpp.html'))) + self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'input_8h.html'))) + self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'namespace_0D0.html'))) + + @unittest.expectedFailure + def test_empty_class_doc_not_generated(self): + self.run_dox2html5(index_pages=[], wildcard='classBrief.xml') + self.assertFalse(os.path.exists(os.path.join(self.path, 'html', 'classBrief.html'))) -- 2.30.2