Remove a not required whitespace when writing JSON in compact format

Task-number: QTBUG-36682

Change-Id: I0c1c0de850504c8dff20a5ae724cc868d9f983f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2014-02-14 09:33:21 +01:00 committed by The Qt Project
parent 62f01d581b
commit 6de515aea2
2 changed files with 5 additions and 5 deletions

View File

@ -195,7 +195,7 @@ static void objectContentToJson(const QJsonPrivate::Object *o, QByteArray &json,
json += indentString;
json += '"';
json += escapedString(e->key());
json += "\": ";
json += compact ? "\":" : "\": ";
valueToJson(o, e->value, json, indent, compact);
if (++i == o->length) {

View File

@ -1209,7 +1209,7 @@ void tst_QtJson::toJson()
QByteArray json = QJsonDocument(object).toJson(QJsonDocument::Compact);
QByteArray expected =
"{\"Array\": [true,999,\"string\",null,\"\\\\\\u0007\\n\\r\\b\\tabcABC\\\"\"],\"\\\\Key\\n\": \"Value\",\"null\": null}";
"{\"Array\":[true,999,\"string\",null,\"\\\\\\u0007\\n\\r\\b\\tabcABC\\\"\"],\"\\\\Key\\n\":\"Value\",\"null\":null}";
QCOMPARE(json, expected);
QJsonDocument doc;
@ -2004,7 +2004,7 @@ void tst_QtJson::testDebugStream()
qDebug() << object;
object.insert(QLatin1String("foo"), QLatin1String("bar"));
QTest::ignoreMessage(QtDebugMsg, "QJsonObject({\"foo\": \"bar\"})");
QTest::ignoreMessage(QtDebugMsg, "QJsonObject({\"foo\":\"bar\"})");
qDebug() << object;
}
@ -2031,7 +2031,7 @@ void tst_QtJson::testDebugStream()
QJsonObject object;
object.insert(QLatin1String("foo"), QLatin1String("bar"));
doc.setObject(object);
QTest::ignoreMessage(QtDebugMsg, "QJsonDocument({\"foo\": \"bar\"})");
QTest::ignoreMessage(QtDebugMsg, "QJsonDocument({\"foo\":\"bar\"})");
qDebug() << doc;
QJsonArray array;
@ -2076,7 +2076,7 @@ void tst_QtJson::testDebugStream()
QJsonObject object;
object.insert(QLatin1String("foo"), QLatin1String("bar"));
value = QJsonValue(object); // object
QTest::ignoreMessage(QtDebugMsg, "QJsonValue(object, QJsonObject({\"foo\": \"bar\"}) )");
QTest::ignoreMessage(QtDebugMsg, "QJsonValue(object, QJsonObject({\"foo\":\"bar\"}) )");
qDebug() << value;
}
}