Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/duchain_multiplefiles.cpp
Show First 20 Lines • Show All 312 Lines • ▼ Show 20 Line(s) | 300 | for (int i = 0; i < 2; ++i) { | |||
---|---|---|---|---|---|
313 | QCOMPARE(top->localDeclarations().at(0)->qualifiedIdentifier(), QualifiedIdentifier("a")); | 313 | QCOMPARE(top->localDeclarations().at(0)->qualifiedIdentifier(), QualifiedIdentifier("a")); | ||
314 | 314 | | |||
315 | IntegralType::Ptr type = top->localDeclarations().at(0)->type<IntegralType>(); | 315 | IntegralType::Ptr type = top->localDeclarations().at(0)->type<IntegralType>(); | ||
316 | QVERIFY(type); | 316 | QVERIFY(type); | ||
317 | //Should actually parse as an TypeInt, but this does not work. | 317 | //Should actually parse as an TypeInt, but this does not work. | ||
318 | QVERIFY(type->dataType() == IntegralType::TypeMixed); | 318 | QVERIFY(type->dataType() == IntegralType::TypeMixed); | ||
319 | } | 319 | } | ||
320 | } | 320 | } | ||
321 | | ||||
322 | void TestDUChainMultipleFiles::testNamespacedIdentifierInPST() { | ||||
323 | auto features = TopDUContext::AllDeclarationsAndContexts; | ||||
324 | | ||||
325 | TestProject* project = new TestProject; | ||||
326 | m_projectController->closeAllProjects(); | ||||
327 | m_projectController->addProject(project); | ||||
328 | | ||||
329 | TestFile f1(QStringLiteral("<?\n" | ||||
330 | "namespace Test;\n" | ||||
331 | "class A {}\n"), QStringLiteral("php"), project); | ||||
332 | f1.parse(features); | ||||
333 | QVERIFY(f1.waitForParsed()); | ||||
334 | | ||||
335 | TestFile f2(QStringLiteral("<?\n" | ||||
336 | "namespace Test2;\n" | ||||
337 | "class B {\n" | ||||
338 | "public $class_a;\n" | ||||
339 | "public function __construct() { $this->class_a = new \\Test\\A(); }}"), QStringLiteral("php"), project); | ||||
340 | f2.parse(features); | ||||
341 | QVERIFY(f2.waitForParsed()); | ||||
342 | | ||||
343 | TestFile f3(QStringLiteral("<?\n" | ||||
344 | "namespace Test2;\n" | ||||
345 | "class C {\n" | ||||
346 | "public $class_a;\n" | ||||
347 | "public function __construct() { $this->class_a = new Test\\A(); }}"), QStringLiteral("php"), project); | ||||
348 | f3.parse(features); | ||||
349 | QVERIFY(f3.waitForParsed()); | ||||
350 | | ||||
351 | DUChainWriteLocker lock(DUChain::lock()); | ||||
352 | QVERIFY(f1.topContext()); | ||||
353 | QVERIFY(f2.topContext()); | ||||
354 | QVERIFY(f2.topContext()->imports(f1.topContext(), CursorInRevision(0, 0))); | ||||
355 | QVERIFY(f3.topContext()); | ||||
356 | QVERIFY(!f3.topContext()->imports(f1.topContext(), CursorInRevision(0, 0))); | ||||
357 | } |