aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testaddfunction.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-04-25 15:01:35 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:16 -0300
commitfd5c0f2a8a114ce11390fee445976d7cc0d213f3 (patch)
tree7066002de7a3c849f4ff446125960a3e5f10667b /tests/testaddfunction.cpp
parent427992fc248b60dc38e21a4a2e2a48f64c1cbe2c (diff)
Add support to template types as arguments on user added functions.sb-0.10.2
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'tests/testaddfunction.cpp')
-rw-r--r--tests/testaddfunction.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/testaddfunction.cpp b/tests/testaddfunction.cpp
index 4e03c962d..2d4ee91fd 100644
--- a/tests/testaddfunction.cpp
+++ b/tests/testaddfunction.cpp
@@ -407,6 +407,23 @@ void TestAddFunction::testAddFunctionOnTypedef()
QVERIFY(method);
}
+void TestAddFunction::testAddFunctionWithTemplateArg()
+{
+ const char cppCode[] = "template<class T> class Foo { };";
+ const char xmlCode[] = "\
+ <typesystem package='Package'>\
+ <primitive-type name='int'/>\
+ <container-type name='Foo' type='list'/>\
+ <add-function signature='func(Foo&lt;int>)' />\
+ </typesystem>";
+
+ TestUtil t(cppCode, xmlCode);
+ QCOMPARE(t.builder()->globalFunctions().size(), 1);
+ AbstractMetaFunction* func = t.builder()->globalFunctions().first();
+ AbstractMetaArgument* arg = func->arguments().first();
+ QCOMPARE(arg->type()->instantiations().count(), 1);
+}
+
QTEST_APPLESS_MAIN(TestAddFunction)
#include "testaddfunction.moc"