Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show help when address range is entered incorrectly

  • Loading branch information...
commit 1a6b3fd5a9135eefc902f679d9ff23c4d0db6279 1 parent 90d983c
@mnaberez authored
Showing with 20 additions and 1 deletion.
  1. +6 −1 src/py65/monitor.py
  2. +14 −0 src/py65/tests/test_monitor.py
View
7 src/py65/monitor.py
@@ -328,7 +328,11 @@ def _interactive_assemble(self, args):
start += bytes
def do_disassemble(self, args):
- start, end = self._address_parser.range(args)
+ split = shlex.split(args)
+ if len(split) != 1:
+ return self.help_disassemble()
+
+ start, end = self._address_parser.range(split[0])
if start == end:
end += 1
@@ -350,6 +354,7 @@ def _format_disassembly(self, address, bytes, disasm):
def help_disassemble(self):
self._output("disassemble <address_range>")
self._output("Disassemble instructions in the address range.")
+ self._output('Range is specified like "<start>:<end+1>".')
def help_step(self):
self._output("step")
View
14 src/py65/tests/test_monitor.py
@@ -246,6 +246,20 @@ def test_shortcut_for_disassemble(self):
out = stdout.getvalue()
self.assertTrue(out.startswith('disassemble'))
+ def test_help_disassemble(self):
+ stdout = StringIO()
+ mon = Monitor(stdout=stdout)
+ mon.help_disassemble()
+ out = stdout.getvalue()
+ self.assertTrue(out.startswith('disassemble <address_range>'))
+
+ def test_disassemble_shows_help_when_given_extra_args(self):
+ stdout = StringIO()
+ mon = Monitor(stdout=stdout)
+ mon.do_disassemble("c000 c001")
+ out = stdout.getvalue()
+ self.assertTrue(out.startswith('disassemble <address_range>'))
+
# fill
def test_shortcut_f_for_fill(self):
Please sign in to comment.
Something went wrong with that request. Please try again.