summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-04 19:26:54 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-21 21:11:36 (GMT)
commit4036d255ab698632bb5414b1417e9107b2f62df7 (patch)
tree2ffa6278d6d39c43afdd0dd31cf250d4f80c8fe1 /test
parentc722f17c03226b1101cdd732e169360b5f9a81a0 (diff)
downloadCastXML-4036d255ab698632bb5414b1417e9107b2f62df7.zip
CastXML-4036d255ab698632bb5414b1417e9107b2f62df7.tar.gz
CastXML-4036d255ab698632bb5414b1417e9107b2f62df7.tar.bz2
Output: Generate Enumeration elements
Implement the OutputEnumDecl method to generate the Enumeration element. Report the name="", context="", and location="" of the declaration. Inside the Enumeration element generate EnumValue elements describing the enumeration names and initializers. Also map enum types to the corresponding declarations.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/expect/gccxml.Enumeration-xml.txt9
-rw-r--r--test/expect/gccxml.Typedef-to-Enumeration-xml.txt7
-rw-r--r--test/input/Enumeration.cxx4
-rw-r--r--test/input/Typedef-to-Enumeration.cxx2
5 files changed, 24 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1102aff..49ce30f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -71,6 +71,7 @@ castxml_test_gccxml(Class)
castxml_test_gccxml(Class-incomplete)
castxml_test_gccxml(Class-template)
castxml_test_gccxml(CvQualifiedType)
+castxml_test_gccxml(Enumeration)
castxml_test_gccxml(Field)
castxml_test_gccxml(Function)
castxml_test_gccxml(Function-template)
@@ -91,6 +92,7 @@ castxml_test_gccxml(PointerType)
castxml_test_gccxml(ReferenceType)
castxml_test_gccxml(Typedef-paren)
castxml_test_gccxml(Typedef-to-Class-template)
+castxml_test_gccxml(Typedef-to-Enumeration)
castxml_test_gccxml(Variable)
castxml_test_gccxml(Variable-in-Class)
castxml_test_gccxml(Variable-init)
diff --git a/test/expect/gccxml.Enumeration-xml.txt b/test/expect/gccxml.Enumeration-xml.txt
new file mode 100644
index 0000000..b620c86
--- /dev/null
+++ b/test/expect/gccxml.Enumeration-xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Enumeration id="_1" name="start" context="_2" location="f1:1" file="f1" line="1">
+ <EnumValue name="ev0" init="0"/>
+ <EnumValue name="ev2" init="2"/>
+ </Enumeration>
+ <Namespace id="_2" name="::"/>
+ <File id="f1" name=".*/test/input/Enumeration.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.Typedef-to-Enumeration-xml.txt b/test/expect/gccxml.Typedef-to-Enumeration-xml.txt
new file mode 100644
index 0000000..1e8ec8f
--- /dev/null
+++ b/test/expect/gccxml.Typedef-to-Enumeration-xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+ <Enumeration id="_2" name="E" context="_3" location="f1:1" file="f1" line="1"/>
+ <Namespace id="_3" name="::"/>
+ <File id="f1" name=".*/test/input/Typedef-to-Enumeration.cxx"/>
+</GCC_XML>$
diff --git a/test/input/Enumeration.cxx b/test/input/Enumeration.cxx
new file mode 100644
index 0000000..1cdd25c
--- /dev/null
+++ b/test/input/Enumeration.cxx
@@ -0,0 +1,4 @@
+enum start {
+ ev0,
+ ev2 = 2
+};
diff --git a/test/input/Typedef-to-Enumeration.cxx b/test/input/Typedef-to-Enumeration.cxx
new file mode 100644
index 0000000..9a1db81
--- /dev/null
+++ b/test/input/Typedef-to-Enumeration.cxx
@@ -0,0 +1,2 @@
+enum E {};
+typedef E start;