diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-07-27 17:07:08 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-07-27 17:07:08 (GMT) |
commit | 0a4579306706f1fbe91d8b54734491376cb92093 (patch) | |
tree | 9fe5bcfb91c204dfa23d0e871d72346f9ab440c5 | |
parent | a8dae30f3825d0527a38499e13bd8e36485aac47 (diff) | |
download | Qt-0a4579306706f1fbe91d8b54734491376cb92093.zip Qt-0a4579306706f1fbe91d8b54734491376cb92093.tar.gz Qt-0a4579306706f1fbe91d8b54734491376cb92093.tar.bz2 |
The line number is correctly reported for exception
Enable the tests checking the line number of exception.
Add a lower bound on the lineNumber of QScriptEngin::evaluate()
-rw-r--r-- | src/script/api/qscriptengine.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 6 |
2 files changed, 1 insertions, 6 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index fbc65d6..5cbb8d7 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2055,6 +2055,7 @@ QScriptSyntaxCheckResult QScriptEnginePrivate::checkSyntax(const QString &progra QScriptValue QScriptEngine::evaluate(const QString &program, const QString &fileName, int lineNumber) { Q_D(QScriptEngine); + lineNumber = qMax(lineNumber, 1); JSC::JSLock lock(false); // ### hmmm diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 997eb25..fed5a4c 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1302,7 +1302,6 @@ void tst_QScriptEngine::uncaughtException() { QScriptValue ret = eng.evaluate("a = 10;\nb = 20;\n0 = 0;\n", /*fileName=*/QString(), /*lineNumber=*/x); QVERIFY(eng.hasUncaughtException()); - QEXPECT_FAIL("", "Exception line number is wrong", Continue); QCOMPARE(eng.uncaughtExceptionLineNumber(), x+2); QVERIFY(eng.uncaughtException().strictlyEquals(ret)); (void)ret.toString(); @@ -1310,7 +1309,6 @@ void tst_QScriptEngine::uncaughtException() QVERIFY(eng.uncaughtException().strictlyEquals(ret)); QVERIFY(fun.call().isNull()); QVERIFY(eng.hasUncaughtException()); - QEXPECT_FAIL("", "Exception line number is wrong", Continue); QCOMPARE(eng.uncaughtExceptionLineNumber(), x+2); QVERIFY(eng.uncaughtException().strictlyEquals(ret)); eng.clearExceptions(); @@ -1324,7 +1322,6 @@ void tst_QScriptEngine::uncaughtException() QScriptValue ret2 = throwFun.call(); QVERIFY(ret2.isError()); QVERIFY(eng.hasUncaughtException()); - QEXPECT_FAIL("", "", Continue); QVERIFY(eng.uncaughtException().strictlyEquals(ret2)); QEXPECT_FAIL("", "Exception line number is wrong", Continue); QCOMPARE(eng.uncaughtExceptionLineNumber(), -1); @@ -1348,7 +1345,6 @@ void tst_QScriptEngine::uncaughtException() eng.globalObject().setProperty("throwFun", throwFun); eng.evaluate("1;\nthrowFun();"); QVERIFY(eng.hasUncaughtException()); - QEXPECT_FAIL("", "", Continue); QCOMPARE(eng.uncaughtExceptionLineNumber(), 2); eng.clearExceptions(); QVERIFY(!eng.hasUncaughtException()); @@ -1765,7 +1761,6 @@ void tst_QScriptEngine::importExtension() { QScriptEngine eng; QScriptValue ret = eng.importExtension("this.extension.does.not.exist"); - QEXPECT_FAIL("", "", Continue); QCOMPARE(eng.hasUncaughtException(), true); QCOMPARE(ret.isError(), true); QCOMPARE(ret.toString(), QString::fromLatin1("Error: Unable to import this.extension.does.not.exist: no such extension")); @@ -2048,7 +2043,6 @@ void tst_QScriptEngine::collectGarbage() QScriptValue v = eng.newQObject(ptr, QScriptEngine::ScriptOwnership); } eng.collectGarbage(); - QEXPECT_FAIL("", "", Continue); QVERIFY(ptr == 0); } |