diff options
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/json/bom.json | 3 | ||||
-rw-r--r-- | tests/auto/corelib/json/tst_qtjson.cpp | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/corelib/json/bom.json b/tests/auto/corelib/json/bom.json new file mode 100644 index 0000000000..d1e8d90e28 --- /dev/null +++ b/tests/auto/corelib/json/bom.json @@ -0,0 +1,3 @@ +{ + "info-version": "1.0" +} diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 7a11b5aec2..84913f9289 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -125,6 +125,8 @@ private Q_SLOTS: void testDetachBug(); void valueEquals(); + + void bom(); private: QString testDataDir; }; @@ -1908,5 +1910,19 @@ void TestQtJson::valueEquals() QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(QJsonArray())); } +void TestQtJson::bom() +{ + QFile file(testDataDir + "/bom.json"); + file.open(QFile::ReadOnly); + QByteArray json = file.readAll(); + + // Import json document into a QJsonDocument + QJsonParseError error; + QJsonDocument doc = QJsonDocument::fromJson(json, &error); + + QVERIFY(!doc.isNull()); + QVERIFY(error.error == QJsonParseError::NoError); +} + QTEST_MAIN(TestQtJson) #include "tst_qtjson.moc" |