aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-08 15:51:48 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:11 -0300
commit99862b71c95e1e061ac743fb864a041fa0a1fbf8 (patch)
treebfabc643047c934084caa8a5ba9ab0f1d0812977 /tests
parent6ab94ebbe402a92a7587e5b947f821712b6ee605 (diff)
Implemented support to added functions for TypeAlias.sb-0.8.1
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/testaddfunction.cpp27
-rw-r--r--tests/testaddfunction.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/testaddfunction.cpp b/tests/testaddfunction.cpp
index 0346a6367..4e03c962d 100644
--- a/tests/testaddfunction.cpp
+++ b/tests/testaddfunction.cpp
@@ -380,6 +380,33 @@ void TestAddFunction::testModifyAddedFunction()
QCOMPARE(method->argumentName(2), QString("varName"));
}
+void TestAddFunction::testAddFunctionOnTypedef()
+{
+ const char cppCode[] = "template<class T> class Foo { }; typedef Foo<int> FooInt;";
+ const char xmlCode[] = "\
+ <typesystem package='Package'>\
+ <primitive-type name='int'/>\
+ <value-type name='FooInt'>\
+ <add-function signature='FooInt(PySequence*)'>\
+ <inject-code class='target' position='beginning'>custom_code();</inject-code>\
+ </add-function>\
+ <add-function signature='method()'>\
+ <inject-code class='target' position='beginning'>custom_code();</inject-code>\
+ </add-function>\
+ </value-type>\
+ </typesystem>";
+ TestUtil t(cppCode, xmlCode);
+ AbstractMetaClassList classes = t.builder()->classes();
+ AbstractMetaClass* foo = classes.findClass("FooInt");
+ QVERIFY(foo->hasNonPrivateConstructor());
+ AbstractMetaFunctionList lst = foo->queryFunctions(AbstractMetaClass::Constructors);
+ foreach(AbstractMetaFunction* f, lst)
+ QVERIFY(f->signature().startsWith(f->name()));
+ QCOMPARE(lst.size(), 2);
+ const AbstractMetaFunction* method = foo->findFunction("method");
+ QVERIFY(method);
+}
+
QTEST_APPLESS_MAIN(TestAddFunction)
#include "testaddfunction.moc"
diff --git a/tests/testaddfunction.h b/tests/testaddfunction.h
index 09d806222..8fa440402 100644
--- a/tests/testaddfunction.h
+++ b/tests/testaddfunction.h
@@ -42,6 +42,7 @@ private slots:
void testAddGlobalFunction();
void testAddFunctionWithApiVersion();
void testModifyAddedFunction();
+ void testAddFunctionOnTypedef();
};
#endif