Vcpkg: Move test creation closer to tested code

Change-Id: Id135a9225bcc8806d89c7589d68f9c21200d9374
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-19 17:27:27 +01:00
parent 6e595d63a0
commit dbac3e9225
3 changed files with 19 additions and 21 deletions

View File

@@ -10,11 +10,16 @@
namespace Vcpkg::Internal {
VcpkgSearchTest::VcpkgSearchTest(QObject *parent)
: QObject(parent)
{ }
class VcpkgSearchTest : public QObject
{
Q_OBJECT
VcpkgSearchTest::~VcpkgSearchTest() = default;
private slots:
void testVcpkgJsonParser_data();
void testVcpkgJsonParser();
void testAddDependency_data();
void testAddDependency();
};
void VcpkgSearchTest::testVcpkgJsonParser_data()
{
@@ -178,4 +183,11 @@ void VcpkgSearchTest::testAddDependency()
QCOMPARE(QString::fromUtf8(result), modifiedVcpkgManifestJsonData);
}
QObject *createVcpkgSearchTest()
{
return new VcpkgSearchTest;
}
} // namespace Vcpkg::Internal
#include "vcpkg_test.moc"

View File

@@ -3,24 +3,10 @@
#pragma once
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/aspects.h>
#include <QObject>
namespace Vcpkg::Internal {
class VcpkgSearchTest : public QObject
{
Q_OBJECT
public:
VcpkgSearchTest(QObject *parent = nullptr);
~VcpkgSearchTest();
private slots:
void testVcpkgJsonParser_data();
void testVcpkgJsonParser();
void testAddDependency_data();
void testAddDependency();
};
QObject *createVcpkgSearchTest();
} // namespace Vcpkg::Internal

View File

@@ -26,7 +26,7 @@ public:
setupVcpkgManifestEditor();
#ifdef WITH_TESTS
addTest<VcpkgSearchTest>();
addTestCreator(createVcpkgSearchTest);
#endif
}