summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-08 19:56:03 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-10 11:38:18 +0200
commitc832d51555420c2ca62d60506079314f7db15755 (patch)
tree80a69833ec2942a5a4ec1588e85550eb306f3ae2 /tests
parente75636ecf4cb6408cda3873974b18967bc1bcb3b (diff)
Port from container::count() and length() to size() - V4
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I9635ce1b96e5788e63a5b8d56ab226ffaf0270e7 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp b/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp
index 92ae153..9a66efe 100644
--- a/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp
+++ b/tests/auto/oauthhttpserverreplyhandler/tst_oauthhttpserverreplyhandler.cpp
@@ -33,7 +33,7 @@ void tst_QOAuthHttpServerReplyHandler::callback()
QVERIFY(parameters.contains(item.first));
QCOMPARE(parameters[item.first].toString(), item.second);
}
- count = parameters.count();
+ count = parameters.size();
eventLoop.quit();
});