MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / test_link_single_file

Method test_link_single_file

tests/FileSystem_test.cpp:592–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590 }
591
592 void test_link_single_file()
593 {
594 QTemporaryDir tempDir;
595 tempDir.setAutoRemove(true);
596
597 {
598 QString file = QFINDTESTDATA("testdata/FileSystem/test_folder/pack.mcmeta");
599
600 qDebug() << "From:" << file << "To:" << tempDir.path();
601
602 QDir target_dir(FS::PathCombine(tempDir.path(), "pack.mcmeta"));
603 qDebug() << tempDir.path();
604 qDebug() << target_dir.path();
605
606 LinkTask lnk_tsk(file, target_dir.filePath("pack.mcmeta"));
607 QObject::connect(&lnk_tsk, &Task::finished,
608 [&] { QVERIFY2(lnk_tsk.wasSuccessful(), "Task finished but was not successful when it should have been."); });
609 lnk_tsk.start();
610
611 QVERIFY2(QTest::qWaitFor([&]() { return lnk_tsk.isFinished(); }, 100000), "Task didn't finish as it should.");
612
613 auto filter = QDir::Filter::Files;
614
615 for (auto entry : target_dir.entryList(filter)) {
616 qDebug() << entry;
617 }
618
619 QFileInfo lnk_info(target_dir.filePath("pack.mcmeta"));
620 QVERIFY(lnk_info.exists());
621 QVERIFY(lnk_info.isSymLink());
622
623 QVERIFY(target_dir.entryList(filter).contains("pack.mcmeta"));
624 }
625 }
626
627 void test_link_with_max_depth()
628 {

Callers

nothing calls this directly

Calls 9

PathCombineFunction · 0.85
filePathMethod · 0.80
wasSuccessfulMethod · 0.80
isFinishedMethod · 0.80
existsMethod · 0.80
pathMethod · 0.45
startMethod · 0.45
isSymLinkMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected