[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevelop/languages/cpp/tests
From:       David Nolden <david.nolden.kde () art-master ! de>
Date:       2007-11-18 1:34:58
Message-ID: 1195349698.821438.22328.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 738139 by zwabel:

Update the new test for across-header template references. Thanks to the trace stuff \
and debugging in the template code, this test succeeds now.



 M  +14 -4     test_cppcodecompletion.cpp  


--- trunk/KDE/kdevelop/languages/cpp/tests/test_cppcodecompletion.cpp #738138:738139
@@ -19,6 +19,7 @@
 #include "test_cppcodecompletion.h"
 
 #include <QtTest/QtTest>
+#include <typeinfo>
 
 #include <duchain.h>
 #include <duchainlock.h>
@@ -495,7 +496,7 @@
 
 void TestCppCodeCompletion::testAcrossHeaderTemplateReferences()
 {
-  addInclude( "acrossheader1.h", "class Dummy { }; template<class B> class Test{ };" \
); +  addInclude( "acrossheader1.h", "class Dummy { }; template<class Q> class Test{ \
};" );  addInclude( "acrossheader2.h", "template<class B, class B2 = Test<B> > class \
Test2 : public Test<B>{ Test<B> bm; };" );  QByteArray method("#include \
\"acrossheader1.h\"\n#include \"acrossheader2.h\"\n ");  
@@ -505,18 +506,26 @@
 
 
   {
+    kDebug() << "top is" << top;
+    Declaration* decl = findDeclaration(top, QualifiedIdentifier("Dummy"), \
top->textRange().end()); +    QVERIFY(decl);
+    QVERIFY(decl->abstractType());
+    QVERIFY(dynamic_cast<const IdentifiedType*>(decl->abstractType().data()));
+    QCOMPARE(decl->abstractType()->toString(), QString("Dummy"));
+  }
+  {
     Declaration* decl = findDeclaration(top, \
QualifiedIdentifier("Test2<Dummy>::B2"), top->textRange().end());  QVERIFY(decl);
     QVERIFY(decl->abstractType());
     QVERIFY(dynamic_cast<const IdentifiedType*>(decl->abstractType().data()));
-    QCOMPARE(decl->toString(), QString("Test<Dummy>"));
+    QCOMPARE(decl->abstractType()->toString(), QString("Test< Dummy >"));
   }
   {
     Declaration* decl = findDeclaration(top, \
QualifiedIdentifier("Test2<Dummy>::bm"), top->textRange().end());  QVERIFY(decl);
     QVERIFY(decl->abstractType());
     QVERIFY(dynamic_cast<const IdentifiedType*>(decl->abstractType().data()));
-    QCOMPARE(decl->toString(), QString("Test<Dummy>"));
+    QCOMPARE(decl->abstractType()->toString(), QString("Test< Dummy >"));
   }
   {
     Declaration* decl = findDeclaration(top, QualifiedIdentifier("Test2<Dummy>"), \
top->textRange().end()); @@ -526,9 +535,10 @@
     QVERIFY(classType);
     QCOMPARE(classType->baseClasses().count(), 1);
     QVERIFY(classType->baseClasses()[0].baseClass);
+    kDebug() << typeid(*classType->baseClasses()[0].baseClass.data()).name();
     const CppClassType* parentClassType = dynamic_cast<const \
CppClassType*>(classType->baseClasses()[0].baseClass.data());  \
                QVERIFY(parentClassType);
-    QCOMPARE(parentClassType->toString(), QString("Test<Dummy>"));
+    QCOMPARE(parentClassType->toString(), QString("Test< Dummy >"));
   }
   
   release(top);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic