~ubuntu-branches/ubuntu/utopic/kdevelop-php/utopic

« back to all changes in this revision

Viewing changes to duchain/tests/test_duchain.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2010-01-17 17:10:22 UTC
  • Revision ID: james.westby@ubuntu.com-20100117171022-nx770ylotvqxwlmc
Tags: 1.0.0~beta2-1
Initial release (Closes: #565680)

Show diffs side-by-side

added added

removed removed

Lines of Context:
506
506
    QVERIFY(IntegralType::Ptr::dynamicCast(fType->returnType())->dataType() == IntegralType::TypeInt);
507
507
}
508
508
 
 
509
void TestDUChain::testDeclarationReturnTypeClassChain()
 
510
{
 
511
    QByteArray method("<? class A { /** @return this **/ function a() {} /** @return self **/ function b() {} }");
 
512
 
 
513
    TopDUContext* top = parse(method, DumpNone);
 
514
    DUChainReleaser releaseTop(top);
 
515
    DUChainWriteLocker lock(DUChain::lock());
 
516
 
 
517
    // class a
 
518
    DUContext* ctx = top->childContexts().first();
 
519
    QCOMPARE(ctx->type(), DUContext::Class);
 
520
    QVERIFY(ctx->owner());
 
521
    QVERIFY(StructureType::Ptr::dynamicCast(ctx->owner()->abstractType()));
 
522
 
 
523
    //function a
 
524
    QVERIFY(/* func a (this) */ ctx->localDeclarations().at(0)->type<FunctionType>() == ctx->owner()->abstractType());
 
525
    QVERIFY(/* func b (self) */ ctx->localDeclarations().at(1)->type<FunctionType>() == ctx->owner()->abstractType());
 
526
}
 
527
 
509
528
void TestDUChain::testDeclareTypehintFunction()
510
529
{
511
530
    //                 0         1         2         3         4         5         6         7