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

Add "h" as a monitor shortcut for "help"

This commit is contained in:
Mike Naberezny 2012-02-09 15:29:55 -08:00
parent 24f984949a
commit 02ff83d18b
3 changed files with 34 additions and 8 deletions

View File

@ -10,6 +10,8 @@
- Fixed the cycle count of 0xD2 (CMP zero page indirect) in
the 65C02 simulation. Thanks to Brian Cassidy for reporting it.
- Added "h" as a monitor shortcut for "help".
0.11 (2012-01-07)
- Added a new 65Org16 MPU simulation written by Ed Spittles.

View File

@ -117,7 +117,6 @@ class Monitor(cmd.Cmd):
def _add_shortcuts(self):
self._shortcuts = {'~': 'tilde',
'?': 'help',
'a': 'assemble',
'al': 'add_label',
'd': 'disassemble',
@ -125,6 +124,8 @@ class Monitor(cmd.Cmd):
'f': 'fill',
'>': 'fill',
'g': 'goto',
'h': 'help',
'?': 'help',
'l': 'load',
'm': 'mem',
'q': 'quit',

View File

@ -379,18 +379,41 @@ class MonitorTests(unittest.TestCase):
# help
def test_help_accepts_command_shortcuts(self):
def test_help_without_args_shows_documented_commands(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.onecmd("help assemble \t ")
help_for_command = stdout.getvalue()
mon.onecmd('help')
out = stdout.getvalue()
self.assertTrue("Documented commands" in out)
stdout.truncate(0)
mon.onecmd("help a \t ")
help_for_shortcut = stdout.getvalue()
mon.onecmd('h')
out = stdout.getvalue()
self.assertTrue("Documented commands" in out)
self.assertEqual(help_for_command, help_for_shortcut)
stdout.truncate(0)
mon.onecmd('?')
out = stdout.getvalue()
self.assertTrue("Documented commands" in out)
def test_help_with_args_shows_command_help(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.onecmd('help assemble')
out = stdout.getvalue()
self.assertTrue(out.startswith("assemble <address>"))
stdout.truncate(0)
mon.onecmd('h a')
out = stdout.getvalue()
self.assertTrue("assemble <address>" in out)
def test_help_with_invalid_args_shows_error(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.onecmd('help foo')
out = stdout.getvalue()
self.assertTrue(out.startswith("*** No help on foo"))
# load