Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/expressionparser.cpp
Context not available. | |||||
631 | QCOMPARE(IntegralType::Ptr::staticCast(res.type())->dataType(), static_cast<uint>(IntegralType::TypeString)); | 631 | QCOMPARE(IntegralType::Ptr::staticCast(res.type())->dataType(), static_cast<uint>(IntegralType::TypeString)); | ||
---|---|---|---|---|---|
632 | } | 632 | } | ||
633 | 633 | | |||
634 | void TestExpressionParser::classNameConstant_data() | ||||
635 | { | ||||
636 | QTest::addColumn<QString>("NSconst"); | ||||
637 | | ||||
638 | QTest::newRow("fullNamespace") << "\\NS\\ClassName::class"; | ||||
639 | QTest::newRow("normalNamespace") << "NS\\ClassName::class"; | ||||
640 | QTest::newRow("inNamespace") << "$n"; | ||||
641 | } | ||||
642 | | ||||
643 | void TestExpressionParser::classNameConstant() | ||||
644 | { | ||||
645 | QFETCH(QString, NSconst); | ||||
646 | | ||||
647 | // 0 1 2 3 4 5 6 7 | ||||
648 | // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 | ||||
649 | QByteArray method("<? namespace NS { class ClassName { } $n=ClassName::class; }"); | ||||
650 | | ||||
651 | TopDUContext* top = parse(method, DumpNone); | ||||
652 | DUChainReleaser releaseTop(top); | ||||
653 | DUChainWriteLocker lock; | ||||
654 | | ||||
655 | QVERIFY(top->problems().isEmpty()); | ||||
656 | | ||||
657 | ExpressionParser p(true); | ||||
658 | | ||||
659 | ExpressionEvaluationResult res = p.evaluateType(NSconst.toUtf8(), DUContextPointer(top), CursorInRevision(1, 0)); | ||||
660 | QVERIFY(res.type()); | ||||
661 | QCOMPARE(IntegralType::Ptr::staticCast(res.type())->dataType(), static_cast<uint>(IntegralType::TypeString)); | ||||
662 | } | ||||
663 | | ||||
634 | } | 664 | } | ||
635 | 665 | | |||
Context not available. |