Changeset View
Changeset View
Standalone View
Standalone View
plugins/clang/tests/test_duchain.cpp
Show First 20 Lines • Show All 1959 Lines • ▼ Show 20 Line(s) | 1949 | { | |||
---|---|---|---|---|---|
1960 | DUChainReadLocker lock; | 1960 | DUChainReadLocker lock; | ||
1961 | QSet<TopDUContext*> checked; | 1961 | QSet<TopDUContext*> checked; | ||
1962 | verifyNoErrors(file.topContext(), checked); | 1962 | verifyNoErrors(file.topContext(), checked); | ||
1963 | } | 1963 | } | ||
1964 | 1964 | | |||
1965 | m_projectController->closeAllProjects(); | 1965 | m_projectController->closeAllProjects(); | ||
1966 | } | 1966 | } | ||
1967 | 1967 | | |||
1968 | void TestDUChain::testLambda() | ||||
1969 | { | ||||
1970 | TestFile file(QStringLiteral("auto lambda = [](int p1, int p2, int p3) { int var1, var2; };"), QStringLiteral("cpp")); | ||||
1971 | QVERIFY(file.parseAndWait()); | ||||
1972 | { | ||||
1973 | DUChainReadLocker lock; | ||||
1974 | QVERIFY(file.topContext()); | ||||
1975 | QCOMPARE(file.topContext()->localDeclarations().size(), 1); | ||||
1976 | QCOMPARE(file.topContext()->childContexts().size(), 1); | ||||
1977 | | ||||
1978 | auto lambdaContext = file.topContext()->childContexts().first(); | ||||
1979 | | ||||
1980 | QCOMPARE(lambdaContext->type(), DUContext::Function); | ||||
1981 | | ||||
1982 | QCOMPARE(lambdaContext->localDeclarations().size(), 3); | ||||
1983 | QCOMPARE(lambdaContext->childContexts().size(), 1); | ||||
1984 | QCOMPARE(lambdaContext->childContexts().first()->type(), DUContext::Other); | ||||
1985 | QCOMPARE(lambdaContext->childContexts().first()->localDeclarations().size(), 2); | ||||
1986 | } | ||||
1987 | } | ||||
1988 | | ||||
1968 | void TestDUChain::testQtIntegration() | 1989 | void TestDUChain::testQtIntegration() | ||
1969 | { | 1990 | { | ||
1970 | QTemporaryDir includeDir; | 1991 | QTemporaryDir includeDir; | ||
1971 | { | 1992 | { | ||
1972 | QDir dir(includeDir.path()); | 1993 | QDir dir(includeDir.path()); | ||
1973 | dir.mkdir(QStringLiteral("QtCore")); | 1994 | dir.mkdir(QStringLiteral("QtCore")); | ||
1974 | // create the file but don't put anything in it | 1995 | // create the file but don't put anything in it | ||
1975 | QFile header(includeDir.path() + "/QtCore/qobjectdefs.h"); | 1996 | QFile header(includeDir.path() + "/QtCore/qobjectdefs.h"); | ||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |