diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-10-01 10:14:12 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-10-01 10:18:00 (GMT) |
commit | 0ae74e4c267c7b15a405240ec4dc038374d95bd2 (patch) | |
tree | 7a7ec615c1ed281af935680f11d334b4459dd6ca /tests/auto | |
parent | a9d47220b9f0936550522d9a34748692701a2acf (diff) | |
download | Qt-0ae74e4c267c7b15a405240ec4dc038374d95bd2.zip Qt-0ae74e4c267c7b15a405240ec4dc038374d95bd2.tar.gz Qt-0ae74e4c267c7b15a405240ec4dc038374d95bd2.tar.bz2 |
Fix column number provided to QScriptEngineAgent
Introduced a helper function in our custom source provider,
columnNumberFromOffset(), that maps an absolute offset in the source
input to a relative column number.
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 183aa3f..f2c7157 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1632,7 +1632,6 @@ void tst_QScriptEngine::errorMessage_QT679() engine.globalObject().setProperty("foo", 15); QScriptValue error = engine.evaluate("'hello world';\nfoo.bar.blah"); QVERIFY(error.isError()); - QEXPECT_FAIL("", "Task QT-679: the error message always contains the first line of the script, even if the error was on a different line", Continue); QCOMPARE(error.toString(), QString::fromLatin1("TypeError: Result of expression 'foo.bar' [undefined] is not an object.")); } diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 82bca8f..283e489 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -1193,10 +1193,15 @@ void tst_QScriptEngineAgent::positionChange_1() QCOMPARE(spy->at(0).columnNumber, 1); } - { + QStringList lineTerminators; + lineTerminators << "\n" << "\r" << "\n\r" << "\r\n"; + for (int i = 0; i < lineTerminators.size(); ++i) { spy->clear(); int lineNumber = 456; - eng.evaluate("1 + 2; 3 + 4;\n5 + 6", "foo.qs", lineNumber); + QString code = "1 + 2; 3 + 4;"; + code.append(lineTerminators.at(i)); + code.append("5 + 6"); + eng.evaluate(code, "foo.qs", lineNumber); QCOMPARE(spy->count(), 3); // 1 + 2 |