summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-12-02 20:13:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-03 08:26:43 -0800
commitd775adfb290c91cf8423e1bf37b08d8bdcff24ea (patch)
tree0e2994e62f98fb88b6ed94fe80268f0457ac2764 /tests
parent78aface44aee20b2c894a738fdf0471f96e6dc0d (diff)
downloadsubsurface-d775adfb290c91cf8423e1bf37b08d8bdcff24ea.tar.gz
Add tests to read/write "file://..." style local git repositories
Requested-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/testgitstorage.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp
index 2d3814295..2f14b3f18 100644
--- a/tests/testgitstorage.cpp
+++ b/tests/testgitstorage.cpp
@@ -67,10 +67,17 @@ void TestGitStorage::cleanup()
void TestGitStorage::testGitStorageLocal_data()
{
- // test different path we may encounter (since storage depends on user name)
+ // Test different paths we may encounter (since storage depends on user name)
+ // as well as with and without "file://" URL prefix.
QTest::addColumn<QString>("testDirName");
- QTest::newRow("ASCII path") << "./gittest";
- QTest::newRow("Non ASCII path") << "./gittest_éèêôàüäößíñóúäåöø";
+ QTest::addColumn<QString>("prefixRead");
+ QTest::addColumn<QString>("prefixWrite");
+ QTest::newRow("ASCII path") << "./gittest" << "" << "";
+ QTest::newRow("Non ASCII path") << "./gittest_éèêôàüäößíñóúäåöø" << "" << "";
+ QTest::newRow("ASCII path with file:// prefix on read") << "./gittest2" << "file://" << "";
+ QTest::newRow("Non ASCII path with file:// prefix on read") << "./gittest2_éèêôàüäößíñóúäåöø" << "" << "file://";
+ QTest::newRow("ASCII path with file:// prefix on write") << "./gittest3" << "file://" << "";
+ QTest::newRow("Non ASCII path with file:// prefix on write") << "./gittest3_éèêôàüäößíñóúäåöø" << "" << "file://";
}
void TestGitStorage::testGitStorageLocal()
@@ -80,14 +87,18 @@ void TestGitStorage::testGitStorageLocal()
git_libgit2_init();
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf"), 0);
QFETCH(QString, testDirName);
+ QFETCH(QString, prefixRead);
+ QFETCH(QString, prefixWrite);
QDir testDir(testDirName);
QCOMPARE(testDir.removeRecursively(), true);
QCOMPARE(QDir().mkdir(testDirName), true);
+ QString repoNameRead = prefixRead + testDirName;
+ QString repoNameWrite = prefixWrite + testDirName;
QCOMPARE(git_repository_init(&repo, qUtf8Printable(testDirName), false), 0);
- QCOMPARE(save_dives(qUtf8Printable(testDirName + "[test]")), 0);
+ QCOMPARE(save_dives(qUtf8Printable(repoNameWrite + "[test]")), 0);
QCOMPARE(save_dives("./SampleDivesV3.ssrf"), 0);
clear_dive_file_data();
- QCOMPARE(parse_file(qUtf8Printable(testDirName + "[test]")), 0);
+ QCOMPARE(parse_file(qUtf8Printable(repoNameRead + "[test]")), 0);
QCOMPARE(save_dives("./SampleDivesV3viagit.ssrf"), 0);
QFile org("./SampleDivesV3.ssrf");
org.open(QFile::ReadOnly);