aboutsummaryrefslogtreecommitdiffstats
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-09 19:23:09 +0200
commitbfb3a3e2e7b5b563553fac3cdf9d06185b3284ac (patch)
tree7a7fba007ad97b4e62e13bde81e555b90c46dd5f /tests
parenta01b9dfc244aca91da35789333b088dc53b54994 (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: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qcoapclient/tst_qcoapclient.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/qcoapclient/tst_qcoapclient.cpp b/tests/auto/qcoapclient/tst_qcoapclient.cpp
index 613b314..ccdd01d 100644
--- a/tests/auto/qcoapclient/tst_qcoapclient.cpp
+++ b/tests/auto/qcoapclient/tst_qcoapclient.cpp
@@ -538,7 +538,7 @@ void tst_QCoapClient::multipleRequests()
}
for (const auto &signalSpy : signalSpies)
- QTRY_COMPARE(signalSpy->count(), 1);
+ QTRY_COMPARE(signalSpy->size(), 1);
QTRY_COMPARE(spyClientFinished.size(), 4);
for (uint8_t i = 0; i < requestCount; ++i) {