[gtk-doc] scan: move more enum/struct tests to unit tests



commit ac95e1d447247e0d8d761fbafd1d04dec76028b6
Author: Stefan Sauer <ensonic users sf net>
Date:   Tue Nov 27 21:36:01 2018 +0100

    scan: move more enum/struct tests to unit tests
    
    Also remove some cases that are alreaady covered.

 tests/bugs/docs/tester-sections.txt |  3 ---
 tests/bugs/src/tester.h             | 47 -------------------------------------
 tests/scan.py                       | 20 ++++++++++++++++
 3 files changed, 20 insertions(+), 50 deletions(-)
---
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index 52956c3..59b4762 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -7,10 +7,8 @@ MACRO_VALUE
 <SUBSECTION Compounds>
 Bug165425a
 Bug165425b
-Bug324535
 Bug446648
 Bug512154
-Bug642998
 Bug644291
 Bug000000Scope
 bug_411739_rettype
@@ -77,7 +75,6 @@ G_GNUC_DEPRECATED_FOR
 GLIB_DEPRECATED
 BUG_711598_DEPRECATED_FOR
 bug_554833_new
-Bug730658
 G_GNUC_NONNULL
 </SECTION>
 
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index 28abcd8..05e1cf2 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -3,23 +3,6 @@
 
 #include <glib.h>
 
-/**
- * Bug324535:
- * @BUG_324535_A: enum 1
- * @BUG_324535_B: enum 2
- * @BUG_324535_C: enum 3
- *
- * http://bugzilla.gnome.org/show_bug.cgi?id=324535
- */
-typedef enum {
-  BUG_324535_A,
-#ifdef GTK_DISABLE_DEPRECATED
-  BUG_324535_B,
-#endif
-  BUG_324535_C
-} Bug324535;
-
-
 
 /**
  * bug_481811:
@@ -341,21 +324,6 @@ void (*bug_638330) (void *arg1,
      unsigned int length);
 
 
-/**
- * Bug642998:
- * @red: red color intensity, from 0–255
- * @green: green color intensity, from 0–255
- * @blue: blue color intensity, from 0–255
- *
- * https://bugzilla.gnome.org/show_bug.cgi?id=642998
- */
-typedef struct {
-    guint16 red;
-    guint16 green;
-    guint16 blue;
-} Bug642998;
-
-
 /**
  * Bug644291:
  * @BUG_644291_START: foo
@@ -475,21 +443,6 @@ void bug_749142 (void);
 
 void bug_783420 (int in, int *out);
 
-/**
- * Bug730658:
- * @BUG_730658_CAN_READ: Can read
- * @BUG_730658_CAN_WRITE: Can write
- * @BUG_730658_IS_DEPRECATED: Is deprecated
- *
- * https://bugzilla.gnome.org/show_bug.cgi?id=730658
- */
-typedef enum
-{
-  BUG_730658_CAN_READ = 1 << 0,
-  BUG_730658_CAN_WRITE = 1 << 1,
-  BUG_730658_IS_DEPRECATED = 1 << 2
-} Bug730658;
-
 /**
  * MACRO_VALUE:
  *
diff --git a/tests/scan.py b/tests/scan.py
index c03e0da..b1470e3 100644
--- a/tests/scan.py
+++ b/tests/scan.py
@@ -120,6 +120,16 @@ class ScanHeaderContentEnum(ScanHeaderContentTestCase):
             header.splitlines(keepends=True))
         self.assertDecl('data', header)
 
+    def test_HandleDeprecatedInMemberName(self):
+        header = textwrap.dedent("""\
+            typedef enum {
+              VAL_DEFAULT,
+              VAL_DEPRECATED,
+            } Data;""")
+        slist, doc_comments = self.scanHeaderContent(
+            header.splitlines(keepends=True))
+        self.assertDecl('Data', header)
+
 
 # FUNCTION
 
@@ -146,6 +156,13 @@ class ScanHeaderContentMacros(ScanHeaderContentTestCase):
         self.assertEqual(['FOO'], slist)
         self.assertDecl('FOO', '#define FOO (1 << 1)')
 
+    def test_FindsMacroFunction(self):
+        slist, doc_comments = self.scanHeaderContent([
+            '#define FOO(x) (x << 1)'
+        ])
+        self.assertEqual(['FOO'], slist)
+        self.assertDecl('FOO', '#define FOO(x) (x << 1)')
+
     # TODO: test for a few variants
     def test_IgnoresInternalMacro(self):
         slist, doc_comments = self.scanHeaderContent([
@@ -239,6 +256,9 @@ class ScanHeaderContentUnions(ScanHeaderContentTestCase):
         self.assertDecl('Data', header)
 
 
+# USER FUNCTION (aka function pointer types)
+
+
 class ScanHeaderContentVariabless(ScanHeaderContentTestCase):
     """Test parsing of variable declarations."""
 


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