Switched to using constants for status codes in tests.

This commit is contained in:
Nathan Osman
2015-07-08 17:02:21 -07:00
parent 89021152f1
commit cb5216ed71
2 changed files with 7 additions and 6 deletions

View File

@@ -68,15 +68,15 @@ void TestQFilesystemHandler::testRequests_data()
QTest::newRow("nonexistent resource")
<< "nonexistent"
<< 404;
<< static_cast<int>(QHttpSocket::NotFound);
QTest::newRow("outside document root")
<< "../outside"
<< 404;
<< static_cast<int>(QHttpSocket::NotFound);
QTest::newRow("inside document root")
<< "inside"
<< 200;
<< static_cast<int>(QHttpSocket::OK);
}
void TestQFilesystemHandler::testRequests()

View File

@@ -23,6 +23,7 @@
#include <QRegExp>
#include <QTest>
#include <QHttpSocket>
#include <QSubHandler>
#include "common/qsimplehttpclient.h"
@@ -64,19 +65,19 @@ void TestQSubHandler::testPatterns_data()
<< QRegExp("\\w+")
<< QByteArray("test")
<< QString("")
<< 200;
<< static_cast<int>(QHttpSocket::OK);
QTest::newRow("no match")
<< QRegExp("\\d+")
<< QByteArray("test")
<< QString("")
<< 404;
<< static_cast<int>(QHttpSocket::NotFound);
QTest::newRow("path")
<< QRegExp("one/")
<< QByteArray("one/two")
<< QString("two")
<< 200;
<< static_cast<int>(QHttpSocket::OK);
}
void TestQSubHandler::testPatterns()