mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2024-11-26 13:42:45 +01:00
1940c2f9bf
fopen does not work well with relative path tand forward slashes on windows This fix the windows textexcludedfiles test. And also make the code simpler. Note that the 'trimmed' might be a behavior change, but i think it is ok
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
/*
|
|
* This software is in the public domain, furnished "as is", without technical
|
|
* support, and with no warranty, express or implied, as to its usefulness for
|
|
* any purpose.
|
|
*
|
|
*/
|
|
|
|
#include <QtTest>
|
|
|
|
#include "csync_exclude.h"
|
|
|
|
using namespace OCC;
|
|
|
|
#define EXCLUDE_LIST_FILE SOURCEDIR "/../../sync-exclude.lst"
|
|
|
|
class TestExcludedFiles: public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
void testFun()
|
|
{
|
|
ExcludedFiles excluded;
|
|
bool excludeHidden = true;
|
|
bool keepHidden = false;
|
|
|
|
QVERIFY(!excluded.isExcluded("/a/b", "/a", keepHidden));
|
|
QVERIFY(!excluded.isExcluded("/a/b~", "/a", keepHidden));
|
|
QVERIFY(!excluded.isExcluded("/a/.b", "/a", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/.b", "/a", excludeHidden));
|
|
|
|
excluded.addExcludeFilePath(EXCLUDE_LIST_FILE);
|
|
excluded.reloadExcludeFiles();
|
|
|
|
QVERIFY(!excluded.isExcluded("/a/b", "/a", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/b~", "/a", keepHidden));
|
|
QVERIFY(!excluded.isExcluded("/a/.b", "/a", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/.Trashes", "/a", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/foo_conflict-bar", "/a", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/.b", "/a", excludeHidden));
|
|
}
|
|
};
|
|
|
|
QTEST_APPLESS_MAIN(TestExcludedFiles)
|
|
#include "testexcludedfiles.moc"
|