summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-02-01 15:32:55 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2022-02-10 19:20:59 +0100
commit35ec6283dc4741b39b0e3c32a7b9abe68c736b78 (patch)
tree02053b1acc8b8b64190738428eb0170d99da057f /tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
parent325303732923a74e843e4584fda106468dc46489 (diff)
Convert some QVERIFY2() with useless messages to QVERIFY()
Telling us the condition tested should have been true is what QVERIFY() does anyway, so don't go to the whole trouble of saying the same thing - and wrapping it in in a QString() merely in order to then qPrintable() it back out again, pointlessly converting a C-string to unicode and back again. At the same time, skip one other qPrintable(QString("...")) without .arg() formatting; and change the check it's the message for to use QL1S::arg() instead of QString::arg(). Change-Id: Ie71a79da8017916d301a38b69fc422e55a5a3649 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp')
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 0fcee19dba..8d2183512c 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -3045,21 +3045,18 @@ void tst_QSqlQuery::queryOnInvalidDatabase()
QRegularExpression("QSqlDatabase: available drivers: "));
#endif
QSqlDatabase db = QSqlDatabase::addDatabase( "INVALID", "invalidConnection" );
- QVERIFY2( db.lastError().isValid(),
- qPrintable( QString( "db.lastError().isValid() should be true!" ) ) );
+ QVERIFY(db.lastError().isValid());
QTest::ignoreMessage( QtWarningMsg, "QSqlQuery::exec: database not open" );
QSqlQuery query( "SELECT 1 AS ID", db );
- QVERIFY2( query.lastError().isValid(),
- qPrintable( QString( "query.lastError().isValid() should be true!" ) ) );
+ QVERIFY(query.lastError().isValid());
}
{
QSqlDatabase db = QSqlDatabase::database( "this connection does not exist" );
QTest::ignoreMessage( QtWarningMsg, "QSqlQuery::exec: database not open" );
QSqlQuery query( "SELECT 1 AS ID", db );
- QVERIFY2( query.lastError().isValid(),
- qPrintable( QString( "query.lastError().isValid() should be true!" ) ) );
+ QVERIFY(query.lastError().isValid());
}
}
@@ -3091,8 +3088,8 @@ void tst_QSqlQuery::createQueryOnClosedDatabase()
QCOMPARE( q.value( 2 ).toString().trimmed(), QLatin1String( "Char1" ) );
db.close();
- QVERIFY2( !q.exec( QString( "select * from %1 where id = 1" ).arg( qtest ) ),
- qPrintable( QString( "This can't happen! The query should not have been executed!" ) ) );
+ QVERIFY2(!q.exec(QLatin1String("select * from %1 where id = 1").arg(qtest)),
+ "This can't happen! The query should not have been executed!");
}
void tst_QSqlQuery::reExecutePreparedForwardOnlyQuery()