summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-16 10:44:59 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-16 13:53:04 +0200
commitd72ff6ffd0e6f04dcd614b020f9abbe129615f8c (patch)
tree3cc9a4900f395cce76bf0dce82263f28b58bf350
parentc6b3680bcf433bc82219e787b80a2f3430706def (diff)
Fix some compiler warnings from tests
For iterators that return a value, don't use reference in ranged for, and cast numeric literal to correct size type for QCOMPARE. Change-Id: Idfd09dbc2ef3ab1bf025c7859ea6e2e9572bc9a1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp2
-rw-r--r--tests/auto/corelib/text/qstringview/tst_qstringview.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
index 13bf66022d..e3be6d3fab 100644
--- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
+++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
@@ -790,7 +790,7 @@ void tst_QCborValue::arrayInitializerList()
// range for
int i = 0;
- for (const QCborValue &v : qAsConst(a)) {
+ for (const QCborValue v : qAsConst(a)) {
QVERIFY(!v.isInvalid());
QCOMPARE(v.isUndefined(), i == 5); // 6th element is Undefined
++i;
diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
index b08d9ce8d9..c2a69c2a98 100644
--- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
+++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
@@ -426,9 +426,9 @@ void tst_QStringView::literals() const
}
// these are different results
- QCOMPARE(size_t(QStringView(withnull).size()), 1);
+ QCOMPARE(size_t(QStringView(withnull).size()), size_t(1));
QCOMPARE(size_t(QStringView::fromArray(withnull).size()), sizeof(withnull)/sizeof(withnull[0]));
- QCOMPARE(QStringView(withnull + 0).size(), 1);
+ QCOMPARE(QStringView(withnull + 0).size(), qsizetype(1));
}
void tst_QStringView::fromArray() const