From 310cd9c13635c5001bc9f63bdcb79ea93cbfccd5 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 29 Jun 2010 10:36:00 -0300 Subject: Added test for template inheritance involving forward declaration and namespace. This test case is similar to a previous test with forward declaration except that this time everything is inside a namespace. This slightly different situation could trigger problems in a different place on AbstractMetaBuilder. --- tests/testtemplates.cpp | 35 +++++++++++++++++++++++++++++++++++ tests/testtemplates.h | 1 + 2 files changed, 36 insertions(+) diff --git a/tests/testtemplates.cpp b/tests/testtemplates.cpp index 97738fda7..2eb66acb2 100644 --- a/tests/testtemplates.cpp +++ b/tests/testtemplates.cpp @@ -142,6 +142,41 @@ void TestTemplates::testTemplateInheritanceMixedWithForwardDeclaration() QCOMPARE(classB->functions().count(), 3); } +void TestTemplates::testTemplateInheritanceMixedWithNamespaceAndForwardDeclaration() +{ + const char cppCode[] = "\ + namespace Namespace {\ + enum SomeEnum { E1, E2 };\ + template struct Future;\ + template\ + struct A {\ + A();\ + void method();\ + friend struct Future;\ + };\ + typedef A B;\ + template struct Future {};\ + };\ + "; + const char xmlCode[] = "\ + \ + \ + \ + \ + \ + \ + "; + + TestUtil t(cppCode, xmlCode, false); + AbstractMetaClassList classes = t.builder()->classes(); + + AbstractMetaClass* classB = classes.findClass("Namespace::B"); + QVERIFY(!classB->baseClass()); + QVERIFY(classB->baseClassName().isNull()); + // 3 functions: simple constructor, copy constructor and "method()". + QCOMPARE(classB->functions().count(), 3); +} + QTEST_APPLESS_MAIN(TestTemplates) #include "testtemplates.moc" diff --git a/tests/testtemplates.h b/tests/testtemplates.h index 430a7599c..a7a61c795 100644 --- a/tests/testtemplates.h +++ b/tests/testtemplates.h @@ -33,6 +33,7 @@ private slots: void testTemplateOnContainers(); void testTemplateWithNamespace(); void testTemplateInheritanceMixedWithForwardDeclaration(); + void testTemplateInheritanceMixedWithNamespaceAndForwardDeclaration(); }; #endif -- cgit v1.2.3