diff options
author | txtsd <thexerothermicsclerodermoid@gmail.com> | 2022-09-20 09:00:19 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-20 09:00:19 +0530 |
commit | fe9a4fece4ca4f7e0e808636ab099e0b91480efc (patch) | |
tree | 079780f6dc0d56e01c51056e8b312e232f39ed28 /tests/FileSystem_test.cpp | |
parent | 098327f12809ac584e9683acf69ed88b3325d050 (diff) | |
parent | 8c41ff68f7b09957c8b2f63c7dbdc1045a7fc756 (diff) | |
download | PrismLauncher-fe9a4fece4ca4f7e0e808636ab099e0b91480efc.tar.gz PrismLauncher-fe9a4fece4ca4f7e0e808636ab099e0b91480efc.tar.bz2 PrismLauncher-fe9a4fece4ca4f7e0e808636ab099e0b91480efc.zip |
Merge pull request #1142 from flowln/better_fs
Diffstat (limited to 'tests/FileSystem_test.cpp')
-rw-r--r-- | tests/FileSystem_test.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/FileSystem_test.cpp b/tests/FileSystem_test.cpp index 6df13e80..4efb90ac 100644 --- a/tests/FileSystem_test.cpp +++ b/tests/FileSystem_test.cpp @@ -4,6 +4,8 @@ #include <FileSystem.h> +#include <pathmatcher/RegexpMatcher.h> + class FileSystemTest : public QObject { Q_OBJECT @@ -111,6 +113,40 @@ slots: f(); } + void test_copy_with_blacklist() + { + QString folder = QFINDTESTDATA("testdata/FileSystem/test_folder"); + auto f = [&folder]() + { + QTemporaryDir tempDir; + tempDir.setAutoRemove(true); + qDebug() << "From:" << folder << "To:" << tempDir.path(); + + QDir target_dir(FS::PathCombine(tempDir.path(), "test_folder")); + qDebug() << tempDir.path(); + qDebug() << target_dir.path(); + FS::copy c(folder, target_dir.path()); + c.blacklist(new RegexpMatcher("[.]?mcmeta")); + c(); + + for(auto entry: target_dir.entryList()) + { + qDebug() << entry; + } + QVERIFY(!target_dir.entryList().contains("pack.mcmeta")); + QVERIFY(target_dir.entryList().contains("assets")); + }; + + // first try variant without trailing / + QVERIFY(!folder.endsWith('/')); + f(); + + // then variant with trailing / + folder.append('/'); + QVERIFY(folder.endsWith('/')); + f(); + } + void test_getDesktop() { QCOMPARE(FS::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)); |