Fix most qjsonbinding auto tests
authorLars Knoll <lars.knoll@digia.com>
Mon, 17 Jun 2013 07:18:19 +0000 (09:18 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Mon, 17 Jun 2013 09:43:48 +0000 (11:43 +0200)
Change-Id: I67476bc7e931e2f4790e859d4a3c00c050752271
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/qml/v4/qv4jsonobject.cpp
tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp

index 45fe90d..1d83a0d 100644 (file)
@@ -345,7 +345,7 @@ bool JsonParser::parseValue(Value *val)
 
     switch ((json++)->unicode()) {
     case 'n':
-        if (end - json < 4) {
+        if (end - json < 3) {
             lastError = QJsonParseError::IllegalValue;
             return false;
         }
@@ -360,7 +360,7 @@ bool JsonParser::parseValue(Value *val)
         lastError = QJsonParseError::IllegalValue;
         return false;
     case 't':
-        if (end - json < 4) {
+        if (end - json < 3) {
             lastError = QJsonParseError::IllegalValue;
             return false;
         }
@@ -375,7 +375,7 @@ bool JsonParser::parseValue(Value *val)
         lastError = QJsonParseError::IllegalValue;
         return false;
     case 'f':
-        if (end - json < 5) {
+        if (end - json < 4) {
             lastError = QJsonParseError::IllegalValue;
             return false;
         }
@@ -1007,6 +1007,7 @@ QV4::Value JsonObject::fromJsonArray(ExecutionEngine *engine, const QJsonArray &
     a->arrayReserve(size);
     for (int i = 0; i < size; i++)
         a->arrayData[i].value = fromJsonValue(engine, array.at(i));
+    a->arrayDataLen = size;
     a->setArrayLengthUnchecked(size);
     return Value::fromObject(a);
 }
index b891921..e6b056f 100644 (file)
@@ -457,13 +457,13 @@ void tst_qjsonbinding::writeProperty_javascriptExpression_data()
             << "array" << "(function() { var a = [10, 20]; a.__proto__ = { proto_foo: 123 }; return a; })()"
             << "[10,20]";
 
-    // Non-enumerable properties should be included.
+    // Non-enumerable properties should not be included.
     QTest::newRow("value = object with non-enumerable property")
             << "value" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })"
-            << "{\"foo\":123}";
+            << "{}";
     QTest::newRow("object = object with non-enumerable property")
             << "object" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })"
-            << "{\"foo\":123}";
+            << "{}";
 
     // Cyclic data structures are permitted, but the cyclic links become
     // empty objects.