diff options
author | Lorn Potter <lorn.potter@nokia.com> | 2010-11-09 01:23:37 (GMT) |
---|---|---|
committer | Lorn Potter <lorn.potter@nokia.com> | 2010-11-09 01:23:37 (GMT) |
commit | 6b8a95b2521d843ec2b3f7c787c15b92e4ea686f (patch) | |
tree | 346bc8925d83b2729f485d1259729fca931de07d /tests/auto/qscriptvalue | |
parent | bb8f085611f4cb91b7bde7220d407948edcc572c (diff) | |
parent | e00af84cc9230df411981d2f3b9296b61d5d1c50 (diff) | |
download | Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.zip Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.tar.gz Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 25 | ||||
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 83a3388..639df36 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2739,6 +2739,31 @@ void tst_QScriptValue::construct() QVERIFY(!QScriptValue(QScriptValue::NullValue).construct().isValid()); } +void tst_QScriptValue::construct_constructorThrowsPrimitive() +{ + QScriptEngine eng; + QScriptValue fun = eng.evaluate("(function() { throw 123; })"); + QVERIFY(fun.isFunction()); + // construct(QScriptValueList) + { + QScriptValue ret = fun.construct(); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toNumber(), 123.0); + QVERIFY(eng.hasUncaughtException()); + QVERIFY(ret.strictlyEquals(eng.uncaughtException())); + eng.clearExceptions(); + } + // construct(QScriptValue) + { + QScriptValue ret = fun.construct(eng.newArray()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toNumber(), 123.0); + QVERIFY(eng.hasUncaughtException()); + QVERIFY(ret.strictlyEquals(eng.uncaughtException())); + eng.clearExceptions(); + } +} + void tst_QScriptValue::lessThan_old() { QScriptEngine eng; diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h index 8bfaa6a..462749a 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.h +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h @@ -219,6 +219,7 @@ private slots: void getSetScriptClass(); void call(); void construct(); + void construct_constructorThrowsPrimitive(); void castToPointer(); void prettyPrinter_data(); void prettyPrinter(); |