mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-12 04:21:47 +03:00
f427955512
Remove all configure_files: - Move all tests to cpp files - Use the QTEST_MAIN macro instead of a generated main.cpp - Include test*.moc in the cpp to let CMAKE_AUTOMOC call moc - Pass info through add_definitions instead of generating oc_bin.h with them This makes sure that build errors points to the original test source file instead of the generated one in the build directory to be able to jump and fix errors directly from the IDE's error pane.
49 lines
1.5 KiB
C++
49 lines
1.5 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 "excludedfiles.h"
|
|
|
|
using namespace OCC;
|
|
|
|
#define STR_(X) #X
|
|
#define STR(X) STR_(X)
|
|
#define BIN_PATH STR(OWNCLOUD_BIN_PATH)
|
|
|
|
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", "b", keepHidden));
|
|
QVERIFY(!excluded.isExcluded("/a/b~", "b~", keepHidden));
|
|
QVERIFY(!excluded.isExcluded("/a/.b", ".b", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/.b", ".b", excludeHidden));
|
|
|
|
QString path(BIN_PATH);
|
|
path.append("/sync-exclude.lst");
|
|
excluded.addExcludeFilePath(path);
|
|
excluded.reloadExcludes();
|
|
|
|
QVERIFY(!excluded.isExcluded("/a/b", "b", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/b~", "b~", keepHidden));
|
|
QVERIFY(!excluded.isExcluded("/a/.b", ".b", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/.Trashes", ".Trashes", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/foo_conflict-bar", "foo_conflict-bar", keepHidden));
|
|
QVERIFY(excluded.isExcluded("/a/.b", ".b", excludeHidden));
|
|
}
|
|
};
|
|
|
|
QTEST_MAIN(TestExcludedFiles)
|
|
#include "testexcludedfiles.moc"
|