Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/expressionparser.cpp
Show First 20 Lines • Show All 655 Lines • ▼ Show 20 Line(s) | 644 | { | |||
---|---|---|---|---|---|
656 | 656 | | |||
657 | ExpressionParser p(true); | 657 | ExpressionParser p(true); | ||
658 | 658 | | |||
659 | ExpressionEvaluationResult res = p.evaluateType(NSconst.toUtf8(), DUContextPointer(top), CursorInRevision(1, 0)); | 659 | ExpressionEvaluationResult res = p.evaluateType(NSconst.toUtf8(), DUContextPointer(top), CursorInRevision(1, 0)); | ||
660 | QVERIFY(res.type()); | 660 | QVERIFY(res.type()); | ||
661 | QCOMPARE(IntegralType::Ptr::staticCast(res.type())->dataType(), static_cast<uint>(IntegralType::TypeString)); | 661 | QCOMPARE(IntegralType::Ptr::staticCast(res.type())->dataType(), static_cast<uint>(IntegralType::TypeString)); | ||
662 | } | 662 | } | ||
663 | 663 | | |||
664 | void TestExpressionParser::invalidVariadicFunction_data() | ||||
665 | { | ||||
666 | QTest::addColumn<QString>("code"); | ||||
667 | | ||||
668 | QTest::newRow("defaultValue") << "<? function foo(...$i=NULL) { } \n"; | ||||
669 | | ||||
670 | QTest::newRow("multipleVariadics") << "<? function foo(...$i, ...$j) { } \n"; | ||||
671 | } | ||||
672 | | ||||
673 | void TestExpressionParser::invalidVariadicFunction() | ||||
674 | { | ||||
675 | QFETCH(QString, code); | ||||
676 | | ||||
677 | TopDUContext* top = parse(code.toUtf8(), DumpNone); | ||||
678 | DUChainReleaser releaseTop(top); | ||||
679 | DUChainWriteLocker lock; | ||||
680 | | ||||
681 | QVERIFY(!top->problems().isEmpty()); | ||||
682 | } | ||||
683 | | ||||
664 | } | 684 | } | ||
665 | 685 | |