aboutsummaryrefslogtreecommitdiff
path: root/tests/FileSystem_test.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-11-21 12:14:49 +0100
committerGitHub <noreply@github.com>2022-11-21 12:14:49 +0100
commitc74f852364d512dd850111f92cc989c0c2ce7392 (patch)
tree7ae2a740b0195b0adcdbcd3460b5e75a68bc7b5d /tests/FileSystem_test.cpp
parent30607c34a153fd32085712e18827983772d77f7b (diff)
parentfe94c3609ef875166b71b9f6c540c45eff97a5ab (diff)
downloadPrismLauncher-c74f852364d512dd850111f92cc989c0c2ce7392.tar.gz
PrismLauncher-c74f852364d512dd850111f92cc989c0c2ce7392.tar.bz2
PrismLauncher-c74f852364d512dd850111f92cc989c0c2ce7392.zip
Merge pull request #243 from Scrumplex/migration-dialog
Closes https://github.com/PrismLauncher/PrismLauncher/issues/46 Closes https://github.com/PrismLauncher/PrismLauncher/issues/204
Diffstat (limited to 'tests/FileSystem_test.cpp')
-rw-r--r--tests/FileSystem_test.cpp37
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");