diff options
| author | Linus Jahn <lnj@kaidan.im> | 2021-07-31 12:49:59 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2021-08-01 17:31:51 +0200 |
| commit | 95795726ade8071fea23dee83b6a6c5a9c122fee (patch) | |
| tree | d7a29bec3079005c23d4406556b915f34db26f19 /tests/util.h | |
| parent | 3041ac29ecaf9d72393b9dc1b28faa44201cf44b (diff) | |
| download | qxmpp-95795726ade8071fea23dee83b6a6c5a9c122fee.tar.gz | |
tests: util: Allow using ' instead of " in xml
serializePacket now accepts both `'` and `"`.
Diffstat (limited to 'tests/util.h')
| -rw-r--r-- | tests/util.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/util.h b/tests/util.h index 49f8e4d3..63b7a5dc 100644 --- a/tests/util.h +++ b/tests/util.h @@ -53,7 +53,9 @@ static QByteArray packetToXml(const T &packet) buffer.open(QIODevice::ReadWrite); QXmlStreamWriter writer(&buffer); packet.toXml(&writer); - return buffer.data(); + auto data = buffer.data(); + data.replace(u'\'', "'"); + return data; } template<class T> @@ -66,10 +68,13 @@ static void parsePacket(T &packet, const QByteArray &xml) template<class T> static void serializePacket(T &packet, const QByteArray &xml) { + auto processedXml = xml; + processedXml.replace(u'\'', u'"'); + const auto data = packetToXml(packet); - qDebug() << "expect " << xml; + qDebug() << "expect " << processedXml; qDebug() << "writing" << data; - QCOMPARE(data, xml); + QCOMPARE(data, processedXml); } template<class T> |
