From 90a8b91b518f7fb1e9bed2700826ad172e362c31 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 28 Jul 2009 14:48:42 +0200 Subject: document test JavaScriptCore doesn't assign lineNumber when errors are not thrown --- tests/auto/qscriptengine/tst_qscriptengine.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 4886d7a..9959990 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -2704,18 +2704,22 @@ void tst_QScriptEngine::errorConstructors() QScriptEngine eng; QStringList prefixes; prefixes << "" << "Eval" << "Range" << "Reference" << "Syntax" << "Type" << "URI"; - for (int x = 0; x < 2; ++x) { + for (int x = 0; x < 3; ++x) { for (int i = 0; i < prefixes.size(); ++i) { QString name = prefixes.at(i) + QLatin1String("Error"); QString code = QString(i+1, QLatin1Char('\n')); if (x == 0) + code += QLatin1String("throw "); + else if (x == 1) code += QLatin1String("new "); code += name + QLatin1String("()"); QScriptValue ret = eng.evaluate(code); QVERIFY(ret.isError()); - QVERIFY(!eng.hasUncaughtException()); + QCOMPARE(eng.hasUncaughtException(), x == 0); + eng.clearExceptions(); QVERIFY(ret.toString().startsWith(name)); - QEXPECT_FAIL("", "in JSC, line number property is called 'line'", Continue); + if (x != 0) + QEXPECT_FAIL("", "JSC doesn't assign lineNumber when errors are not thrown", Continue); QCOMPARE(ret.property("lineNumber").toInt32(), i+2); } } -- cgit v0.12