From 5586af99c15af8fef27bedfbf84a05d107b4320c Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 5 Dec 2014 13:58:22 +0100 Subject: QML Debugging: Fix breakpoints/stepping in a with-statement. Also fix the stack-trace generation, otherwise the debugger engine would report a breakpoint hit on the wrong line. Change-Id: I6eb4b508fbdca64d03badd8f9312a05c78781ded Reviewed-by: Simon Hausmann --- tests/auto/qml/qv4debugger/tst_qv4debugger.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp index fcbdcbc201..4d155cf012 100644 --- a/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/qv4debugger/tst_qv4debugger.cpp @@ -287,6 +287,7 @@ private slots: // exceptions: void pauseOnThrow(); void breakInCatch(); + void breakInWith(); void evaluateExpression(); @@ -632,6 +633,23 @@ void tst_qv4debugger::breakInCatch() QCOMPARE(state.lineNumber, 4); } +void tst_qv4debugger::breakInWith() +{ + QString script = + "with (42) {\n" + " console.log('give the answer');\n" + "}\n"; + + m_debuggerAgent->addBreakPoint("breakInWith", 2); + evaluateJavaScript(script, "breakInWith"); + QVERIFY(m_debuggerAgent->m_wasPaused); + QCOMPARE(m_debuggerAgent->m_pauseReason, BreakPoint); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QV4::Debugging::Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); + QCOMPARE(state.fileName, QString("breakInWith")); + QCOMPARE(state.lineNumber, 2); +} + void tst_qv4debugger::evaluateExpression() { QString script = -- cgit v1.2.3