nextcloud-desktop/test/testexcludedfiles.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
C++
Raw Normal View History

2015-10-13 16:01:59 +03:00
/*
* 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 "excludedfiles.h"
using namespace OCC;
2017-08-14 20:19:52 +03:00
#define EXCLUDE_LIST_FILE SOURCEDIR"/../../sync-exclude.lst"
2015-10-13 16:01:59 +03:00
class TestExcludedFiles: public QObject
{
Q_OBJECT
private slots:
void testFun()
{
auto & excluded = ExcludedFiles::instance();
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));
2015-10-13 16:01:59 +03:00
excluded.addExcludeFilePath(EXCLUDE_LIST_FILE);
2015-10-13 16:01:59 +03:00
excluded.reloadExcludes();
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));
2015-10-13 16:01:59 +03:00
}
};
QTEST_APPLESS_MAIN(TestExcludedFiles)
#include "testexcludedfiles.moc"