AutoTest: Fix gtest detection

If a test name starts with a number the codemodel handles
the function-like macro differently and does not generate
the arguments as it would do when using normal literals.
Work around by explicitly handling the expression tokens.

Fixes: QTCREATORBUG-25498
Change-Id: Ibf381af912403cb7b87c1c30b5a8fc7043c16056
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Christian Stenger
2021-03-19 13:21:30 +01:00
parent 0c01ef9998
commit 5d5ff57495
3 changed files with 69 additions and 26 deletions

View File

@@ -213,7 +213,7 @@ void AutoTestUnitTests::testCodeParserGTest()
QVERIFY(parserSpy.wait(20000));
QVERIFY(modelUpdateSpy.wait());
QCOMPARE(m_model->gtestNamesCount(), 7);
QCOMPARE(m_model->gtestNamesCount(), 8);
QMultiMap<QString, int> expectedNamesAndSets;
expectedNamesAndSets.insert(QStringLiteral("FactorialTest"), 3);
@@ -222,6 +222,7 @@ void AutoTestUnitTests::testCodeParserGTest()
expectedNamesAndSets.insert(QStringLiteral("QueueTest"), 2);
expectedNamesAndSets.insert(QStringLiteral("DummyTest"), 1); // used as parameterized test
expectedNamesAndSets.insert(QStringLiteral("DummyTest"), 1); // used as 'normal' test
expectedNamesAndSets.insert(QStringLiteral("NumberAsNameStart"), 1);
expectedNamesAndSets.insert(QStringLiteral("NamespaceTest"), 1);
QMultiMap<QString, int> foundNamesAndSets = m_model->gtestNamesAndSets();