Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/duchain.cpp
Show First 20 Lines • Show All 2138 Lines • ▼ Show 20 Line(s) | 2102 | { | |||
---|---|---|---|---|---|
2139 | { | 2139 | { | ||
2140 | TopDUContext* top = parse("<?\n/// Foo\n/// Bar\nfunction foo() {} ", DumpNone); | 2140 | TopDUContext* top = parse("<?\n/// Foo\n/// Bar\nfunction foo() {} ", DumpNone); | ||
2141 | DUChainReleaser releaseTop(top); | 2141 | DUChainReleaser releaseTop(top); | ||
2142 | DUChainWriteLocker lock(DUChain::lock()); | 2142 | DUChainWriteLocker lock(DUChain::lock()); | ||
2143 | QCOMPARE(top->localDeclarations().first()->comment(), QByteArray("Foo\n Bar")); | 2143 | QCOMPARE(top->localDeclarations().first()->comment(), QByteArray("Foo\n Bar")); | ||
2144 | } | 2144 | } | ||
2145 | 2145 | | |||
2146 | { | 2146 | { | ||
2147 | // same as above but with indendation | 2147 | // same as above but with indentation | ||
2148 | TopDUContext* top = parse("<?\n /// Foo\n /// Bar\n function foo() {} ", DumpNone); | 2148 | TopDUContext* top = parse("<?\n /// Foo\n /// Bar\n function foo() {} ", DumpNone); | ||
2149 | DUChainReleaser releaseTop(top); | 2149 | DUChainReleaser releaseTop(top); | ||
2150 | DUChainWriteLocker lock(DUChain::lock()); | 2150 | DUChainWriteLocker lock(DUChain::lock()); | ||
2151 | QCOMPARE(top->localDeclarations().first()->comment(), QByteArray("Foo\n Bar")); | 2151 | QCOMPARE(top->localDeclarations().first()->comment(), QByteArray("Foo\n Bar")); | ||
2152 | } | 2152 | } | ||
2153 | } | 2153 | } | ||
2154 | 2154 | | |||
2155 | void TestDUChain::variableDocBlock() | 2155 | void TestDUChain::variableDocBlock() | ||
▲ Show 20 Lines • Show All 1310 Lines • ▼ Show 20 Line(s) | 3438 | { | |||
3466 | 3466 | | |||
3467 | dec = top->localDeclarations().at(3); | 3467 | dec = top->localDeclarations().at(3); | ||
3468 | QCOMPARE(dec->qualifiedIdentifier().toString(), QString("ns5")); | 3468 | QCOMPARE(dec->qualifiedIdentifier().toString(), QString("ns5")); | ||
3469 | QVERIFY(dynamic_cast<NamespaceAliasDeclaration*>(dec)); | 3469 | QVERIFY(dynamic_cast<NamespaceAliasDeclaration*>(dec)); | ||
3470 | 3470 | | |||
3471 | dec = top->localDeclarations().at(4); | 3471 | dec = top->localDeclarations().at(4); | ||
3472 | QCOMPARE(dec->qualifiedIdentifier().toString(), QString("ns6")); | 3472 | QCOMPARE(dec->qualifiedIdentifier().toString(), QString("ns6")); | ||
3473 | QVERIFY(dynamic_cast<NamespaceAliasDeclaration*>(dec)); | 3473 | QVERIFY(dynamic_cast<NamespaceAliasDeclaration*>(dec)); | ||
3474 | ///TODO: find out why this is explictly required | 3474 | ///TODO: find out why this is explicitly required | ||
3475 | QVERIFY(!dynamic_cast<NamespaceAliasDeclaration*>(dec)->importIdentifier().explicitlyGlobal()); | 3475 | QVERIFY(!dynamic_cast<NamespaceAliasDeclaration*>(dec)->importIdentifier().explicitlyGlobal()); | ||
3476 | } | 3476 | } | ||
3477 | 3477 | | |||
3478 | void TestDUChain::useBaseTypeNamespace() | 3478 | void TestDUChain::useBaseTypeNamespace() | ||
3479 | { | 3479 | { | ||
3480 | // 0 1 2 3 4 5 6 7 | 3480 | // 0 1 2 3 4 5 6 7 | ||
3481 | // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 | 3481 | // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 | ||
3482 | TopDUContext* top = parse("<?php\n" | 3482 | TopDUContext* top = parse("<?php\n" | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 3564 | { | |||
3566 | // 0 1 2 3 4 5 6 7 | 3566 | // 0 1 2 3 4 5 6 7 | ||
3567 | // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 | 3567 | // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 | ||
3568 | TopDUContext* top = parse("<?php\n" | 3568 | TopDUContext* top = parse("<?php\n" | ||
3569 | "namespace ns {\n" | 3569 | "namespace ns {\n" | ||
3570 | "class e{}\n" | 3570 | "class e{}\n" | ||
3571 | "}\n" | 3571 | "}\n" | ||
3572 | "namespace {\n" | 3572 | "namespace {\n" | ||
3573 | "try { /* ... */ }\n" | 3573 | "try { /* ... */ }\n" | ||
3574 | "catch(\\ns\\e $exeption) { /* ... */ }" | 3574 | "catch(\\ns\\e $exception) { /* ... */ }" | ||
3575 | "}\n" | 3575 | "}\n" | ||
3576 | , DumpNone); | 3576 | , DumpNone); | ||
3577 | QVERIFY(top); | 3577 | QVERIFY(top); | ||
3578 | DUChainReleaser releaseTop(top); | 3578 | DUChainReleaser releaseTop(top); | ||
3579 | DUChainWriteLocker lock; | 3579 | DUChainWriteLocker lock; | ||
3580 | 3580 | | |||
3581 | QVERIFY(top->problems().isEmpty()); | 3581 | QVERIFY(top->problems().isEmpty()); | ||
3582 | Declaration* eDec = top->findDeclarations(QualifiedIdentifier(QStringLiteral("ns::e"))).first(); | 3582 | Declaration* eDec = top->findDeclarations(QualifiedIdentifier(QStringLiteral("ns::e"))).first(); | ||
▲ Show 20 Lines • Show All 605 Lines • Show Last 20 Lines |