Commit 2df95e20 authored by Milian Wolff's avatar Milian Wolff
Browse files

Add testcases for hard to parse template arguments

We simply fail with the `A<B` arg - to parse it correctly we would
need to know the type of A and whether it's a template or not.
parent b4eeba21
......@@ -166,6 +166,8 @@ void TestStringHelpers::testParamIterator_data()
addTest("Y<decltype(&X::operator<=), Z<&X::operator<=>>", {"decltype(&X::operator<=)", "Z<&X::operator<=>"});
// NOTE: this identifier here is invalid but we shouldn't trigger UB either, so the test is just that we get _something_ (even if it's wrong)
addTest("bogus<_Tp, _Up, invalid<decltype(<=(std::declval<_Tp>(), std::declval<_Up>()))>>", {"_Tp", "_Up", "invalid<decltype(<=(std::declval<_Tp>(), std::declval<_Up>()))>>"});
addTest("hardToParse<A<B>", {"A<B"});
addTest("hardToParse<(A>B)>", {"(A>B)"});
}
void TestStringHelpers::testParamIterator()
......@@ -177,6 +179,7 @@ void TestStringHelpers::testParamIterator()
auto it = KDevelop::ParamIterator(parens, source);
QEXPECT_FAIL("hardToParse<A<B>", "quasi impossible to parse without semantic knowledge of the types", Abort);
while (!params.isEmpty()) {
QVERIFY(it);
QCOMPARE(*it, params.takeFirst());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment