forked from qt-creator/qt-creator
AutoTest: Fix handling of parameterized boost tests
Setting the parameterized flag after the test case may have been added to the found tests is useless. Do it as early as possible to take it into account when gathering information for location and type. Beside this the filter for parameterized boost tests had been wrong which in turn led to not executing them at all. Change-Id: I1a4345b2a751c79cc4fc6df8e201e9606c961aaf Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -105,6 +105,7 @@ void BoostCodeParser::handleIdentifier()
|
|||||||
} else if (identifier == "BOOST_TEST_CASE") {
|
} else if (identifier == "BOOST_TEST_CASE") {
|
||||||
handleTestCase(TestCaseType::Functions);
|
handleTestCase(TestCaseType::Functions);
|
||||||
} else if (identifier == "BOOST_PARAM_TEST_CASE") {
|
} else if (identifier == "BOOST_PARAM_TEST_CASE") {
|
||||||
|
m_currentState.setFlag(BoostTestTreeItem::Parameterized);
|
||||||
handleTestCase(TestCaseType::Parameter);
|
handleTestCase(TestCaseType::Parameter);
|
||||||
} else if (identifier == "BOOST_AUTO_TEST_CASE") {
|
} else if (identifier == "BOOST_AUTO_TEST_CASE") {
|
||||||
handleTestCase(TestCaseType::Auto);
|
handleTestCase(TestCaseType::Auto);
|
||||||
@@ -203,8 +204,6 @@ void BoostCodeParser::handleTestCase(TestCaseType testCaseType)
|
|||||||
m_currentState = BoostTestTreeItem::Enabled;
|
m_currentState = BoostTestTreeItem::Enabled;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (testCaseType == TestCaseType::Parameter)
|
|
||||||
m_currentState |= BoostTestTreeItem::Parameterized;
|
|
||||||
} else if (m_currentState.testFlag(BoostTestTreeItem::Fixture)) {
|
} else if (m_currentState.testFlag(BoostTestTreeItem::Fixture)) {
|
||||||
// ignore first parameter (fixture) and first comma
|
// ignore first parameter (fixture) and first comma
|
||||||
if (!skipCommentsUntil(T_IDENTIFIER))
|
if (!skipCommentsUntil(T_IDENTIFIER))
|
||||||
|
@@ -236,6 +236,8 @@ QList<TestConfiguration *> BoostTestTreeItem::getSelectedTestConfigurations() co
|
|||||||
QString tcName = item->name();
|
QString tcName = item->name();
|
||||||
if (item->state().testFlag(BoostTestTreeItem::Templated))
|
if (item->state().testFlag(BoostTestTreeItem::Templated))
|
||||||
tcName.append("<*");
|
tcName.append("<*");
|
||||||
|
else if (item->state().testFlag(BoostTestTreeItem::Parameterized))
|
||||||
|
tcName.append('*');
|
||||||
tcName = handleSpecialFunctionNames(tcName);
|
tcName = handleSpecialFunctionNames(tcName);
|
||||||
testCasesForProjectFile[item->proFile()].testCases.append(
|
testCasesForProjectFile[item->proFile()].testCases.append(
|
||||||
item->prependWithParentsSuitePaths(tcName));
|
item->prependWithParentsSuitePaths(tcName));
|
||||||
@@ -271,6 +273,8 @@ TestConfiguration *BoostTestTreeItem::testConfiguration() const
|
|||||||
QString tcName = handleSpecialFunctionNames(boostItem->name());
|
QString tcName = handleSpecialFunctionNames(boostItem->name());
|
||||||
if (boostItem->type() == TestSuite) // execute everything below a suite
|
if (boostItem->type() == TestSuite) // execute everything below a suite
|
||||||
tcName.append("/*");
|
tcName.append("/*");
|
||||||
|
else if (boostItem->state().testFlag(BoostTestTreeItem::Parameterized))
|
||||||
|
tcName.append('*');
|
||||||
else if (boostItem->state().testFlag(BoostTestTreeItem::Templated))
|
else if (boostItem->state().testFlag(BoostTestTreeItem::Templated))
|
||||||
tcName.append("<*");
|
tcName.append("<*");
|
||||||
testCases.append(boostItem->prependWithParentsSuitePaths(tcName));
|
testCases.append(boostItem->prependWithParentsSuitePaths(tcName));
|
||||||
@@ -281,6 +285,8 @@ TestConfiguration *BoostTestTreeItem::testConfiguration() const
|
|||||||
QString tcName = name();
|
QString tcName = name();
|
||||||
if (state().testFlag(BoostTestTreeItem::Templated))
|
if (state().testFlag(BoostTestTreeItem::Templated))
|
||||||
tcName.append("<*");
|
tcName.append("<*");
|
||||||
|
else if (state().testFlag(BoostTestTreeItem::Parameterized))
|
||||||
|
tcName.append('*');
|
||||||
testCases.append(prependWithParentsSuitePaths(handleSpecialFunctionNames(tcName)));
|
testCases.append(prependWithParentsSuitePaths(handleSpecialFunctionNames(tcName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user