[gtk-doc] scan: add tests for enum
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] scan: add tests for enum
- Date: Mon, 26 Nov 2018 20:01:07 +0000 (UTC)
commit 986ecc8d51d4ff1c422f38e71a08b39eb74d267e
Author: Stefan Sauer <ensonic users sf net>
Date: Mon Nov 26 19:28:38 2018 +0100
scan: add tests for enum
tests/scan.py | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/tests/scan.py b/tests/scan.py
index 2b0f6c1..d2f133a 100644
--- a/tests/scan.py
+++ b/tests/scan.py
@@ -81,7 +81,44 @@ class ScanHeaderContent(ScanHeaderContentTestCase):
self.assertNoDeclFound(slist)
-# ENUM
+class ScanHeaderContentEnum(ScanHeaderContentTestCase):
+ """Test parsing of enum declarations."""
+
+ def assertDecl(self, name, decl):
+ d = '<ENUM>\n<NAME>%s</NAME>\n%s</ENUM>\n' % (name, decl)
+ self.assertEqual([d], self.decls)
+ self.assertEqual([], self.types)
+
+ def test_FindsEnum(self):
+ header = textwrap.dedent("""\
+ enum data {
+ TEST,
+ };""")
+ slist, doc_comments = self.scanHeaderContent(
+ header.splitlines(keepends=True))
+ self.assertDecl('data', header)
+
+ def test_FindsTypedefEnum(self):
+ header = textwrap.dedent("""\
+ typedef enum {
+ ENUM
+ } Data;""")
+ slist, doc_comments = self.scanHeaderContent(
+ header.splitlines(keepends=True))
+ self.assertDecl('Data', header)
+
+ def test_HandleEnumWithDeprecatedMember(self):
+ header = textwrap.dedent("""\
+ enum data {
+ TEST_A,
+ #ifndef GTKDOC_TESTER_DISABLE_DEPRECATED
+ TEST_B,
+ #endif
+ TEST_C
+ };""")
+ slist, doc_comments = self.scanHeaderContent(
+ header.splitlines(keepends=True))
+ self.assertDecl('data', header)
# FUNCTION
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]