Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/duchain.cpp
Show First 20 Lines • Show All 1368 Lines • ▼ Show 20 Line(s) | 1365 | { | |||
---|---|---|---|---|---|
1369 | 1369 | | |||
1370 | TopDUContext* top = parse(method, DumpNone); | 1370 | TopDUContext* top = parse(method, DumpNone); | ||
1371 | DUChainReleaser releaseTop(top); | 1371 | DUChainReleaser releaseTop(top); | ||
1372 | DUChainWriteLocker lock(DUChain::lock()); | 1372 | DUChainWriteLocker lock(DUChain::lock()); | ||
1373 | 1373 | | |||
1374 | AbstractFunctionDeclaration* fun = dynamic_cast<AbstractFunctionDeclaration*>(top->localDeclarations().first()); | 1374 | AbstractFunctionDeclaration* fun = dynamic_cast<AbstractFunctionDeclaration*>(top->localDeclarations().first()); | ||
1375 | QVERIFY(fun); | 1375 | QVERIFY(fun); | ||
1376 | 1376 | | |||
1377 | QCOMPARE(fun->defaultParametersSize(), 2u); | 1377 | QCOMPARE(fun->defaultParametersSize(), 3u); | ||
1378 | QCOMPARE(fun->defaultParameters()[0].str(), QString("false")); | 1378 | QVERIFY(fun->defaultParameters()[0].isEmpty()); | ||
1379 | QCOMPARE(fun->defaultParameters()[1].str(), QString("null")); | 1379 | QCOMPARE(fun->defaultParameters()[1].str(), QString("false")); | ||
1380 | QCOMPARE(fun->defaultParameters()[2].str(), QString("null")); | ||||
1380 | } | 1381 | } | ||
1381 | 1382 | | |||
1382 | void TestDUChain::defaultFunctionParamWithTypehint() { | 1383 | void TestDUChain::defaultFunctionParamWithTypehint() { | ||
1383 | QByteArray method("<? function foo(array $i = array()) { } "); | 1384 | QByteArray method("<? function foo(array $i = array()) { } "); | ||
1384 | 1385 | | |||
1385 | TopDUContext* top = parse(method, DumpAll); | 1386 | TopDUContext* top = parse(method, DumpAll); | ||
1386 | DUChainReleaser releaseTop(top); | 1387 | DUChainReleaser releaseTop(top); | ||
1387 | 1388 | | |||
▲ Show 20 Lines • Show All 2033 Lines • Show Last 20 Lines |