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

List:       kde-commits
Subject:    KDE/kdevelop/buildtools/managers/cmake/tests
From:       Aleix Pol Gonzalez <aleixpol () gmail ! com>
Date:       2008-04-16 10:20:14
Message-ID: 1208341214.950340.24956.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 797539 by apol:

Fixed the test to compile.
Added uses test cases.


 M  +12 -4     cmakeduchaintest.cpp  
 M  +5 -0      cmakeduchaintest.h  


--- trunk/KDE/kdevelop/buildtools/managers/cmake/tests/cmakeduchaintest.cpp #797538:797539
@@ -23,7 +23,6 @@
 
 #include <identifier.h>
 #include <declaration.h>
-#include <topducontext.h>
 #include <duchainlock.h>
 #include <duchain.h>
 #include <simplerange.h>
@@ -35,7 +34,9 @@
 Q_DECLARE_METATYPE(QList<SimpleRange>)
 
 CMakeDUChainTest::CMakeDUChainTest()
-{}
+{
+	m_fakeContext = new TopDUContext(HashedString("test"), SimpleRange(0,0,0,0));
+}
 
 CMakeDUChainTest::~CMakeDUChainTest()
 {}
@@ -48,7 +49,7 @@
     QTest::newRow("simple") << "project(simpletest)\n" << QList<SimpleRange>();
     
     QList<SimpleRange> sr;
-    sr.append(SimpleRange(2, 5, 2, 8));
+    sr.append(SimpleRange(1, 4, 1, 7));
     QTest::newRow("simple 2") <<
             "project(simpletest)\n"
             "set(var a b c)\n" << sr;
@@ -56,6 +57,13 @@
     QTest::newRow("simple 3") <<
             "project(simpletest)\n"
             "find_package(KDE4)\n" << QList<SimpleRange>();
+    
+
+    sr.append(SimpleRange(2, 4, 2, 8));
+    QTest::newRow("simple 2 with use") <<
+            "project(simpletest)\n"
+            "set(var a b c)\n"
+	    "set(var2 ${var})\n"<< sr;
 }
 
 void CMakeDUChainTest::testDUChainWalk()
@@ -76,7 +84,7 @@
     MacroMap mm;
     VariableMap vm;
     
-    CMakeProjectVisitor v(file.fileName());
+    CMakeProjectVisitor v(file.fileName(), m_fakeContext);
     v.setVariableMap(&vm);
     v.setMacroMap(&mm);
 //     v.setModulePath();
--- trunk/KDE/kdevelop/buildtools/managers/cmake/tests/cmakeduchaintest.h #797538:797539
@@ -22,11 +22,14 @@
 #define CMAKEDUCHAINTEST_H
 
 #include <QtTest/QtTest>
+#include <topducontext.h>
 
 /**
  * A test for the CMake DUChain builder.
  * @author Aleix Pol <aleixpol@gmail.com>
  */
+
+
 class CMakeDUChainTest : public QObject
 {
     Q_OBJECT
@@ -37,6 +40,8 @@
     private slots:
         void testDUChainWalk_data();
         void testDUChainWalk();
+    private:
+    	KDevelop::TopDUContext* m_fakeContext;
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

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