From 99862b71c95e1e061ac743fb864a041fa0a1fbf8 Mon Sep 17 00:00:00 2001 From: renatofilho Date: Fri, 8 Oct 2010 15:51:48 -0300 Subject: Implemented support to added functions for TypeAlias. Reviewer: Luciano Wolf Lauro Moura --- tests/testaddfunction.cpp | 27 +++++++++++++++++++++++++++ tests/testaddfunction.h | 1 + 2 files changed, 28 insertions(+) (limited to 'tests') 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 Foo { }; typedef Foo FooInt;"; + const char xmlCode[] = "\ + \ + \ + \ + \ + custom_code();\ + \ + \ + custom_code();\ + \ + \ + "; + 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 -- cgit v1.2.3