forked from qt-creator/qt-creator
AutoTest: Support data-driven test with fixture
Boost has a special macro to indicate a data-driven test with support for a fixture class. Find and handle these test cases as well. Change-Id: I9f3d22b7b2df35edfdf0a017da3005f67ade017f Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -112,6 +112,9 @@ void BoostCodeParser::handleIdentifier()
|
||||
handleTestCase(TestCaseType::Fixture);
|
||||
} else if (identifier == "BOOST_DATA_TEST_CASE") {
|
||||
handleTestCase(TestCaseType::Data);
|
||||
} else if (identifier == "BOOST_DATA_TEST_CASE_F") {
|
||||
m_currentState.setFlag(BoostTestTreeItem::Fixture);
|
||||
handleTestCase(TestCaseType::Data);
|
||||
} else if (identifier == "BOOST_TEST_DECORATOR") {
|
||||
handleDecorator();
|
||||
}
|
||||
@@ -195,6 +198,12 @@ void BoostCodeParser::handleTestCase(TestCaseType testCaseType)
|
||||
}
|
||||
if (testCaseType == TestCaseType::Parameter)
|
||||
m_currentState |= BoostTestTreeItem::Parameterized;
|
||||
} else if (m_currentState.testFlag(BoostTestTreeItem::Fixture)) {
|
||||
// ignore first parameter (fixture) and first comma
|
||||
if (!skipCommentsUntil(T_IDENTIFIER))
|
||||
return;
|
||||
if (!skipCommentsUntil(T_COMMA))
|
||||
return;
|
||||
}
|
||||
if (!skipCommentsUntil(T_IDENTIFIER))
|
||||
return;
|
||||
|
@@ -40,7 +40,7 @@ namespace BoostTestUtils {
|
||||
static const QStringList relevant = {
|
||||
QStringLiteral("BOOST_AUTO_TEST_CASE"), QStringLiteral("BOOST_TEST_CASE"),
|
||||
QStringLiteral("BOOST_DATA_TEST_CASE"), QStringLiteral("BOOST_FIXTURE_TEST_CASE"),
|
||||
QStringLiteral("BOOST_PARAM_TEST_CASE")
|
||||
QStringLiteral("BOOST_PARAM_TEST_CASE"), QStringLiteral("BOOST_DATA_TEST_CASE_F")
|
||||
};
|
||||
|
||||
bool isBoostTestMacro(const QString ¯o)
|
||||
|
Reference in New Issue
Block a user