diff options
author | Ryan Cao <70191398+ryanccn@users.noreply.github.com> | 2022-11-21 23:19:50 +0800 |
---|---|---|
committer | Ryan Cao <70191398+ryanccn@users.noreply.github.com> | 2022-11-21 23:19:50 +0800 |
commit | f916ce875266ea2070c10f80ded35b66d315418c (patch) | |
tree | 5aa0caaac52847222a23482ff5fba7b41fca0f26 /tests | |
parent | 7096f02b88e982df6c770113146a07874a1e9d0f (diff) | |
parent | 5cc91965d09070437af8c17113c5740401b127dd (diff) | |
download | PrismLauncher-f916ce875266ea2070c10f80ded35b66d315418c.tar.gz PrismLauncher-f916ce875266ea2070c10f80ded35b66d315418c.tar.bz2 PrismLauncher-f916ce875266ea2070c10f80ded35b66d315418c.zip |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into import-resource-pack-dialog-uwu
Diffstat (limited to 'tests')
-rw-r--r-- | tests/FileSystem_test.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/FileSystem_test.cpp b/tests/FileSystem_test.cpp index 21270f6f..3a5c38d0 100644 --- a/tests/FileSystem_test.cpp +++ b/tests/FileSystem_test.cpp @@ -126,7 +126,7 @@ slots: qDebug() << tempDir.path(); qDebug() << target_dir.path(); FS::copy c(folder, target_dir.path()); - c.blacklist(new RegexpMatcher("[.]?mcmeta")); + c.matcher(new RegexpMatcher("[.]?mcmeta")); c(); for(auto entry: target_dir.entryList()) @@ -147,6 +147,41 @@ slots: f(); } + void test_copy_with_whitelist() + { + 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.matcher(new RegexpMatcher("[.]?mcmeta")); + c.whitelist(true); + 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_copy_with_dot_hidden() { QString folder = QFINDTESTDATA("testdata/FileSystem/test_folder"); |