summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-03-31 12:47:33 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-04-06 12:06:18 +0000
commite1e6506c8dec6d0fc0fdbb15cfde43e7c0277403 (patch)
treee9e3602783a576ca9c8d1e867098fd2024677635 /tests
parent0a5b6106799b25cfd1ab9de2e74098e99a8b13cb (diff)
QString: add QStringView/QLatin1String overload of (non-multi) arg()
Use the new overload directly in QXmlStream*. Saves 129B in QtCore text size on optimized GCC 6.1 Linux AMD64 builds, even though we added two more functions. [ChangeLog][QtCore][QString] Added arg(QStringView), arg(QLatin1String) overloads. Change-Id: Idf7236dcab763824593f34182e4e0b16b5ed4321 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 3f118d04ce..4a82d952ab 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -4726,8 +4726,8 @@ void tst_QString::arg()
QString s14( "%1%2%3" );
QCOMPARE( s4.arg("foo"), QLatin1String("[foo]") );
- QCOMPARE( s5.arg("foo"), QLatin1String("[foo]") );
- QCOMPARE( s6.arg("foo"), QLatin1String("[foo]") );
+ QCOMPARE( s5.arg(QLatin1String("foo")), QLatin1String("[foo]") );
+ QCOMPARE( s6.arg(QStringViewLiteral("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]") );
@@ -4788,11 +4788,11 @@ void tst_QString::arg()
QCOMPARE( QString("%%%1%%%2").arg("foo").arg("bar"), QLatin1String("%%foo%%bar") );
QCOMPARE( QString("%1").arg("hello", -10), QLatin1String("hello ") );
- QCOMPARE( QString("%1").arg("hello", -5), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg("hello", -2), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QLatin1String("hello"), -5), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QStringViewLiteral("hello"), -2), QLatin1String("hello") );
QCOMPARE( QString("%1").arg("hello", 0), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg("hello", 2), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg("hello", 5), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QLatin1String("hello"), 2), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QStringViewLiteral("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") );