From c20824f5ff77ecb8fee9ed480a124f4d41faa0fa Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 3 Jun 2019 14:18:48 +0200 Subject: [PATCH] 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 --- src/plugins/autotest/boost/boostcodeparser.cpp | 9 +++++++++ src/plugins/autotest/boost/boosttestparser.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/autotest/boost/boostcodeparser.cpp b/src/plugins/autotest/boost/boostcodeparser.cpp index 95d8ac6be6b..f15b8307d4d 100644 --- a/src/plugins/autotest/boost/boostcodeparser.cpp +++ b/src/plugins/autotest/boost/boostcodeparser.cpp @@ -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; diff --git a/src/plugins/autotest/boost/boosttestparser.cpp b/src/plugins/autotest/boost/boosttestparser.cpp index e1e87ab2993..0d349de40a1 100644 --- a/src/plugins/autotest/boost/boosttestparser.cpp +++ b/src/plugins/autotest/boost/boosttestparser.cpp @@ -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)