summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp')
-rw-r--r--JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
index 753fcd0..72ca9b1 100644
--- a/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
+++ b/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
@@ -416,21 +416,48 @@ void tst_QScriptEngine::newArray()
QScriptEngine eng;
QScriptValue array = eng.newArray();
QCOMPARE(array.isValid(), true);
- // QCOMPARE(array.isArray(), true);
+ QCOMPARE(array.isArray(), true);
QCOMPARE(array.isObject(), true);
QVERIFY(!array.isFunction());
// QCOMPARE(array.scriptClass(), (QScriptClass*)0);
// Prototype should be Array.prototype.
QCOMPARE(array.prototype().isValid(), true);
- // QCOMPARE(array.prototype().isArray(), true);
+ QCOMPARE(array.prototype().isArray(), true);
QCOMPARE(array.prototype().strictlyEquals(eng.evaluate("Array.prototype")), true);
QScriptValue arrayWithSize = eng.newArray(42);
QCOMPARE(arrayWithSize.isValid(), true);
- // QCOMPARE(arrayWithSize.isArray(), true);
+ QCOMPARE(arrayWithSize.isArray(), true);
QCOMPARE(arrayWithSize.isObject(), true);
QCOMPARE(arrayWithSize.property("length").toInt32(), 42);
+
+ // task 218092
+ {
+ QScriptValue ret = eng.evaluate("[].splice(0, 0, 'a')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 0);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a'].splice(0, 1, 'b')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 1);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a', 'b'].splice(0, 1, 'c')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 1);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a', 'b', 'c'].splice(0, 2, 'd')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 2);
+ }
+ {
+ QScriptValue ret = eng.evaluate("['a', 'b', 'c'].splice(1, 2, 'd', 'e', 'f')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt32(), 2);
+ }
}
void tst_QScriptEngine::uncaughtException()