File: testfolder.cpp

package info (click to toggle)
owncloud-client 2.2.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,144 kB
  • ctags: 5,433
  • sloc: cpp: 35,894; ansic: 7,917; perl: 1,474; python: 217; ruby: 174; makefile: 38; sh: 23
file content (45 lines) | stat: -rw-r--r-- 1,263 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 *    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_APPLESS_MAIN(TestFolder)
#include "testfolder.moc"