summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/json/tst_qtjson.cpp
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-03-16 10:01:29 +0100
committerKent Hansen <kent.hansen@nokia.com>2012-03-16 10:01:29 +0100
commit440f452aa3a5609e5f6006a03ac36d41462d5908 (patch)
tree598d682291945055e4f6feb08a228212648482c1 /tests/auto/corelib/json/tst_qtjson.cpp
parentcd1e62ffc121cc68c5a133a8095d431f04d966ce (diff)
parentd4959fa6376255ab4adf8adaeb2ee47ae6b679d2 (diff)
Merge master into api_changes
Conflicts: src/corelib/kernel/qmetatype.cpp src/gui/kernel/qplatformsurface_qpa.cpp tests/auto/corelib/tools/qtimeline/qtimeline.pro Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
Diffstat (limited to 'tests/auto/corelib/json/tst_qtjson.cpp')
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 079ff6e76b..87820d2e78 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -120,6 +120,8 @@ private Q_SLOTS:
void assignObjects();
void assignArrays();
+
+ void testTrailingComma();
private:
QString testDataDir;
};
@@ -1807,5 +1809,16 @@ void TestQtJson::assignArrays()
QCOMPARE(inner.at(0).toDouble(), 2.);
}
+void TestQtJson::testTrailingComma()
+{
+ const char *jsons[] = { "{ \"Key\": 1, }", "[ { \"Key\": 1 }, ]" };
+
+ for (unsigned i = 0; i < sizeof(jsons)/sizeof(jsons[0]); ++i) {
+ QJsonParseError error;
+ QJsonDocument doc = QJsonDocument::fromJson(jsons[i], &error);
+ QCOMPARE(error.error, QJsonParseError::MissingObject);
+ }
+}
+
QTEST_MAIN(TestQtJson)
#include "tst_qtjson.moc"