From 5640a6a83951faefda0f22594044a34cb385e9fd Mon Sep 17 00:00:00 2001 From: Jeremie Guichard Date: Fri, 24 Feb 2017 14:02:32 +0700 Subject: Make TestGitStorage::testGitStorageLocal parametrizable Make use of QTest "Data Driven Testing", allowing to test multiple repo base path values. Signed-off-by: Jeremie Guichard --- tests/testgitstorage.cpp | 9 ++++++++- tests/testgitstorage.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp index 1fd2ffcba..080ba49c3 100644 --- a/tests/testgitstorage.cpp +++ b/tests/testgitstorage.cpp @@ -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("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); diff --git a/tests/testgitstorage.h b/tests/testgitstorage.h index ef1dacd9e..e71e1f809 100644 --- a/tests/testgitstorage.h +++ b/tests/testgitstorage.h @@ -8,6 +8,7 @@ class TestGitStorage : public QObject Q_OBJECT private slots: void testSetup(); + void testGitStorageLocal_data(); void testGitStorageLocal(); void testGitStorageCloud(); void testGitStorageCloudOfflineSync(); -- cgit v1.2.3-70-g09d2