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

List:       kde-commits
Subject:    extragear/sdk/kdevelop/languages/cpp/cppduchain/tests
From:       Milian Wolff <mail () milianw ! de>
Date:       2010-03-02 12:40:55
Message-ID: 1267533655.052242.12437.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1097922 by mwolff:

extend test showing that it doesn't work for global template functions either

apparently the CPP support thinks that the implicit instantations are new \
declarations without any type, i.e.: <notype> funcName(someCtorArg); instead of: void \
funcName<typeOfArg>(Arg);

 M  +15 -0     test_duchain.cpp  


--- trunk/extragear/sdk/kdevelop/languages/cpp/cppduchain/tests/test_duchain.cpp \
#1097921:1097922 @@ -3268,11 +3268,26 @@
 
   DUChainWriteLocker lock(DUChain::lock());
   QCOMPARE(top->childContexts().first()->localDeclarations().size(), 1);
+  QCOMPARE(top->localDeclarations().size(), 1);
+  QCOMPARE(top->childContexts().first()->localDeclarations().size(), 1);
   TemplateDeclaration* tpl = \
dynamic_cast<TemplateDeclaration*>(top->childContexts().first()->localDeclarations().first());
  QVERIFY(tpl);
   QCOMPARE(tpl->instantiations().size(), 3);
   release(top);
   }
+  {
+  QByteArray method("template<typename T> void foo(T){}\n"
+                    "foo(5); foo('x'); foo(\"asdfasdfadf\");\n");
+
+  TopDUContext* top = parse(method, DumpNone);
+
+  DUChainWriteLocker lock(DUChain::lock());
+  QCOMPARE(top->localDeclarations().size(), 1);
+  TemplateDeclaration* tpl = \
dynamic_cast<TemplateDeclaration*>(top->localDeclarations().first()); +  \
QVERIFY(tpl); +  QCOMPARE(tpl->instantiations().size(), 3);
+  release(top);
+  }
 }
 
 void TestDUChain::testSourceCodeInsertion()


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

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