summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index 8dd2fc7..ca062ca 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -218,11 +218,17 @@ void tst_QScriptContext::arguments()
{
QScriptValue result = eng.evaluate(prefix+"get_argumentsObject(123)");
+ eng.evaluate("function nestedArg(x,y,z) { var w = get_argumentsObject('ABC' , x+y+z); return w; }");
+ QScriptValue result2 = eng.evaluate("nestedArg(1, 'a', 2)");
QCOMPARE(result.isArray(), false);
QVERIFY(result.isObject());
QCOMPARE(result.property("length").toUInt32(), quint32(1));
QCOMPARE(result.property("0").isNumber(), true);
QCOMPARE(result.property("0").toNumber(), 123.0);
+ QVERIFY(result2.isObject());
+ QCOMPARE(result2.property("length").toUInt32(), quint32(2));
+ QCOMPARE(result2.property("0").toString(), QString::fromLatin1("ABC"));
+ QCOMPARE(result2.property("1").toString(), QString::fromLatin1("1a2"));
}
{
@@ -842,7 +848,7 @@ void tst_QScriptContext::calledAsConstructor()
}
-static QScriptValue argumentsObjectInNative_test1(QScriptContext *ctx, QScriptEngine *)
+static QScriptValue argumentsObjectInNative_test1(QScriptContext *ctx, QScriptEngine *eng)
{
#define VERIFY(statement) \
do {\
@@ -854,6 +860,10 @@ static QScriptValue argumentsObjectInNative_test1(QScriptContext *ctx, QScriptEn
VERIFY(obj.isObject());
VERIFY(obj.property(0).toUInt32() == 123);
VERIFY(obj.property(1).toString() == QString::fromLatin1("456"));
+
+ obj.setProperty(0, "abc");
+ VERIFY(eng->evaluate("arguments[0]").toString() == QString::fromLatin1("abc") );
+
return QString::fromLatin1("success");
#undef VERIFY
}
@@ -870,9 +880,6 @@ void tst_QScriptContext::argumentsObjectInNative()
QVERIFY(!eng.hasUncaughtException());
QCOMPARE(result.toString(), QString::fromLatin1("success"));
}
-
-
-
{
QScriptEngine eng;
QScriptValue fun = eng.newFunction(argumentsObjectInNative_test1);