MCPcopy Create free account
hub / github.com/KDE/kdevelop / testTypeAliasTemplate

Method testTypeAliasTemplate

plugins/clang/tests/test_duchain.cpp:1923–1943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1921}
1922
1923void TestDUChain::testTypeAliasTemplate()
1924{
1925 TestFile file(QStringLiteral("template <typename T> using Alias = T; using Foo = Alias<int>;"), QStringLiteral("cpp"));
1926 QVERIFY(file.parseAndWait());
1927
1928 DUChainReadLocker lock;
1929 QVERIFY(file.topContext());
1930
1931 QCOMPARE(file.topContext()->localDeclarations().size(), 2);
1932 auto templateAlias = file.topContext()->localDeclarations().first();
1933 QVERIFY(templateAlias);
1934#if CINDEX_VERSION_MINOR < 31
1935 QEXPECT_FAIL("", "TypeAliasTemplate is not exposed via LibClang", Abort);
1936#endif
1937 QVERIFY(templateAlias->isTypeAlias());
1938 QVERIFY(templateAlias->abstractType());
1939 QCOMPARE(templateAlias->abstractType()->toString(), QStringLiteral("Alias"));
1940 QCOMPARE(templateAlias->uses().size(), 1);
1941 QCOMPARE(templateAlias->uses().first().size(), 1);
1942 QCOMPARE(templateAlias->uses().first().first(), RangeInRevision(0, 51, 0, 56));
1943}
1944
1945void TestDUChain::testDeclarationsInsideMacroExpansion()
1946{

Callers

nothing calls this directly

Calls 10

parseAndWaitMethod · 0.80
localDeclarationsMethod · 0.80
isTypeAliasMethod · 0.80
RangeInRevisionClass · 0.50
topContextMethod · 0.45
sizeMethod · 0.45
firstMethod · 0.45
abstractTypeMethod · 0.45
toStringMethod · 0.45
usesMethod · 0.45

Tested by

no test coverage detected