From d2ef9582b0d4ae9fc48feb6698cabe59b540492c Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Sat, 23 Nov 2013 16:33:00 -0800 Subject: [PATCH] Show help if ``goto`` is issued without an address --- py65/monitor.py | 3 +++ py65/tests/test_monitor.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/py65/monitor.py b/py65/monitor.py index eab4a8b..d28e1b2 100644 --- a/py65/monitor.py +++ b/py65/monitor.py @@ -429,6 +429,9 @@ class Monitor(cmd.Cmd): self._output("Change the PC to address and continue execution.") def do_goto(self, args): + if args == '': + return self.help_goto() + self._mpu.pc = self._address_parser.number(args) brks = [0x00] # BRK self._run(stopcodes=brks) diff --git a/py65/tests/test_monitor.py b/py65/tests/test_monitor.py index 37d3f6b..6c58cd1 100644 --- a/py65/tests/test_monitor.py +++ b/py65/tests/test_monitor.py @@ -417,6 +417,13 @@ class MonitorTests(unittest.TestCase): out = stdout.getvalue() self.assertTrue(out.startswith('goto')) + def test_goto_without_args_shows_command_help(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.onecmd('goto') + out = stdout.getvalue() + self.assertTrue("goto
" in out) + # help def test_help_without_args_shows_documented_commands(self):