mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-17 03:11:51 +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.
45 lines
1.2 KiB
C++
45 lines
1.2 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 "utility.h"
|
|
#include "folder.h"
|
|
|
|
using namespace OCC;
|
|
|
|
class TestFolder: public QObject
|
|
{
|
|
Q_OBJECT
|
|
private slots:
|
|
void testFolder()
|
|
{
|
|
QFETCH(QString, folder);
|
|
QFETCH(QString, expectedFolder);
|
|
Folder *f = new Folder("alias", folder, "http://foo.bar.net");
|
|
QCOMPARE(f->path(), expectedFolder);
|
|
delete f;
|
|
}
|
|
|
|
void testFolder_data()
|
|
{
|
|
QTest::addColumn<QString>("folder");
|
|
QTest::addColumn<QString>("expectedFolder");
|
|
|
|
QTest::newRow("unixcase") << "/foo/bar" << "/foo/bar";
|
|
QTest::newRow("doubleslash") << "/foo//bar" << "/foo/bar";
|
|
QTest::newRow("tripleslash") << "/foo///bar" << "/foo/bar";
|
|
QTest::newRow("mixedslash") << "/foo/\\bar" << "/foo/bar";
|
|
QTest::newRow("windowsfwslash") << "C:/foo/bar" << "C:/foo/bar";
|
|
QTest::newRow("windowsbwslash") << "C:\\foo" << "C:/foo";
|
|
QTest::newRow("windowsbwslash2") << "C:\\foo\\bar" << "C:/foo/bar";
|
|
}
|
|
|
|
};
|
|
|
|
QTEST_MAIN(TestFolder)
|
|
#include "testfolder.moc"
|