diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-13 16:38:01 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-14 08:32:42 +0000 |
commit | f0a559f1c8dcf4b78c11853316919783823ded7a (patch) | |
tree | d5199ce97c70001b7db6cbba4082d8699c90abaf /tests/auto/network/socket/qsocks5socketengine | |
parent | a2a00eb044596f3e3f628b6b20b38a5ba524915c (diff) |
Tests: Use QCOMPARE() with QLatin1String() for QString values.
Prefer QCOMPARE over QVERIFY for equality and use QLatin1String().
Change-Id: If226a0fc7b25be3e6774c7e36ca1e6f99234e5dd
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto/network/socket/qsocks5socketengine')
-rw-r--r-- | tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index 8da656aab7..bd43961ea2 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -613,8 +613,8 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() // Read greeting QVERIFY(socket.waitForReadyRead(5000)); - QString s = socket.readLine(); - QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), s.toLatin1().constData()); + QByteArray s = socket.readLine(); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(s), s.constData()); // Write NOOP QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8); @@ -624,7 +624,7 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() // Read response s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "1 OK Completed\r\n"); + QCOMPARE(s, QByteArrayLiteral("1 OK Completed\r\n")); // Write LOGOUT QCOMPARE((int) socket.write("2 LOGOUT\r\n", 10), 10); @@ -634,13 +634,13 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() // Read two lines of respose s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "* BYE LOGOUT received\r\n"); + QCOMPARE(s, QByteArrayLiteral("* BYE LOGOUT received\r\n")); if (!socket.canReadLine()) QVERIFY(socket.waitForReadyRead(5000)); s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "2 OK Completed\r\n"); + QCOMPARE(s, QByteArrayLiteral("2 OK Completed\r\n")); // Close the socket socket.close(); @@ -715,7 +715,7 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() // Read response QVERIFY(!tcpSocketNonBlocking_data.isEmpty()); - QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), "1 OK Completed\r\n"); + QCOMPARE(tcpSocketNonBlocking_data.at(0), QLatin1String("1 OK Completed\r\n")); tcpSocketNonBlocking_data.clear(); |