forked from qt-creator/qt-creator
FilePath: Fix for operator+(QString)
Change-Id: I3b9889c8b2cdc8a9d1bf94c3e7a8627e2ff2ac35 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -977,9 +977,7 @@ bool FilePath::operator>=(const FilePath &other) const
|
|||||||
|
|
||||||
FilePath FilePath::operator+(const QString &s) const
|
FilePath FilePath::operator+(const QString &s) const
|
||||||
{
|
{
|
||||||
FilePath res = *this;
|
return pathAppended(s);
|
||||||
res.m_path += s;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \returns whether FilePath is a child of \a s
|
/// \returns whether FilePath is a child of \a s
|
||||||
|
@@ -85,6 +85,8 @@ private slots:
|
|||||||
void startsWithDriveLetter_data();
|
void startsWithDriveLetter_data();
|
||||||
void onDevice();
|
void onDevice();
|
||||||
void onDevice_data();
|
void onDevice_data();
|
||||||
|
void plus();
|
||||||
|
void plus_data();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTemporaryDir tempDir;
|
QTemporaryDir tempDir;
|
||||||
@@ -785,5 +787,23 @@ void tst_fileutils::onDevice() {
|
|||||||
QCOMPARE(path.onDevice(templatePath), expected);
|
QCOMPARE(path.onDevice(templatePath), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_fileutils::plus_data() {
|
||||||
|
tst_fileutils::pathAppended_data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_fileutils::plus()
|
||||||
|
{
|
||||||
|
QFETCH(QString, left);
|
||||||
|
QFETCH(QString, right);
|
||||||
|
QFETCH(QString, expected);
|
||||||
|
|
||||||
|
const FilePath fleft = FilePath::fromString(left);
|
||||||
|
const FilePath fexpected = FilePath::fromString(expected);
|
||||||
|
|
||||||
|
const FilePath result = fleft + right;
|
||||||
|
|
||||||
|
QCOMPARE(fexpected, result);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_GUILESS_MAIN(tst_fileutils)
|
QTEST_GUILESS_MAIN(tst_fileutils)
|
||||||
#include "tst_fileutils.moc"
|
#include "tst_fileutils.moc"
|
||||||
|
Reference in New Issue
Block a user