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

View File

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

View File

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