summaryrefslogtreecommitdiffstats
path: root/tests/auto/qurl
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-01-22 14:00:27 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-01-22 14:04:20 (GMT)
commit670f90b3068d530f14000eb816dd9ff38f9fb005 (patch)
treebc52714bce75cf01e7ccecbddae6643fdbcc4a3c /tests/auto/qurl
parentdf01c399c0d9f3412c872ad9ccb7342af0a44ea2 (diff)
downloadQt-670f90b3068d530f14000eb816dd9ff38f9fb005.zip
Qt-670f90b3068d530f14000eb816dd9ff38f9fb005.tar.gz
Qt-670f90b3068d530f14000eb816dd9ff38f9fb005.tar.bz2
Autotest: add a test for allowing hostnames ending in dot
Also, since domain is never empty, the idx > 0 test is unnecessary.
Diffstat (limited to 'tests/auto/qurl')
-rw-r--r--tests/auto/qurl/tst_qurl.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 33812fe..f108f4c 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -165,6 +165,8 @@ private slots:
void ace_testsuite();
void std3violations_data();
void std3violations();
+ void std3deviations_data();
+ void std3deviations();
void tldRestrictions_data();
void tldRestrictions();
void emptyQueryOrFragment();
@@ -3238,6 +3240,8 @@ void tst_QUrl::std3violations_data()
QTest::newRow("bang") << "foo!" << false;
QTest::newRow("plus") << "foo+bar" << false;
QTest::newRow("dot") << "foo.bar";
+ QTest::newRow("startingdot") << ".bar" << false;
+ QTest::newRow("startingdot2") << ".example.com" << false;
QTest::newRow("slash") << "foo/bar" << true;
QTest::newRow("colon") << "foo:80" << true;
QTest::newRow("question") << "foo?bar" << true;
@@ -3282,6 +3286,24 @@ void tst_QUrl::std3violations()
QVERIFY(!url.isValid());
}
+void tst_QUrl::std3deviations_data()
+{
+ QTest::addColumn<QString>("source");
+
+ QTest::newRow("ending-dot") << "example.com.";
+ QTest::newRow("ending-dot3002") << QString("example.com") + QChar(0x3002);
+}
+
+void tst_QUrl::std3deviations()
+{
+ QFETCH(QString, source);
+ QVERIFY(!QUrl::toAce(source).isEmpty());
+
+ QUrl url;
+ url.setHost(source);
+ QVERIFY(!url.host().isEmpty());
+}
+
void tst_QUrl::tldRestrictions_data()
{
QTest::addColumn<QString>("tld");