[gtk-doc] scan: add more generic tests



commit f77b0abb723715186a04436d54d5927f05cd09f4
Author: Stefan Sauer <ensonic users sf net>
Date:   Wed Dec 12 20:31:00 2018 +0100

    scan: add more generic tests
    
    Fix return value for the branch that detects internal headers.

 gtkdoc/scan.py |  2 +-
 tests/scan.py  | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py
index 2022102..afbd9f4 100644
--- a/gtkdoc/scan.py
+++ b/gtkdoc/scan.py
@@ -511,7 +511,7 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options):
         # TODO: consider scanning this first, so that we don't modify: decl_list
         # and get_types
         if re.search(r'^\s*/\*\s*<\s*private_header\s*>\s*\*/', line):
-            return
+            return [], {}
 
         # Skip to the end of the current comment.
         if in_comment:
diff --git a/tests/scan.py b/tests/scan.py
index ddc0a68..6a2fbc5 100644
--- a/tests/scan.py
+++ b/tests/scan.py
@@ -90,6 +90,14 @@ class ScanHeaderContent(ScanHeaderContentTestCase):
         slist, doc_comments = self.scanHeaderContent([])
         self.assertNothingFound(slist, doc_comments)
 
+    def test_IgnoresOneLineComments(self):
+        slist, doc_comments = self.scanHeaderContent(['/* test */'])
+        self.assertNothingFound(slist, doc_comments)
+
+    def test_IgnoresOneLineCommentsDoubleStar(self):
+        slist, doc_comments = self.scanHeaderContent(['/** test */'])
+        self.assertNothingFound(slist, doc_comments)
+
     def test_FindsDocComment(self):
         slist, doc_comments = self.scanHeaderContent("""\
             /**
@@ -105,7 +113,16 @@ class ScanHeaderContent(ScanHeaderContentTestCase):
              */""".splitlines(keepends=True))
         self.assertNoDeclFound(slist)
 
-    # TODO: test /* < private_header > */ maker
+    def test_SkipInternalHeaders(self):
+        header = textwrap.dedent("""\
+            /* < private_header > */
+            /**
+             * symbol:
+             */
+            void symbols(void);""")
+        slist, doc_comments = self.scanHeaderContent(
+            header.splitlines(keepends=True))
+        self.assertNothingFound(slist, doc_comments)
 
     def test_SkipSymbolWithPreprocessor(self):
         slist, doc_comments = self.scanHeaderContent("""\


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]