From f5668891b819bbfc7f18ffede13f761d5ba1d5cf Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Sat, 13 Dec 2014 20:05:58 -0800 Subject: [PATCH] Fix breakpoint number displayed in add_breakpoint --- py65/monitor.py | 2 +- py65/tests/test_monitor.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/py65/monitor.py b/py65/monitor.py index 21f2b19..f9755bb 100644 --- a/py65/monitor.py +++ b/py65/monitor.py @@ -767,7 +767,7 @@ class Monitor(cmd.Cmd): else: self._breakpoints.append(address) msg = "Breakpoint %d added at $%04X" - self._output(msg % (len(self._breakpoints), address)) + self._output(msg % (len(self._breakpoints) - 1, address)) def help_add_breakpoint(self): self._output("add_breakpoint ") diff --git a/py65/tests/test_monitor.py b/py65/tests/test_monitor.py index a3cc08a..851e54b 100644 --- a/py65/tests/test_monitor.py +++ b/py65/tests/test_monitor.py @@ -66,16 +66,17 @@ class MonitorTests(unittest.TestCase): mon = Monitor(stdout=stdout) mon.do_add_breakpoint('ffd2') out = stdout.getvalue() - address_parser = mon._address_parser + self.assertTrue(out.startswith("Breakpoint 0 added at $FFD2")) self.assertTrue(0xffd2 in mon._breakpoints) - def test_do_add_breakpoint_adds_number(self): + def test_do_add_breakpoint_adds_label(self): stdout = StringIO() mon = Monitor(stdout=stdout) address_parser = mon._address_parser address_parser.labels['chrout'] = 0xffd2 mon.do_add_breakpoint('chrout') out = stdout.getvalue() + self.assertTrue(out.startswith("Breakpoint 0 added at $FFD2")) self.assertTrue(0xffd2 in mon._breakpoints) # add_label