summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-03-18 17:15:40 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-03-18 17:18:25 (GMT)
commitde6b46d64a193278f6f4c0d8967783d47f605ca0 (patch)
tree0783f5c63c04bd4527ee647acb735fb3824fc355 /tests/auto/qscriptvalue
parent9b4ca998930c7b81b72e5068b3ebae33907ac4b2 (diff)
downloadQt-de6b46d64a193278f6f4c0d8967783d47f605ca0.zip
Qt-de6b46d64a193278f6f4c0d8967783d47f605ca0.tar.gz
Qt-de6b46d64a193278f6f4c0d8967783d47f605ca0.tar.bz2
Don't assert in QScriptValue::call()
Oops, the case of a non-array object argument wasn't implemented nor tested in the new back-end. This commit brings it in line with the behavior of the old back-end. Also test that QScriptValue::construct() doesn't have the same problem. Reviewed-by: TrustMe
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index f83cf58..b2f6caf 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2571,6 +2571,10 @@ void tst_QScriptValue::call()
// call with something else as arguments
QScriptValue ret5 = fun.call(QScriptValue(), QScriptValue(&eng, 123.0));
QCOMPARE(ret5.isError(), true);
+ // call with a non-array object as arguments
+ QScriptValue ret6 = fun.call(QScriptValue(), eng.globalObject());
+ QVERIFY(ret6.isError());
+ QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array"));
}
// calling things that are not functions
@@ -2703,6 +2707,10 @@ void tst_QScriptValue::construct()
// construct with something else as arguments
QScriptValue ret5 = fun.construct(QScriptValue(&eng, 123.0));
QCOMPARE(ret5.isError(), true);
+ // construct with a non-array object as arguments
+ QScriptValue ret6 = fun.construct(eng.globalObject());
+ QVERIFY(ret6.isError());
+ QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array"));
}
// construct on things that are not functions