summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-26 22:18:40 +0300
committerMarc Mutz <marc.mutz@kdab.com>2019-07-29 11:17:28 +0300
commitadab531771a1ddce7df6652449b7977f340ebfc7 (patch)
treee4373c2c618af1c0bd54178cf502f6ca2fd1be5c /tests/auto/corelib
parenteb39185acba01250240c289b1b3e64892f615357 (diff)
Port from QStringViewLiteral to u""
Now that all our supported compilers know char16_t, we no longer need QStringViewLiteral, whose only purpose in life was to turn u"" into L"" for MSVC < 2015. Change-Id: I25a094fe7992d9d5dbeb4a524d9e99e043dcb8ce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp2
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp2
-rw-r--r--tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp2
-rw-r--r--tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp2
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp4
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp6
-rw-r--r--tests/auto/corelib/text/qstringview/tst_qstringview.cpp12
7 files changed, 15 insertions, 15 deletions
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index 6cadebfd7f..78b6449a69 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -263,7 +263,7 @@ void tst_QTextCodec::fromUnicode()
If the encoding is a superset of ASCII, test that the byte
array is correct (no off by one, no trailing '\0').
*/
- QByteArray result = codec->fromUnicode(QStringViewLiteral("abc"));
+ QByteArray result = codec->fromUnicode(u"abc");
if (result.startsWith('a')) {
QCOMPARE(result.size(), 3);
QCOMPARE(result, QByteArray("abc"));
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index a818c6c09d..584e66a7db 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -506,7 +506,7 @@ void tst_QDebug::qDebugQStringView() const
{
QLatin1String file, function;
int line = 0;
- const QStringView inView = QStringViewLiteral("input");
+ const QStringView inView = u"input";
MessageHandlerSetter mhs(myMessageHandler);
{ qDebug() << inView; }
diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
index 569c610e24..b05c89a8bb 100644
--- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
+++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
@@ -65,7 +65,7 @@ void tst_QNoDebug::noDebugOutput() const
void tst_QNoDebug::streaming() const
{
QDateTime dt(QDate(1,2,3),QTime(4,5,6));
- const QByteArray debugString = dt.toString(QStringViewLiteral("yyyy-MM-dd HH:mm:ss.zzz t")).toLatin1();
+ const QByteArray debugString = dt.toString(u"yyyy-MM-dd HH:mm:ss.zzz t").toLatin1();
const QByteArray message = "QDateTime(" + debugString + " Qt::LocalTime)";
QTest::ignoreMessage(QtWarningMsg, message.constData());
qWarning() << dt;
diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
index 32306e8003..6381ce5ed0 100644
--- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
@@ -2586,7 +2586,7 @@ void tst_QTextStream::stringview_write_operator_ToDevice()
QBuffer buf;
buf.open(QBuffer::WriteOnly);
QTextStream stream(&buf);
- const QStringView expected = QStringViewLiteral("expectedStringView");
+ const QStringView expected = u"expectedStringView";
stream << expected;
stream.flush();
QCOMPARE(buf.buffer().constData(), "expectedStringView");
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index ec8f2fc047..676c66df3e 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -1459,8 +1459,8 @@ void tst_QLocale::dayOfWeek()
QCOMPARE(QLocale::c().toString(date, "ddd"), shortName);
QCOMPARE(QLocale::c().toString(date, "dddd"), longName);
- QCOMPARE(QLocale::c().toString(date, QStringViewLiteral("ddd")), shortName);
- QCOMPARE(QLocale::c().toString(date, QStringViewLiteral("dddd")), longName);
+ QCOMPARE(QLocale::c().toString(date, u"ddd"), shortName);
+ QCOMPARE(QLocale::c().toString(date, u"dddd"), longName);
}
void tst_QLocale::formatDate_data()
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index e4aa00f500..cce3e601cd 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -4763,7 +4763,7 @@ void tst_QString::arg()
QCOMPARE( s4.arg("foo"), QLatin1String("[foo]") );
QCOMPARE( s5.arg(QLatin1String("foo")), QLatin1String("[foo]") );
- QCOMPARE( s6.arg(QStringViewLiteral("foo")), QLatin1String("[foo]") );
+ QCOMPARE( s6.arg(u"foo"), QLatin1String("[foo]") );
QCOMPARE( s7.arg("foo"), QLatin1String("[foo]") );
QCOMPARE( s8.arg("foo"), QLatin1String("[foo %1]") );
QCOMPARE( s8.arg("foo").arg("bar"), QLatin1String("[foo bar]") );
@@ -4825,10 +4825,10 @@ void tst_QString::arg()
QCOMPARE( QString("%1").arg("hello", -10), QLatin1String("hello ") );
QCOMPARE( QString("%1").arg(QLatin1String("hello"), -5), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg(QStringViewLiteral("hello"), -2), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(u"hello", -2), QLatin1String("hello") );
QCOMPARE( QString("%1").arg("hello", 0), QLatin1String("hello") );
QCOMPARE( QString("%1").arg(QLatin1String("hello"), 2), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg(QStringViewLiteral("hello"), 5), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(u"hello", 5), QLatin1String("hello") );
QCOMPARE( QString("%1").arg("hello", 10), QLatin1String(" hello") );
QCOMPARE( QString("%1%1").arg("hello"), QLatin1String("hellohello") );
QCOMPARE( QString("%2%1").arg("hello"), QLatin1String("%2hello") );
diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
index 794f39708a..5d95f43d6a 100644
--- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
+++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
@@ -251,7 +251,7 @@ void tst_QStringView::constExpr() const
Q_STATIC_ASSERT(sv2.empty());
}
{
- constexpr QStringView sv = QStringViewLiteral("");
+ constexpr QStringView sv = u"";
Q_STATIC_ASSERT(sv.size() == 0);
Q_STATIC_ASSERT(!sv.isNull());
Q_STATIC_ASSERT(sv.empty());
@@ -263,7 +263,7 @@ void tst_QStringView::constExpr() const
Q_STATIC_ASSERT(sv2.empty());
}
{
- constexpr QStringView sv = QStringViewLiteral("Hello");
+ constexpr QStringView sv = u"Hello";
Q_STATIC_ASSERT(sv.size() == 5);
Q_STATIC_ASSERT(!sv.empty());
Q_STATIC_ASSERT(!sv.isEmpty());
@@ -465,7 +465,7 @@ void tst_QStringView::arg() const
#undef CHECK2
#undef CHECK1
- QCOMPARE(QStringViewLiteral(" %2 %2 %1 %3 ").arg(QLatin1Char('c'), QChar::CarriageReturn, u'C'), " \r \r c C ");
+ QCOMPARE(QStringView(u" %2 %2 %1 %3 ").arg(QLatin1Char('c'), QChar::CarriageReturn, u'C'), " \r \r c C ");
}
void tst_QStringView::fromQString() const
@@ -662,9 +662,9 @@ void tst_QStringView::conversion_tests(String string) const
void tst_QStringView::comparison()
{
- const QStringView aa = QStringViewLiteral("aa");
- const QStringView upperAa = QStringViewLiteral("AA");
- const QStringView bb = QStringViewLiteral("bb");
+ const QStringView aa = u"aa";
+ const QStringView upperAa = u"AA";
+ const QStringView bb = u"bb";
QVERIFY(aa == aa);
QVERIFY(aa != bb);