Make TestGitStorage::testGitStorageLocal parametrizable

Make use of QTest "Data Driven Testing",
allowing to test multiple repo base path values.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
This commit is contained in:
Jeremie Guichard 2017-02-24 14:02:32 +07:00 committed by Dirk Hohndel
parent 56d31c9c1b
commit 5640a6a839
2 changed files with 9 additions and 1 deletions

View file

@ -59,13 +59,20 @@ void TestGitStorage::testSetup()
QCOMPARE(localCacheDirectory.removeRecursively(), true);
}
void TestGitStorage::testGitStorageLocal_data()
{
// test different path we may encounter (since storage depends on user name)
QTest::addColumn<QString>("testDirName");
QTest::newRow("ASCII path") << "./gittest";
}
void TestGitStorage::testGitStorageLocal()
{
// test writing and reading back from local git storage
git_repository *repo;
git_libgit2_init();
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf"), 0);
QString testDirName("./gittest");
QFETCH(QString, testDirName);
QDir testDir(testDirName);
QCOMPARE(testDir.removeRecursively(), true);
QCOMPARE(QDir().mkdir(testDirName), true);

View file

@ -8,6 +8,7 @@ class TestGitStorage : public QObject
Q_OBJECT
private slots:
void testSetup();
void testGitStorageLocal_data();
void testGitStorageLocal();
void testGitStorageCloud();
void testGitStorageCloudOfflineSync();