CMake: Split big plugin tests into smaller pieces

... which can then live closer to the tested code.

Change-Id: Icd975a76424ea2258c1bb93afdbaabdf1959340a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-12 12:52:29 +01:00
parent e0dae4d0b3
commit 446d79ad67
10 changed files with 144 additions and 119 deletions

View File

@@ -472,18 +472,24 @@ size_t qHash(const CMakeConfigItem &it)
return ::qHash(it.key) ^ ::qHash(it.value) ^ ::qHash(it.isUnset) ^ ::qHash(it.isInitial);
}
#if WITH_TESTS
} // namespace CMakeProjectManager
#include "cmakeprojectplugin.h"
#if WITH_TESTS
#include <QTest>
namespace CMakeProjectManager {
namespace Internal {
namespace CMakeProjectManager::Internal {
void CMakeProjectPlugin::testCMakeSplitValue_data()
class CMakeConfigTest final : public QObject
{
Q_OBJECT
private slots:
void testCMakeSplitValue_data();
void testCMakeSplitValue();
};
void CMakeConfigTest::testCMakeSplitValue_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<bool>("keepEmpty");
@@ -526,7 +532,7 @@ void CMakeProjectPlugin::testCMakeSplitValue_data()
<< "C:/something;;/second/path" << true << QStringList({"C:/something", "", "/second/path"});
}
void CMakeProjectPlugin::testCMakeSplitValue()
void CMakeConfigTest::testCMakeSplitValue()
{
QFETCH(QString, input);
QFETCH(bool, keepEmpty);
@@ -537,7 +543,13 @@ void CMakeProjectPlugin::testCMakeSplitValue()
QCOMPARE(expectedOutput, realOutput);
}
} // namespace Internal
QObject *createCMakeConfigTest()
{
return new CMakeConfigTest();
}
} // CMakeProjectManager::Internal
#endif
} // namespace CMakeProjectManager
#include "cmakeconfigitem.moc"