NOISSUE tweak QCOMPARE vs QVERIFY
... the Qt test framework is annoyingly complicated and brittle. ... it may have to be replaced with something more reliable.
This commit is contained in:
parent
015c34bb38
commit
3aca4cbe20
@ -62,23 +62,23 @@ void PackageManifestTest::test_parse()
|
|||||||
{
|
{
|
||||||
auto manifest = Package::fromManifestContents(basic_manifest);
|
auto manifest = Package::fromManifestContents(basic_manifest);
|
||||||
QCOMPARE(manifest.valid, true);
|
QCOMPARE(manifest.valid, true);
|
||||||
QCOMPARE(manifest.files.size(), 1);
|
QVERIFY(manifest.files.size() == 1);
|
||||||
QCOMPARE(manifest.files.count(Path("a/b.txt")), 1);
|
QVERIFY(manifest.files.count(Path("a/b.txt")));
|
||||||
auto &file = manifest.files[Path("a/b.txt")];
|
auto &file = manifest.files[Path("a/b.txt")];
|
||||||
QCOMPARE(file.executable, true);
|
QCOMPARE(file.executable, true);
|
||||||
QCOMPARE(file.hash, "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
QCOMPARE(file.hash, "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
||||||
QCOMPARE(file.size, 0);
|
QCOMPARE(file.size, 0);
|
||||||
QCOMPARE(manifest.folders.size(), 4);
|
QVERIFY(manifest.folders.size() == 4);
|
||||||
QCOMPARE(manifest.folders.count(Path(".")), 1);
|
QVERIFY(manifest.folders.count(Path(".")));
|
||||||
QCOMPARE(manifest.folders.count(Path("a")), 1);
|
QVERIFY(manifest.folders.count(Path("a")));
|
||||||
QCOMPARE(manifest.folders.count(Path("a/b")), 1);
|
QVERIFY(manifest.folders.count(Path("a/b")));
|
||||||
QCOMPARE(manifest.folders.count(Path("a/b/c")), 1);
|
QVERIFY(manifest.folders.count(Path("a/b/c")));
|
||||||
QCOMPARE(manifest.symlinks.size(), 1);
|
QVERIFY(manifest.symlinks.size() == 1);
|
||||||
auto symlinkPath = Path("a/b/c.txt");
|
auto symlinkPath = Path("a/b/c.txt");
|
||||||
QCOMPARE(manifest.symlinks.count(symlinkPath), 1);
|
QVERIFY(manifest.symlinks.count(symlinkPath));
|
||||||
auto &symlink = manifest.symlinks[symlinkPath];
|
auto &symlink = manifest.symlinks[symlinkPath];
|
||||||
QCOMPARE(symlink, Path("../b.txt"));
|
QCOMPARE(symlink, Path("../b.txt"));
|
||||||
QCOMPARE(manifest.sources.size(), 1);
|
QVERIFY(manifest.sources.size() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::test_parse_file() {
|
void PackageManifestTest::test_parse_file() {
|
||||||
@ -91,17 +91,17 @@ void PackageManifestTest::test_inspect() {
|
|||||||
auto path = QFINDTESTDATA("testdata/inspect/");
|
auto path = QFINDTESTDATA("testdata/inspect/");
|
||||||
auto manifest = Package::fromInspectedFolder(path);
|
auto manifest = Package::fromInspectedFolder(path);
|
||||||
QCOMPARE(manifest.valid, true);
|
QCOMPARE(manifest.valid, true);
|
||||||
QCOMPARE(manifest.files.size(), 1);
|
QVERIFY(manifest.files.size() == 1);
|
||||||
QCOMPARE(manifest.files.count(Path("a/b.txt")), 1);
|
QVERIFY(manifest.files.count(Path("a/b.txt")));
|
||||||
auto &file = manifest.files[Path("a/b.txt")];
|
auto &file = manifest.files[Path("a/b.txt")];
|
||||||
QCOMPARE(file.executable, true);
|
QCOMPARE(file.executable, true);
|
||||||
QCOMPARE(file.hash, "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
QCOMPARE(file.hash, "da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
||||||
QCOMPARE(file.size, 0);
|
QCOMPARE(file.size, 0);
|
||||||
QCOMPARE(manifest.folders.size(), 3);
|
QVERIFY(manifest.folders.size() == 3);
|
||||||
QCOMPARE(manifest.folders.count(Path(".")), 1);
|
QVERIFY(manifest.folders.count(Path(".")));
|
||||||
QCOMPARE(manifest.folders.count(Path("a")), 1);
|
QVERIFY(manifest.folders.count(Path("a")));
|
||||||
QCOMPARE(manifest.folders.count(Path("a/b")), 1);
|
QVERIFY(manifest.folders.count(Path("a/b")));
|
||||||
QCOMPARE(manifest.symlinks.size(), 1);
|
QVERIFY(manifest.symlinks.size() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::test_diff() {
|
void PackageManifestTest::test_diff() {
|
||||||
@ -110,15 +110,15 @@ void PackageManifestTest::test_diff() {
|
|||||||
auto to = Package::fromManifestContents(basic_manifest);
|
auto to = Package::fromManifestContents(basic_manifest);
|
||||||
auto operations = UpdateOperations::resolve(from, to);
|
auto operations = UpdateOperations::resolve(from, to);
|
||||||
QCOMPARE(operations.valid, true);
|
QCOMPARE(operations.valid, true);
|
||||||
QCOMPARE(operations.mkdirs.size(), 1);
|
QVERIFY(operations.mkdirs.size() == 1);
|
||||||
QCOMPARE(operations.mkdirs[0], Path("a/b/c"));
|
QCOMPARE(operations.mkdirs[0], Path("a/b/c"));
|
||||||
|
|
||||||
QCOMPARE(operations.rmdirs.size(), 0);
|
QVERIFY(operations.rmdirs.size() == 0);
|
||||||
QCOMPARE(operations.deletes.size(), 1);
|
QVERIFY(operations.deletes.size() == 1);
|
||||||
QCOMPARE(operations.deletes[0], Path("a/b/b.txt"));
|
QCOMPARE(operations.deletes[0], Path("a/b/b.txt"));
|
||||||
QCOMPARE(operations.downloads.size(), 0);
|
QVERIFY(operations.downloads.size() == 0);
|
||||||
QCOMPARE(operations.mklinks.size(), 1);
|
QVERIFY(operations.mklinks.size() == 1);
|
||||||
QCOMPARE(operations.mklinks.count(Path("a/b/c.txt")), 1);
|
QVERIFY(operations.mklinks.count(Path("a/b/c.txt")));
|
||||||
QCOMPARE(operations.mklinks[Path("a/b/c.txt")], Path("../b.txt"));
|
QCOMPARE(operations.mklinks[Path("a/b/c.txt")], Path("../b.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,10 +135,10 @@ void PackageManifestTest::mkdir_deep() {
|
|||||||
}
|
}
|
||||||
)END");
|
)END");
|
||||||
auto operations = UpdateOperations::resolve(from, to);
|
auto operations = UpdateOperations::resolve(from, to);
|
||||||
QCOMPARE(operations.deletes.size(), 0);
|
QVERIFY(operations.deletes.size() == 0);
|
||||||
QCOMPARE(operations.rmdirs.size(), 0);
|
QVERIFY(operations.rmdirs.size() == 0);
|
||||||
|
|
||||||
QCOMPARE(operations.mkdirs.size(), 6);
|
QVERIFY(operations.mkdirs.size() == 6);
|
||||||
QCOMPARE(operations.mkdirs[0], Path("."));
|
QCOMPARE(operations.mkdirs[0], Path("."));
|
||||||
QCOMPARE(operations.mkdirs[1], Path("a"));
|
QCOMPARE(operations.mkdirs[1], Path("a"));
|
||||||
QCOMPARE(operations.mkdirs[2], Path("a/b"));
|
QCOMPARE(operations.mkdirs[2], Path("a/b"));
|
||||||
@ -146,9 +146,9 @@ void PackageManifestTest::mkdir_deep() {
|
|||||||
QCOMPARE(operations.mkdirs[4], Path("a/b/c/d"));
|
QCOMPARE(operations.mkdirs[4], Path("a/b/c/d"));
|
||||||
QCOMPARE(operations.mkdirs[5], Path("a/b/c/d/e"));
|
QCOMPARE(operations.mkdirs[5], Path("a/b/c/d/e"));
|
||||||
|
|
||||||
QCOMPARE(operations.downloads.size(), 0);
|
QVERIFY(operations.downloads.size() == 0);
|
||||||
QCOMPARE(operations.mklinks.size(), 0);
|
QVERIFY(operations.mklinks.size() == 0);
|
||||||
QCOMPARE(operations.executable_fixes.size(), 0);
|
QVERIFY(operations.executable_fixes.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::rmdir_deep() {
|
void PackageManifestTest::rmdir_deep() {
|
||||||
@ -164,9 +164,9 @@ void PackageManifestTest::rmdir_deep() {
|
|||||||
}
|
}
|
||||||
)END");
|
)END");
|
||||||
auto operations = UpdateOperations::resolve(from, to);
|
auto operations = UpdateOperations::resolve(from, to);
|
||||||
QCOMPARE(operations.deletes.size(), 0);
|
QVERIFY(operations.deletes.size() == 0);
|
||||||
|
|
||||||
QCOMPARE(operations.rmdirs.size(), 6);
|
QVERIFY(operations.rmdirs.size() == 6);
|
||||||
QCOMPARE(operations.rmdirs[0], Path("a/b/c/d/e"));
|
QCOMPARE(operations.rmdirs[0], Path("a/b/c/d/e"));
|
||||||
QCOMPARE(operations.rmdirs[1], Path("a/b/c/d"));
|
QCOMPARE(operations.rmdirs[1], Path("a/b/c/d"));
|
||||||
QCOMPARE(operations.rmdirs[2], Path("a/b/c"));
|
QCOMPARE(operations.rmdirs[2], Path("a/b/c"));
|
||||||
@ -174,10 +174,10 @@ void PackageManifestTest::rmdir_deep() {
|
|||||||
QCOMPARE(operations.rmdirs[4], Path("a"));
|
QCOMPARE(operations.rmdirs[4], Path("a"));
|
||||||
QCOMPARE(operations.rmdirs[5], Path("."));
|
QCOMPARE(operations.rmdirs[5], Path("."));
|
||||||
|
|
||||||
QCOMPARE(operations.mkdirs.size(), 0);
|
QVERIFY(operations.mkdirs.size() == 0);
|
||||||
QCOMPARE(operations.downloads.size(), 0);
|
QVERIFY(operations.downloads.size() == 0);
|
||||||
QCOMPARE(operations.mklinks.size(), 0);
|
QVERIFY(operations.mklinks.size() == 0);
|
||||||
QCOMPARE(operations.executable_fixes.size(), 0);
|
QVERIFY(operations.executable_fixes.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::identical_file() {
|
void PackageManifestTest::identical_file() {
|
||||||
@ -201,12 +201,12 @@ void PackageManifestTest::identical_file() {
|
|||||||
auto from = Package::fromManifestContents(manifest);
|
auto from = Package::fromManifestContents(manifest);
|
||||||
auto to = Package::fromManifestContents(manifest);
|
auto to = Package::fromManifestContents(manifest);
|
||||||
auto operations = UpdateOperations::resolve(from, to);
|
auto operations = UpdateOperations::resolve(from, to);
|
||||||
QCOMPARE(operations.deletes.size(), 0);
|
QVERIFY(operations.deletes.size() == 0);
|
||||||
QCOMPARE(operations.rmdirs.size(), 0);
|
QVERIFY(operations.rmdirs.size() == 0);
|
||||||
QCOMPARE(operations.mkdirs.size(), 0);
|
QVERIFY(operations.mkdirs.size() == 0);
|
||||||
QCOMPARE(operations.downloads.size(), 0);
|
QVERIFY(operations.downloads.size() == 0);
|
||||||
QCOMPARE(operations.mklinks.size(), 0);
|
QVERIFY(operations.mklinks.size() == 0);
|
||||||
QCOMPARE(operations.executable_fixes.size(), 0);
|
QVERIFY(operations.executable_fixes.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::changed_file() {
|
void PackageManifestTest::changed_file() {
|
||||||
@ -245,13 +245,13 @@ void PackageManifestTest::changed_file() {
|
|||||||
}
|
}
|
||||||
)END");
|
)END");
|
||||||
auto operations = UpdateOperations::resolve(from, to);
|
auto operations = UpdateOperations::resolve(from, to);
|
||||||
QCOMPARE(operations.deletes.size(), 1);
|
QVERIFY(operations.deletes.size() == 1);
|
||||||
QCOMPARE(operations.deletes[0], Path("a/b/c/d/file"));
|
QCOMPARE(operations.deletes[0], Path("a/b/c/d/file"));
|
||||||
QCOMPARE(operations.rmdirs.size(), 0);
|
QVERIFY(operations.rmdirs.size() == 0);
|
||||||
QCOMPARE(operations.mkdirs.size(), 0);
|
QVERIFY(operations.mkdirs.size() == 0);
|
||||||
QCOMPARE(operations.downloads.size(), 1);
|
QVERIFY(operations.downloads.size() == 1);
|
||||||
QCOMPARE(operations.mklinks.size(), 0);
|
QVERIFY(operations.mklinks.size() == 0);
|
||||||
QCOMPARE(operations.executable_fixes.size(), 0);
|
QVERIFY(operations.executable_fixes.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::added_file() {
|
void PackageManifestTest::added_file() {
|
||||||
@ -282,12 +282,12 @@ void PackageManifestTest::added_file() {
|
|||||||
}
|
}
|
||||||
)END");
|
)END");
|
||||||
auto operations = UpdateOperations::resolve(from, to);
|
auto operations = UpdateOperations::resolve(from, to);
|
||||||
QCOMPARE(operations.deletes.size(), 0);
|
QVERIFY(operations.deletes.size() == 0);
|
||||||
QCOMPARE(operations.rmdirs.size(), 0);
|
QVERIFY(operations.rmdirs.size() == 0);
|
||||||
QCOMPARE(operations.mkdirs.size(), 0);
|
QVERIFY(operations.mkdirs.size() == 0);
|
||||||
QCOMPARE(operations.downloads.size(), 1);
|
QVERIFY(operations.downloads.size() == 1);
|
||||||
QCOMPARE(operations.mklinks.size(), 0);
|
QVERIFY(operations.mklinks.size() == 0);
|
||||||
QCOMPARE(operations.executable_fixes.size(), 0);
|
QVERIFY(operations.executable_fixes.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageManifestTest::removed_file() {
|
void PackageManifestTest::removed_file() {
|
||||||
@ -318,13 +318,13 @@ void PackageManifestTest::removed_file() {
|
|||||||
}
|
}
|
||||||
)END");
|
)END");
|
||||||
auto operations = UpdateOperations::resolve(from, to);
|
auto operations = UpdateOperations::resolve(from, to);
|
||||||
QCOMPARE(operations.deletes.size(), 1);
|
QVERIFY(operations.deletes.size() == 1);
|
||||||
QCOMPARE(operations.deletes[0], Path("a/b/c/d/file"));
|
QCOMPARE(operations.deletes[0], Path("a/b/c/d/file"));
|
||||||
QCOMPARE(operations.rmdirs.size(), 0);
|
QVERIFY(operations.rmdirs.size() == 0);
|
||||||
QCOMPARE(operations.mkdirs.size(), 0);
|
QVERIFY(operations.mkdirs.size() == 0);
|
||||||
QCOMPARE(operations.downloads.size(), 0);
|
QVERIFY(operations.downloads.size() == 0);
|
||||||
QCOMPARE(operations.mklinks.size(), 0);
|
QVERIFY(operations.mklinks.size() == 0);
|
||||||
QCOMPARE(operations.executable_fixes.size(), 0);
|
QVERIFY(operations.executable_fixes.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_GUILESS_MAIN(PackageManifestTest)
|
QTEST_GUILESS_MAIN(PackageManifestTest)
|
||||||
|
Loading…
Reference in New Issue
Block a user