tst_QDnsLookup: Use a different character from space in TXT multi

When in commit db15341d273730298ab5af03b59e9ea1cca782be I added support
for testing TXT, I used the space character to make it easy to
concatenate the records. Unfortunately, that means it's easy to false-
positive the test by creating one record with a single entry containing
a space instead of two entries.

So use the NULL character instead.

Change-Id: Ia0aac2f09e9245339951ffff13c7d239ea83583d
Reviewed-by: Jeremy Lainé <jeremy.laine@m4x.org>
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Thiago Macieira 2015-03-02 15:29:13 -08:00
parent e1c99e15b6
commit 7b2a1aec03

View File

@ -166,7 +166,8 @@ void tst_QDnsLookup::lookup_data()
QTest::newRow("txt-empty") << int(QDnsLookup::TXT) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << "";
QTest::newRow("txt-notfound") << int(QDnsLookup::TXT) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << "";
QTest::newRow("txt-single") << int(QDnsLookup::TXT) << "txt-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << "Hello";
QTest::newRow("txt-multi-onerr") << int(QDnsLookup::TXT) << "txt-multi-onerr" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << "Hello World";
QTest::newRow("txt-multi-onerr") << int(QDnsLookup::TXT) << "txt-multi-onerr" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << ""
<< QString::fromLatin1("Hello\0World", sizeof("Hello\0World") - 1);
QTest::newRow("txt-multi-multirr") << int(QDnsLookup::TXT) << "txt-multi-multirr" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << "Hello;World";
}
@ -315,7 +316,7 @@ void tst_QDnsLookup::lookup()
QString text;
foreach (const QByteArray &ba, record.values()) {
if (!text.isEmpty())
text += ' ';
text += '\0';
text += QString::fromLatin1(ba);
}
texts << text;