Commit 42c083cd authored by Bill King's avatar Bill King

tests: fixes compile

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