summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp25
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 18480cc..5e42921a 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2756,6 +2756,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();