aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-02-28 15:07:42 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-02-28 16:33:05 +0000
commitc67d33db5b4e78027181be492d4757ac786e5c1f (patch)
tree734f00bef97f9570e1e578aaa4bf0b5f7bb30cec /tests/auto/qml/debugger
parent5a9fd4f49ec48c91c70699fc40af8f843c51b4ab (diff)
Add a source location to the final Jump in a for loop
Otherwise it will assume the last statement as the location of the jump, and that might be a statement that is never hit. Task-number: QTBUG-59204 Change-Id: I66019a284b061358939b23e649ca0832b5442388 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/debugger')
-rw-r--r--tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
index 7668c8b016..8362cb9ed6 100644
--- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
@@ -327,6 +327,7 @@ private slots:
void evaluateExpression();
void stepToEndOfScript();
+ void lastLineOfLoop();
private:
QV4Debugger *debugger() const
@@ -786,6 +787,31 @@ void tst_qv4debugger::stepToEndOfScript()
QCOMPARE(state.lineNumber, -4); // A return instruction without proper line number.
}
+void tst_qv4debugger::lastLineOfLoop()
+{
+ QString script =
+ "var ret = 0;\n"
+ "for (var i = 0; i < 10; ++i) {\n"
+ " if (i == 2)\n"
+ " ret += 4;\n" // breakpoint, then step over
+ " else \n"
+ " ret += 1;\n"
+ "}\n"; // after step over
+
+ debugger()->addBreakPoint("trueBranch", 4);
+ m_debuggerAgent->m_resumeSpeed = QV4Debugger::StepOver;
+ evaluateJavaScript(script, "trueBranch");
+ QVERIFY(m_debuggerAgent->m_wasPaused);
+ QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::Step);
+ QVERIFY(m_debuggerAgent->m_statesWhenPaused.count() > 1);
+ QV4Debugger::ExecutionState firstState = m_debuggerAgent->m_statesWhenPaused.first();
+ QCOMPARE(firstState.fileName, QString("trueBranch"));
+ QCOMPARE(firstState.lineNumber, 4);
+ QV4Debugger::ExecutionState secondState = m_debuggerAgent->m_statesWhenPaused.at(1);
+ QCOMPARE(secondState.fileName, QString("trueBranch"));
+ QCOMPARE(secondState.lineNumber, 7);
+}
+
QTEST_MAIN(tst_qv4debugger)
#include "tst_qv4debugger.moc"