Skip to content

Commit

Permalink
Replace aAsConst with std::as_const in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra authored and mgallien committed Dec 11, 2024
1 parent e94deb2 commit c48550d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions test/syncenginetestutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ void FakePutMultiFileReply::respond()
totalSize += fileInfo->size;
});

for(auto fileInfo : qAsConst(_allFileInfo)) {
for(auto fileInfo : std::as_const(_allFileInfo)) {
QJsonObject fileInfoReply;
fileInfoReply.insert("error", QStringLiteral("false"));
fileInfoReply.insert("etag", QLatin1String{fileInfo->etag});
Expand Down Expand Up @@ -1045,12 +1045,12 @@ QJsonObject FakeQNAM::forEachReplyPart(QIODevice *outgoingData,
const QString boundaryValue = QStringLiteral("--") + contentType.mid(boundaryPosition, contentType.length() - boundaryPosition - 1) + QStringLiteral("\r\n");
auto stringPutPayloadRef = QString{stringPutPayload}.left(stringPutPayload.size() - 2 - boundaryValue.size());
auto allParts = stringPutPayloadRef.split(boundaryValue, Qt::SkipEmptyParts);
for (const auto &onePart : qAsConst(allParts)) {
for (const auto &onePart : std::as_const(allParts)) {
auto headerEndPosition = onePart.indexOf(QStringLiteral("\r\n\r\n"));
auto onePartHeaderPart = onePart.left(headerEndPosition);
auto onePartHeaders = onePartHeaderPart.split(QStringLiteral("\r\n"));
QMap<QString, QByteArray> allHeaders;
for(const auto &oneHeader : qAsConst(onePartHeaders)) {
for(const auto &oneHeader : std::as_const(onePartHeaders)) {
auto headerParts = oneHeader.split(QStringLiteral(": "));
allHeaders[headerParts.at(0).toLower()] = headerParts.at(1).toLatin1();
}
Expand Down
2 changes: 1 addition & 1 deletion test/testsyncconflict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool expectAndWipeConflict(FileModifier &local, FileInfo state, const QString pa
auto base = state.find(pathComponents.parentDirComponents());
if (!base)
return false;
for (const auto &item : qAsConst(base->children)) {
for (const auto &item : std::as_const(base->children)) {
if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("(conflicted copy")) {
local.remove(item.path());
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/testsyncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bool expectConflict(FileInfo state, const QString path)
auto base = state.find(pathComponents.parentDirComponents());
if (!base)
return false;
for (const auto &item : qAsConst(base->children)) {
for (const auto &item : std::as_const(base->children)) {
if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("(case clash from")) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions test/testsyncjournaldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ private slots:
<< "foo bla bar/file"
<< "fo_"
<< "fo_/file";
for (const auto& elem : qAsConst(elements)) {
for (const auto& elem : std::as_const(elements)) {
makeEntry(elem);
}

auto checkElements = [&]() {
bool ok = true;
for (const auto& elem : qAsConst(elements)) {
for (const auto& elem : std::as_const(elements)) {
SyncJournalFileRecord record;
if (!_db.getFileRecord(elem, &record) || !record.isValid()) {
qWarning() << "Missing record: " << elem;
Expand Down
4 changes: 2 additions & 2 deletions test/testsyncmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool expectAndWipeConflict(FileModifier &local, FileInfo state, const QString pa
auto base = state.find(pathComponents.parentDirComponents());
if (!base)
return false;
for (const auto &item : qAsConst(base->children)) {
for (const auto &item : std::as_const(base->children)) {
if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("(conflicted copy")) {
local.remove(item.path());
return true;
Expand Down Expand Up @@ -669,7 +669,7 @@ private slots:
}
conflicts = findConflicts(currentLocal.children["B4"]);
QCOMPARE(conflicts.size(), 1);
for (const auto& c : qAsConst(conflicts)) {
for (const auto& c : std::as_const(conflicts)) {
QCOMPARE(currentLocal.find(c)->contentChar, 'L');
local.remove(c);
}
Expand Down
2 changes: 1 addition & 1 deletion test/testsyncvirtualfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ bool expectConflict(FileInfo state, const QString path)
auto base = state.find(pathComponents.parentDirComponents());
if (!base)
return false;
for (const auto &item : qAsConst(base->children)) {
for (const auto &item : std::as_const(base->children)) {
if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("(case clash from")) {
return true;
}
Expand Down

0 comments on commit c48550d

Please sign in to comment.