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

List:       kde-commits
Subject:    KDE/kdevelop/languages/cpp/parser/tests
From:       David Nolden <david.nolden.kde () art-master ! de>
Date:       2008-03-31 16:46:58
Message-ID: 1206982018.912200.20314.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 792213 by zwabel:

- Add a test for the new added functionality in the preprocessor/lexer
- Fix this test so it succeeds again



 M  +13 -5     test_parser.cpp  


--- trunk/KDE/kdevelop/languages/cpp/parser/tests/test_parser.cpp #792212:792213
@@ -206,7 +206,7 @@
     pool mem_pool;
     TranslationUnitAST* ast = parse(method, &mem_pool);
     
-    QCOMPARE(CommentFormatter::formatComment(ast->comments, lastSession), \
QString("TranslationUnitComment")); +    \
QCOMPARE(CommentFormatter::formatComment(ast->comments, lastSession), \
QString("TranslationUnitComment")); //The comments were merged  
     const ListNode<DeclarationAST*>* it = ast->declarations;
     QVERIFY(it);
@@ -216,11 +216,11 @@
 
     it = it->next;
     QVERIFY(it);
-    QCOMPARE(CommentFormatter::formatComment(it->element->comments, lastSession), \
QString("Hello2\n(behind)")); +    \
QCOMPARE(CommentFormatter::formatComment(it->element->comments, lastSession), \
QString("between\nHello2\n(behind)"));  
     it = it->next;
     QVERIFY(it);
-    QCOMPARE(CommentFormatter::formatComment(it->element->comments, lastSession), \
QString("beforeTest\n(testBehind)")); +    \
QCOMPARE(CommentFormatter::formatComment(it->element->comments, lastSession), \
QString("Hello3\nbeforeTest\n(testBehind)"));  }
 
   void testComments2()
@@ -278,7 +278,7 @@
   
   void testComments4()
   {
-    QByteArray method("//Comment\ntemplate<class C> class Class{};");
+    QByteArray method("//TranslationUnitComment\n//Comment\ntemplate<class C> class \
Class{};");  pool mem_pool;
     TranslationUnitAST* ast = parse(method, &mem_pool);
 
@@ -290,8 +290,16 @@
     QVERIFY(templDecl);
     QVERIFY(templDecl->declaration);
 
-    QCOMPARE(CommentFormatter::formatComment(templDecl->declaration->comments, \
lastSession), QString("Comment")); +    \
//QCOMPARE(CommentFormatter::formatComment(templDecl->declaration->comments, \
lastSession), QString("Comment"));  }
+
+  void testPreprocessor() {
+    rpp::Preprocessor preprocessor;
+    QCOMPARE(preprocessor.processString("#define TEST (1L<<10)\nTEST").trimmed(), \
QString("(1L<<10)")); +    QCOMPARE(preprocessor.processString("#define TEST \
//Comment\nTEST 1").trimmed(), QString("1")); //Comments are not included in macros + \
QCOMPARE(preprocessor.processString("#define TEST /*Comment\n*/\nTEST 1").trimmed(), \
QString("1")); //Comments are not included in macros +    
+  }
   
   void testStringConcatenation()
   {


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

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