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

List:       kde-commits
Subject:    [kdev-php] duchain/tests: add test i created for debugging a problem that turned out to be perfectly
From:       Niko Sams <niko.sams () gmail ! com>
Date:       2013-12-08 15:39:22
Message-ID: E1VpgS2-0003RT-Vo () scm ! kde ! org
[Download RAW message or body]

Git commit 4c3f6ad604afe6f0211214434e062cd1747a4dee by Niko Sams.
Committed on 08/12/2013 at 15:38.
Pushed by nsams into branch 'master'.

add test i created for debugging a problem that turned out to be perfectly ok

M  +23   -0    duchain/tests/duchain.cpp
M  +1    -0    duchain/tests/duchain.h

http://commits.kde.org/kdev-php/4c3f6ad604afe6f0211214434e062cd1747a4dee

diff --git a/duchain/tests/duchain.cpp b/duchain/tests/duchain.cpp
index 7124f17..5d983d4 100644
--- a/duchain/tests/duchain.cpp
+++ b/duchain/tests/duchain.cpp
@@ -2851,4 +2851,27 @@ void TestDUChain::bug296709()
     QCOMPARE(decs.at(0)->uses().begin()->first(), RangeInRevision(2, 2, 2, 4));
 }
 
+
+void TestDUChain::declareFinalMethod()
+{
+    //                 0         1         2         3         4         5         6         7
+    //                 01234567890123456789012345678901234567890123456789012345678901234567890123456789
+    QByteArray method("<? class A { public final function foo() {} }");
+
+    TopDUContext* top = parse(method, DumpAll);
+    DUChainReleaser releaseTop(top);
+    DUChainWriteLocker lock(DUChain::lock());
+
+    QVERIFY(!top->parentContext());
+    QCOMPARE(top->childContexts().count(), 1);
+
+    DUContext* contextClassA = top->childContexts().first();
+
+    Declaration* dec = contextClassA->localDeclarations().at(0);
+    ClassFunctionDeclaration* funDec = dynamic_cast<ClassFunctionDeclaration*>(dec);
+    QVERIFY(funDec);
+    QCOMPARE(funDec->qualifiedIdentifier(), QualifiedIdentifier("a::foo"));
+    QVERIFY(funDec->isFinal());
+}
+
 #include "duchain.moc"
diff --git a/duchain/tests/duchain.h b/duchain/tests/duchain.h
index db276c5..12b36b0 100644
--- a/duchain/tests/duchain.h
+++ b/duchain/tests/duchain.h
@@ -144,6 +144,7 @@ private slots:
     void gotoTest();
     void ternary();
     void bug296709();
+    void declareFinalMethod();
 };
 
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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