summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-06 19:12:50 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-24 15:37:20 (GMT)
commitedeba50dd3c12bae48a2b7b5d059184df54b8a62 (patch)
treec72d49cdba4e207bc74a617b47ebec0ec8a26c18
parent110dacffd23854ca3d668a5ecebf41ad0a207834 (diff)
downloadCastXML-edeba50dd3c12bae48a2b7b5d059184df54b8a62.zip
CastXML-edeba50dd3c12bae48a2b7b5d059184df54b8a62.tar.gz
CastXML-edeba50dd3c12bae48a2b7b5d059184df54b8a62.tar.bz2
test: Add cases for class member template instantiation
Cover member templates of both classes and class templates.
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/expect/gccxml.Class-member-template-xml.txt21
-rw-r--r--test/expect/gccxml.Class-template-member-template-xml.txt22
-rw-r--r--test/input/Class-member-template.cxx4
-rw-r--r--test/input/Class-template-member-template.cxx4
5 files changed, 53 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ef8ec5b..6d04fcf 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -72,7 +72,9 @@ castxml_test_gccxml(Class-abstract)
castxml_test_gccxml(Class-bases)
castxml_test_gccxml(Class-friends)
castxml_test_gccxml(Class-incomplete)
+castxml_test_gccxml(Class-member-template)
castxml_test_gccxml(Class-template)
+castxml_test_gccxml(Class-template-member-template)
castxml_test_gccxml(CvQualifiedType)
castxml_test_gccxml(Enumeration)
castxml_test_gccxml(Field)
diff --git a/test/expect/gccxml.Class-member-template-xml.txt b/test/expect/gccxml.Class-member-template-xml.txt
new file mode 100644
index 0000000..487aebb
--- /dev/null
+++ b/test/expect/gccxml.Class-member-template-xml.txt
@@ -0,0 +1,21 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7"/>
+ <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1">
+ <Argument name="v" type="_8" location="f1:2" file="f1" line="2"/>
+ </Method>
+ <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
+ <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
+ <Argument type="_9" location="f1:1" file="f1" line="1"/>
+ </Constructor>
+ <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
+ <Argument type="_9" location="f1:1" file="f1" line="1"/>
+ </OperatorMethod>
+ <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
+ <FundamentalType id="_8" name="int"/>
+ <ReferenceType id="_9" type="_1c"/>
+ <ReferenceType id="_10" type="_1"/>
+ <Namespace id="_2" name="::"/>
+ <CvQualifiedType id="_1c" type="_1" const="1"/>
+ <File id="f1" name=".*/test/input/Class-member-template.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.Class-template-member-template-xml.txt b/test/expect/gccxml.Class-template-member-template-xml.txt
new file mode 100644
index 0000000..42c7790
--- /dev/null
+++ b/test/expect/gccxml.Class-template-member-template-xml.txt
@@ -0,0 +1,22 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Class id="_1" name="start&lt;int&gt;" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7"/>
+ <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1">
+ <Argument type="_9" location="f1:2" file="f1" line="2"/>
+ </Method>
+ <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
+ <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
+ <Argument type="_10" location="f1:1" file="f1" line="1"/>
+ </Constructor>
+ <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
+ <Argument type="_10" location="f1:1" file="f1" line="1"/>
+ </OperatorMethod>
+ <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
+ <FundamentalType id="_8" name="int"/>
+ <FundamentalType id="_9" name="char"/>
+ <ReferenceType id="_10" type="_1c"/>
+ <ReferenceType id="_11" type="_1"/>
+ <Namespace id="_2" name="::"/>
+ <CvQualifiedType id="_1c" type="_1" const="1"/>
+ <File id="f1" name=".*/test/input/Class-template-member-template.cxx"/>
+</GCC_XML>$
diff --git a/test/input/Class-member-template.cxx b/test/input/Class-member-template.cxx
new file mode 100644
index 0000000..8ffb3d6
--- /dev/null
+++ b/test/input/Class-member-template.cxx
@@ -0,0 +1,4 @@
+class start {
+ template <typename T> T method(T v) { return v; }
+};
+template int start::method<int>(int); // instantiation
diff --git a/test/input/Class-template-member-template.cxx b/test/input/Class-template-member-template.cxx
new file mode 100644
index 0000000..9dc6a54
--- /dev/null
+++ b/test/input/Class-template-member-template.cxx
@@ -0,0 +1,4 @@
+template <typename T> class start {
+ template <typename U> T method(U) { return T(); }
+};
+template int start<int>::method<char>(char); // instantiation