summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-10-04 18:55:29 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-10-08 14:11:23 +0000
commitbc099f33ddc03af48fcef226a6c95e7dd79a64d4 (patch)
tree7833771cef106aeb223d18c86b5f4c037a2a9a12 /tests
parentff7f09d18708119bebb94202d3a3dcb26149ee5a (diff)
Support QCborMap::operator[] taking a string literal
Use a template on the size of the char[], as suggested by Ville Voutilainen. This resolves ambiguity about whether such look-ups should be done via QString or QCborValue (not that it would have made any difference). When we come to add mutating indexing of QCborValue, chained dereferences like map[i][j][k] need to stay in operator[] const throughout, to avoid detaching intermediates to create references into them due to using the mutating operator[] on the earlier dereference's return. So const-qualify the QCborValue operator[] const variants at the same time, to match those of QCborValue itself. Change-Id: Ib1652ae9440fe3767a653afa2856b74040210e07 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
index b69c993efb..38b26e7de4 100644
--- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
+++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
@@ -413,6 +413,9 @@ void tst_QCborValue::mapDefaultInitialization()
QVERIFY(m.value(QLatin1String("Hello")).isUndefined());
QVERIFY(m.value(QStringLiteral("Hello")).isUndefined());
QVERIFY(m.value(QCborValue()).isUndefined());
+#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
+ QVERIFY(m.value("Hello").isUndefined());
+#endif
QVERIFY(m == m);
QVERIFY(m == QCborMap{});