MCPcopy Create free account
hub / github.com/KDE/kdevelop / testVariablesLocalsStruct

Method testVariablesLocalsStruct

plugins/debuggercommon/tests/debuggertestbase.cpp:1689–1729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1687}
1688
1689void DebuggerTestBase::testVariablesLocalsStruct()
1690{
1691 auto* const session = createTestDebugSession();
1692 TestLaunchConfiguration cfg;
1693 session->variableController()->setAutoUpdate(IVariableController::UpdateLocals);
1694
1695 addDebugeeBreakpoint(39);
1696 ActiveStateSessionSpy sessionSpy(session);
1697 START_DEBUGGING_AND_WAIT_FOR_PAUSED_STATE_E(session, cfg, sessionSpy);
1698
1699 const auto i = variableCollection()->index(1, 0);
1700 QCOMPARE(variableCollection()->rowCount(i), 4);
1701
1702 auto structIndex = 0;
1703 for (auto j = 0; j < 3; ++j) {
1704 if (variableCollection()->index(j, 0, i).data().toString() == QLatin1String("ts")) {
1705 structIndex = j;
1706 }
1707 }
1708
1709 COMPARE_DATA(variableCollection()->index(structIndex, 0, i), "ts");
1710 COMPARE_DATA(variableCollection()->index(structIndex, 1, i), "{...}");
1711 const auto ts = variableCollection()->index(structIndex, 0, i);
1712 COMPARE_DATA(variableCollection()->index(0, 0, ts), "...");
1713
1714 EXPAND_VARIABLE_COLLECTION(ts);
1715 COMPARE_DATA(variableCollection()->index(0, 0, ts), "a");
1716 COMPARE_DATA(variableCollection()->index(0, 1, ts), "0");
1717 COMPARE_DATA(variableCollection()->index(1, 0, ts), "b");
1718 COMPARE_DATA(variableCollection()->index(1, 1, ts), "1");
1719 COMPARE_DATA(variableCollection()->index(2, 0, ts), "c");
1720 COMPARE_DATA(variableCollection()->index(2, 1, ts), "2");
1721
1722 STEP_INTO_AND_WAIT_FOR_PAUSED_STATE(session, sessionSpy);
1723 COMPARE_DATA(variableCollection()->index(structIndex, 0, i), "ts");
1724 COMPARE_DATA(variableCollection()->index(structIndex, 1, i), "{...}");
1725 COMPARE_DATA(variableCollection()->index(0, 1, ts), "1");
1726
1727 session->run();
1728 WAIT_FOR_STATE(session, IDebugSession::EndedState);
1729}
1730
1731void DebuggerTestBase::testVariablesWatches()
1732{

Callers

nothing calls this directly

Calls 8

variableCollectionFunction · 0.85
setAutoUpdateMethod · 0.80
variableControllerMethod · 0.45
indexMethod · 0.45
rowCountMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected