Improve QString::arg test

The function gives a warning if an argument doesn't exist.

Change-Id: I6a4bbbaf2fd241ced06dc71edfe4ef69732606d1
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
This commit is contained in:
Jędrzej Nowacki 2014-07-09 17:04:41 +02:00
parent 3746eedeab
commit c587e5a4da

View File

@ -4170,11 +4170,17 @@ void tst_QString::arg()
QCOMPARE( s4.arg(Q_INT64_C(9223372036854775807)), // LLONG_MAX
QString("[9223372036854775807]") );
QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"\" , 0");
QCOMPARE( QString().arg(0), QString() );
QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"\" , 0");
QCOMPARE( QString("").arg(0), QString("") );
QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \" \" , 0");
QCOMPARE( QString(" ").arg(0), QString(" ") );
QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%\" , 0");
QCOMPARE( QString("%").arg(0), QString("%") );
QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%%\" , 0");
QCOMPARE( QString("%%").arg(0), QString("%%") );
QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%%%\" , 0");
QCOMPARE( QString("%%%").arg(0), QString("%%%") );
QCOMPARE( QString("%%%1%%%2").arg("foo").arg("bar"), QString("%%foo%%bar") );