diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testctorinformation.cpp | 27 | ||||
-rw-r--r-- | tests/testctorinformation.h | 1 |
2 files changed, 25 insertions, 3 deletions
diff --git a/tests/testctorinformation.cpp b/tests/testctorinformation.cpp index 8583d9a54..09d57eb84 100644 --- a/tests/testctorinformation.cpp +++ b/tests/testctorinformation.cpp @@ -28,9 +28,9 @@ void TestCtorInformation::testCtorIsPrivate() { - const char* cppCode ="class Control { public: Control() {} };\ - class Subject { private: Subject() {} };\ - class CtorLess { };"; + const char* cppCode = "class Control { public: Control() {} };\ + class Subject { private: Subject() {} };\ + class CtorLess { };"; const char* xmlCode = "<typesystem package='Foo'>\ <value-type name='Control'/>\ <object-type name='Subject'/>\ @@ -44,6 +44,27 @@ void TestCtorInformation::testCtorIsPrivate() QCOMPARE(classes.findClass("CtorLess")->hasNonPrivateConstructor(), true); } +void TestCtorInformation::testHasNonPrivateCtor() +{ + const char* cppCode = "template<typename T>\ + struct Base { Base(double) {} };\ + typedef Base<int> Derived;\ + "; + const char* xmlCode = "<typesystem package='Foo'>\ + <primitive-type name='int' />\ + <primitive-type name='double' />\ + <object-type name='Base' generate='no'/>\ + <object-type name='Derived'/>\ + </typesystem>"; + TestUtil t(cppCode, xmlCode); + AbstractMetaClassList classes = t.builder()->classes(); + QCOMPARE(classes.count(), 2); + AbstractMetaClass* base = classes.findClass("Base"); + QCOMPARE(base->hasNonPrivateConstructor(), true); + AbstractMetaClass* derived = classes.findClass("Derived"); + QCOMPARE(derived->hasNonPrivateConstructor(), true); +} + QTEST_APPLESS_MAIN(TestCtorInformation) #include "testctorinformation.moc" diff --git a/tests/testctorinformation.h b/tests/testctorinformation.h index 174bbea59..12d2529af 100644 --- a/tests/testctorinformation.h +++ b/tests/testctorinformation.h @@ -33,6 +33,7 @@ class TestCtorInformation: public QObject Q_OBJECT private slots: void testCtorIsPrivate(); + void testHasNonPrivateCtor(); }; #endif // TESTCTORINFORMATION_H |