From 10ed50002c2ad6f4caaa7b922af5a9f1d3d91f52 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 4 Sep 2012 20:32:33 +0200 Subject: [PATCH] test: Check for null string comparison Do not compare a QString to QString(). Instead use the .isEmpty() method. Change-Id: I8bb5e64563bf173abe7288bb9e35375bee1fe445 Reviewed-by: Thiago Macieira --- .../network/socket/qlocalsocket/tst_qlocalsocket.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index c0dc3e1b52..a26e0b4175 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -259,7 +259,7 @@ void tst_QLocalSocket::socket_basic() socket.close(); socket.disconnectFromServer(); QCOMPARE(QLocalSocket::UnknownSocketError, socket.error()); - QVERIFY(socket.errorString() != QString()); + QVERIFY(!socket.errorString().isEmpty()); QCOMPARE(socket.flush(), false); QCOMPARE(socket.isValid(), false); QVERIFY(socket.readBufferSize() == 0); @@ -307,12 +307,12 @@ void tst_QLocalSocket::listen() QCOMPARE(server.hits.count(), 0); QCOMPARE(spyNewConnection.count(), 0); if (canListen) { - QVERIFY(server.errorString() == QString()); + QVERIFY(server.errorString().isEmpty()); QCOMPARE(server.serverError(), QAbstractSocket::UnknownSocketError); // already isListening QVERIFY(!server.listen(name)); } else { - QVERIFY(server.errorString() != QString()); + QVERIFY(!server.errorString().isEmpty()); QCOMPARE(server.serverError(), QAbstractSocket::HostNotFoundError); } QCOMPARE(server.maxPendingConnections(), 30); @@ -379,7 +379,7 @@ void tst_QLocalSocket::listenAndConnect() //QVERIFY(socket->socketDescriptor() != -1); QCOMPARE(spyError.count(), 0); } else { - QVERIFY(socket->errorString() != QString()); + QVERIFY(!socket->errorString().isEmpty()); QVERIFY(socket->error() != QLocalSocket::UnknownSocketError); QCOMPARE(socket->state(), QLocalSocket::UnconnectedState); //QVERIFY(socket->socketDescriptor() == -1); @@ -434,7 +434,7 @@ void tst_QLocalSocket::listenAndConnect() QVERIFY(server.nextPendingConnection() != (QLocalSocket*)0); QTRY_COMPARE(server.hits.count(), i + 1); QCOMPARE(spyNewConnection.count(), i + 1); - QVERIFY(server.errorString() == QString()); + QVERIFY(server.errorString().isEmpty()); QCOMPARE(server.serverError(), QAbstractSocket::UnknownSocketError); } else { QVERIFY(server.serverName().isEmpty()); @@ -442,7 +442,7 @@ void tst_QLocalSocket::listenAndConnect() QVERIFY(server.nextPendingConnection() == (QLocalSocket*)0); QCOMPARE(spyNewConnection.count(), 0); QCOMPARE(server.hits.count(), 0); - QVERIFY(server.errorString() != QString()); + QVERIFY(!server.errorString().isEmpty()); QCOMPARE(server.serverError(), QAbstractSocket::HostNotFoundError); } }