1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-10 02:29:29 +00:00

Show help if `goto` is issued without an address

This commit is contained in:
Mike Naberezny 2013-11-23 16:33:00 -08:00
parent 0d35c2d351
commit d2ef9582b0
2 changed files with 10 additions and 0 deletions

View File

@ -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)

View File

@ -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 <address>" in out)
# help
def test_help_without_args_shows_documented_commands(self):