summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptengine
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-17 11:37:48 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-17 11:37:48 (GMT)
commit55e4d1453f6ddbca69599047f5638ca2cd63bd0c (patch)
tree5692542a26cc184ce40a33cf235f1d236474c133 /tests/auto/qscriptengine
parent525251ecded0a57e6b456cc787094a5703d7ff13 (diff)
downloadQt-55e4d1453f6ddbca69599047f5638ca2cd63bd0c.zip
Qt-55e4d1453f6ddbca69599047f5638ca2cd63bd0c.tar.gz
Qt-55e4d1453f6ddbca69599047f5638ca2cd63bd0c.tar.bz2
make QScriptValue::toString() et al work when there's an exception
JSC refuses to call functions when there's an exception that hasn't been dealt with, so save the exception and restore it afterwards.
Diffstat (limited to 'tests/auto/qscriptengine')
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index d477939..0d44a14 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -455,12 +455,11 @@ void tst_QScriptEngine::newRegExp()
QCOMPARE(rexp.isValid(), true);
QCOMPARE(rexp.isRegExp(), true);
QCOMPARE(rexp.isObject(), true);
- QEXPECT_FAIL("", "RegExp objects are functions in JSC (OK, I guess)", Continue);
- QVERIFY(!rexp.isFunction());
+ QVERIFY(rexp.isFunction()); // in JSC, RegExp objects are callable
// prototype should be RegExp.prototype
QCOMPARE(rexp.prototype().isValid(), true);
- QEXPECT_FAIL("", "prototype of a RegExp should also be a RegExp", Continue);
- QCOMPARE(rexp.prototype().isRegExp(), true);
+ QCOMPARE(rexp.prototype().isObject(), true);
+ QCOMPARE(rexp.prototype().isRegExp(), false);
QCOMPARE(rexp.prototype().strictlyEquals(eng.evaluate("RegExp.prototype")), true);
QCOMPARE(rexp.toRegExp().pattern(), QRegExp("foo").pattern());
@@ -477,7 +476,6 @@ void tst_QScriptEngine::newRegExp()
QScriptValue r3 = rxCtor.call(QScriptValue(), QScriptValueList() << r << "gim");
QVERIFY(r3.isError());
- QEXPECT_FAIL("", "Should give an error message ('Cannot supply flags when constructing one RegExp from another.')", Continue);
QCOMPARE(r3.toString(), QString::fromLatin1("TypeError: Cannot supply flags when constructing one RegExp from another."));
QScriptValue r4 = rxCtor.call(QScriptValue(), QScriptValueList() << "foo" << "gim");
@@ -485,9 +483,8 @@ void tst_QScriptEngine::newRegExp()
QScriptValue r5 = rxCtor.construct(QScriptValueList() << r);
QVERIFY(r5.isRegExp());
- QEXPECT_FAIL("", "regexp.toString() produces empty string", Continue);
QCOMPARE(r5.toString(), QString::fromLatin1("/foo/gim"));
- QEXPECT_FAIL("", "Constructing regexp with same pattern+flags twice gives identical object (not a bug?)", Continue);
+ QEXPECT_FAIL("", "Constructing regexp from another gives back identical object (bug in JSC?)", Continue);
QVERIFY(!r5.strictlyEquals(r));
QScriptValue r6 = rxCtor.construct(QScriptValueList() << "foo" << "bar");
@@ -1922,7 +1919,6 @@ void tst_QScriptEngine::castWithPrototypeChain()
{
QScriptValue ret = toBaz.call(scriptZoo, QScriptValueList() << baz2Value);
QVERIFY(ret.isError());
- QEXPECT_FAIL("", "Should give an error message ('Incompatible type of argument(s) ...')", Continue);
QCOMPARE(ret.toString(), QLatin1String("TypeError: incompatible type of argument(s) in call to toBaz(); candidates were\n toBaz(Bar*)"));
}