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

List:       kde-commits
Subject:    [kdevelop] languages/cpp/parser/rpp: fix preprocessor test exe
From:       Milian Wolff <mail () milianw ! de>
Date:       2012-04-30 20:16:21
Message-ID: 20120430201621.B5B5FA60A9 () git ! kde ! org
[Download RAW message or body]

Git commit a71ecf8f49f1c8c4caa956f551e0b6d4364d35a2 by Milian Wolff.
Committed on 30/04/2012 at 22:15.
Pushed by mwolff into branch 'master'.

fix preprocessor test exe

M  +2    -2    languages/cpp/parser/rpp/pp-location.cpp
M  +1    -1    languages/cpp/parser/rpp/tests/CMakeLists.txt
M  +13   -5    languages/cpp/parser/rpp/tests/main.cpp

http://commits.kde.org/kdevelop/a71ecf8f49f1c8c4caa956f551e0b6d4364d35a2

diff --git a/languages/cpp/parser/rpp/pp-location.cpp \
b/languages/cpp/parser/rpp/pp-location.cpp index 19e3bcd..161dd39 100644
--- a/languages/cpp/parser/rpp/pp-location.cpp
+++ b/languages/cpp/parser/rpp/pp-location.cpp
@@ -177,10 +177,10 @@ LocationTable::AnchorInTable \
LocationTable::anchorForOffset(std::size_t offset,  void LocationTable::dump() const
 {
   QMapIterator<std::size_t, Anchor> it = m_offsetTable;
-  kDebug(9007) << "Location Table:";
+  qDebug() << "Location Table:";
   while (it.hasNext()) {
     it.next();
-    kDebug(9007) << it.key() << " => " << \
it.value().castToSimpleCursor().textCursor(); +    qDebug() << it.key() << " => " << \
it.value().castToSimpleCursor().textCursor();  }
 }
 
diff --git a/languages/cpp/parser/rpp/tests/CMakeLists.txt \
b/languages/cpp/parser/rpp/tests/CMakeLists.txt index d6e72f3..ff54b65 100644
--- a/languages/cpp/parser/rpp/tests/CMakeLists.txt
+++ b/languages/cpp/parser/rpp/tests/CMakeLists.txt
@@ -9,5 +9,5 @@ set(pp_SRCS
 )
 
 kde4_add_executable(pp TEST ${pp_SRCS})
-target_link_libraries(pp ${KDE4_KDECORE_LIBS} kdev4cpprpp)
+target_link_libraries(pp ${KDE4_KDECORE_LIBS} ${KDEVPLATFORM_TESTS_LIBRARIES} \
${KDEVPLATFORM_LANGUAGE_LIBRARIES} kdev4cpprpp)  
diff --git a/languages/cpp/parser/rpp/tests/main.cpp \
b/languages/cpp/parser/rpp/tests/main.cpp index a202f52..969344f 100644
--- a/languages/cpp/parser/rpp/tests/main.cpp
+++ b/languages/cpp/parser/rpp/tests/main.cpp
@@ -22,6 +22,10 @@
 
 #include <kdebug.h>
 
+#include <QCoreApplication>
+#include <tests/testcore.h>
+#include <tests/autotestshell.h>
+
 #include "preprocessor.h"
 #include "pp-environment.h"
 #include "pp-location.h"
@@ -29,14 +33,18 @@
 
 using namespace rpp;
 
-int main (int /*argc*/, char *argv[])
+int main (int argc, char **argv)
 {
-  char const *filename = *++argv;
-  if (!filename)
+  QCoreApplication app(argc, argv);
+  if (app.arguments().count() < 2)
     {
       kDebug(9007) << "usage: pp file.cpp";
       return EXIT_FAILURE;
     }
+  const QString filename = app.arguments().at(1);
+
+  KDevelop::AutoTestShell::init();
+  KDevelop::TestCore::initialize(KDevelop::Core::NoUi, "kdev-pp");
 
   Preprocessor p;
 
@@ -46,11 +54,11 @@ int main (int /*argc*/, char *argv[])
 
   preprocess.processFile(QString("pp-configuration")); // ### put your macros here!
 
-  QString result = QString::fromUtf8(stringFromContents(preprocess.processFile(QString(filename))));
 +  QString result = \
QString::fromUtf8(stringFromContents(preprocess.processFile(filename)));  
   QStringList resultLines = result.split('\n');
   for (int i = 0; i < resultLines.count(); ++i)
-    kDebug(9007) << i << ":" << resultLines[i];
+    qDebug() << i << ":" << resultLines[i];
 
   preprocess.environment()->locationTable()->dump();
   


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

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