mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-01 11:29:32 +00:00
Add tests for list_breakpoints, minor changes
This commit is contained in:
parent
35307df2fc
commit
6b67749d50
@ -800,12 +800,13 @@ class Monitor(cmd.Cmd):
|
||||
self._output("Delete the breakpoint on execution marked by the given number")
|
||||
|
||||
def do_list_breakpoints(self, args):
|
||||
for (index, bp) in enumerate(self._breakpoints):
|
||||
if bp is None:
|
||||
continue
|
||||
label = self._address_parser.label_for(bp, '')
|
||||
output_string = "Breakpoint %d : $%04X %s" % (index, bp, label)
|
||||
self._output(output_string.strip())
|
||||
for i, address in enumerate(self._breakpoints):
|
||||
if address is not None:
|
||||
bpinfo = "Breakpoint %d: $%04X" % (i, address)
|
||||
label = self._address_parser.label_for(address)
|
||||
if label is not None:
|
||||
bpinfo += " " + label
|
||||
self._output(bpinfo)
|
||||
|
||||
def help_list_breakpoints(self):
|
||||
self._output("list_breakpoints")
|
||||
|
@ -507,6 +507,30 @@ class MonitorTests(unittest.TestCase):
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith("*** No help on foo"))
|
||||
|
||||
def test_shortcut_for_list_breakpoints(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
mon.do_help('lb')
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith('list_breakpoints'))
|
||||
|
||||
def test_list_breakpoints_shows_breakpoints(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
mon._breakpoints = [0xffd2]
|
||||
mon._address_parser.labels = {'chrout': 0xffd2}
|
||||
mon.do_list_breakpoints('')
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith("Breakpoint 0: $FFD2 chrout"))
|
||||
|
||||
def test_list_breakpoints_ignores_deleted_breakpoints(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
mon._breakpoints = [None, 0xffd2]
|
||||
mon.do_list_breakpoints('')
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith("Breakpoint 1: $FFD2"))
|
||||
|
||||
# load
|
||||
|
||||
def test_shortcut_for_load(self):
|
||||
|
Loading…
Reference in New Issue
Block a user