================
@@ -159,110 +171,96 @@ def test_set_and_clear(self):
lines.remove(second_line)
# Set 2 breakpoints and verify that the previous breakpoints that were
# set above are still set.
- response = self.dap_server.request_setBreakpoints(
- Source.build(path=self.main_path), lines
- )
- breakpoints = response["body"]["breakpoints"]
+ response = session.set_source_breakpoints(self.main_path, lines)
+ breakpoints = response.body.breakpoints
self.assertEqual(
- len(breakpoints),
- len(lines),
- "expect %u source breakpoints" % (len(lines)),
+ len(breakpoints), len(lines), f"expect {len(lines)} source
breakpoints"
)
- for index, breakpoint in enumerate(breakpoints):
- line = breakpoint["line"]
- self.assertEqual(line, lines[index])
+ for expected_line, breakpoint in zip(lines, breakpoints):
+ line = self.expect_not_none(breakpoint.line)
+ self.assertEqual(line, expected_line)
# Verify the same breakpoints are still set within LLDB by
- # making sure the breakpoint ID didn't change
+ # making sure the breakpoint ID didn't change.
self.assertEqual(
line_to_id[line],
- breakpoint["id"],
+ breakpoint.id,
"verify previous breakpoints stayed the same",
)
- self.assertTrue(breakpoint["verified"], "expect breakpoint still
verified")
+ self.assertTrue(breakpoint.verified, "expect breakpoint still
verified")
# Now get the full list of breakpoints set in the target and verify
# we have only 2 breakpoints set. The response above could have told
# us about 2 breakpoints, but we want to make sure we don't have the
# third one still set in the target
- response = self.dap_server.request_testGetTargetBreakpoints()
- breakpoints = response["body"]["breakpoints"]
+ response =
session.send_request(DAPTestGetTargetBreakpointsArgs()).result()
+ breakpoints = response.body.breakpoints
self.assertEqual(
len(breakpoints),
len(lines),
- "expect %u source breakpoints" % (len(lines)),
+ f"expect {len(lines)} source breakpoints",
)
for breakpoint in breakpoints:
- line = breakpoint["line"]
+ line = self.expect_not_none(breakpoint.line)
# Verify the same breakpoints are still set within LLDB by
# making sure the breakpoint ID didn't change
self.assertEqual(
line_to_id[line],
- breakpoint["id"],
+ breakpoint.id,
"verify previous breakpoints stayed the same",
)
self.assertIn(line, lines, "line expected in lines array")
- self.assertTrue(breakpoint["verified"], "expect breakpoint still
verified")
+ self.assertTrue(breakpoint.verified, "expect breakpoint still
verified")
# Now clear all breakpoints for the source file by passing down an
- # empty lines array
+ # empty lines array.
lines = []
- response = self.dap_server.request_setBreakpoints(
- Source.build(path=self.main_path), lines
- )
- breakpoints = response["body"]["breakpoints"]
+ response = session.set_source_breakpoints(self.main_path, lines)
+ breakpoints = response.body.breakpoints
self.assertEqual(
len(breakpoints),
len(lines),
- "expect %u source breakpoints" % (len(lines)),
+ f"expect {len(lines)} source breakpoints",
)
# Verify with the target that all breakpoints have been cleared
- response = self.dap_server.request_testGetTargetBreakpoints()
- breakpoints = response["body"]["breakpoints"]
+ response =
session.send_request(DAPTestGetTargetBreakpointsArgs()).result()
----------------
DrSergei wrote:
Maybe we can create helper method to send this request
https://github.com/llvm/llvm-project/pull/208166
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits