Skip to content
Snippets Groups Projects
Commit 42c083cd authored by Bill King's avatar Bill King
Browse files

tests: fixes compile

parent 9532d4a3
No related branches found
No related tags found
No related merge requests found
...@@ -46,30 +46,30 @@ void tst_StringUtils::testWithTildeHomePath() ...@@ -46,30 +46,30 @@ void tst_StringUtils::testWithTildeHomePath()
{ {
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
// home path itself // home path itself
QCOMPARE(Utils::withTildeHomePath(QDir::homePath()), QLatin1String("~")); QCOMPARE(Utils::withTildeHomePath(QDir::homePath()), QString::fromLatin1("~"));
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1Char('/')), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1Char('/')),
QLatin1String("~")); QString::fromLatin1("~"));
QCOMPARE(Utils::withTildeHomePath(QLatin1String("/unclean/..") + QDir::homePath()), QCOMPARE(Utils::withTildeHomePath(QString::fromLatin1("/unclean/..") + QDir::homePath()),
QLatin1String("~")); QString::fromLatin1("~"));
// sub of home path // sub of home path
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/foo")), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/foo")),
QLatin1String("~/foo")); QString::fromLatin1("~/foo"));
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/foo/")), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/foo/")),
QLatin1String("~/foo")); QString::fromLatin1("~/foo"));
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/some/path/file.txt")), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/some/path/file.txt")),
QLatin1String("~/some/path/file.txt")); QString::fromLatin1("~/some/path/file.txt"));
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/some/unclean/../path/file.txt")), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/some/unclean/../path/file.txt")),
QLatin1String("~/some/path/file.txt")); QString::fromLatin1("~/some/path/file.txt"));
// not sub of home path // not sub of home path
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/../foo")), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/../foo")),
QString(QDir::homePath() + QLatin1String("/../foo"))); QString(QDir::homePath() + QString::fromLatin1("/../foo")));
#else #else
// windows: should return same as input // windows: should return same as input
QCOMPARE(Utils::withTildeHomePath(QDir::homePath()), QDir::homePath()); QCOMPARE(Utils::withTildeHomePath(QDir::homePath()), QDir::homePath());
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/foo")), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/foo")),
QDir::homePath() + QLatin1String("/foo")); QDir::homePath() + QString::fromLatin1("/foo"));
QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/../foo")), QCOMPARE(Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/../foo")),
Utils::withTildeHomePath(QDir::homePath() + QLatin1String("/../foo"))); Utils::withTildeHomePath(QDir::homePath() + QString::fromLatin1("/../foo")));
#endif #endif
} }
......
...@@ -3,6 +3,8 @@ DEFINES += QTCREATOR_UTILS_LIB ...@@ -3,6 +3,8 @@ DEFINES += QTCREATOR_UTILS_LIB
UTILS_PATH = ../../../src/libs/utils UTILS_PATH = ../../../src/libs/utils
DEFINES -= QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
INCLUDEPATH += $$UTILS_PATH INCLUDEPATH += $$UTILS_PATH
# Input # Input
SOURCES += tst_stringutils.cpp \ SOURCES += tst_stringutils.cpp \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment