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/qscriptengineagent/tst_qscriptengineagent.cpp | |
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/qscriptengineagent/tst_qscriptengineagent.cpp')
-rw-r--r-- | tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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 |