diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-16 16:06:45 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-16 16:10:46 (GMT) |
commit | 6272ef01f0985fa22262733eddd37c3c39de0a1a (patch) | |
tree | 58d92bc03bb0d26833e081c2b284d8847bfdb856 /tests/auto/qscriptengine | |
parent | dbff4e318aaba904f0c7dbf7720954d3514c904a (diff) | |
download | Qt-6272ef01f0985fa22262733eddd37c3c39de0a1a.zip Qt-6272ef01f0985fa22262733eddd37c3c39de0a1a.tar.gz Qt-6272ef01f0985fa22262733eddd37c3c39de0a1a.tar.bz2 |
fix for-in statement autotest to match behavior in JSC
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index bc068cb..54e6033 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -2926,9 +2926,8 @@ void tst_QScriptEngine::forInStatement() QScriptValue ret = eng.evaluate("o = { p: 123 }; r = [];" "for (var p in o) { r[r.length] = p; o.q = 456; } r"); QStringList lst = qscriptvalue_cast<QStringList>(ret); - QCOMPARE(lst.size(), 2); + QCOMPARE(lst.size(), 1); QCOMPARE(lst.at(0), QString::fromLatin1("p")); - QCOMPARE(lst.at(1), QString::fromLatin1("q")); } // arrays @@ -2945,9 +2944,9 @@ void tst_QScriptEngine::forInStatement() "for (var p in a) r[r.length] = p; r"); QStringList lst = qscriptvalue_cast<QStringList>(ret); QCOMPARE(lst.size(), 3); - QCOMPARE(lst.at(0), QString::fromLatin1("foo")); - QCOMPARE(lst.at(1), QString::fromLatin1("0")); - QCOMPARE(lst.at(2), QString::fromLatin1("1")); + QCOMPARE(lst.at(0), QString::fromLatin1("0")); + QCOMPARE(lst.at(1), QString::fromLatin1("1")); + QCOMPARE(lst.at(2), QString::fromLatin1("foo")); } { QScriptValue ret = eng.evaluate("a = [123, 456]; a.foo = 'bar';" @@ -2956,10 +2955,11 @@ void tst_QScriptEngine::forInStatement() "for (var p in a) r[r.length] = p; r"); QStringList lst = qscriptvalue_cast<QStringList>(ret); QCOMPARE(lst.size(), 5); - QCOMPARE(lst.at(0), QString::fromLatin1("foo")); - QCOMPARE(lst.at(1), QString::fromLatin1("0")); - QCOMPARE(lst.at(2), QString::fromLatin1("1")); - QCOMPARE(lst.at(3), QString::fromLatin1("bar")); + QCOMPARE(lst.at(0), QString::fromLatin1("0")); + QCOMPARE(lst.at(1), QString::fromLatin1("1")); + QCOMPARE(lst.at(2), QString::fromLatin1("foo")); + QCOMPARE(lst.at(3), QString::fromLatin1("2")); + QCOMPARE(lst.at(4), QString::fromLatin1("bar")); } // null and undefined |