mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-04 01:30:18 +00:00
Show help when address range is entered incorrectly
This commit is contained in:
parent
38eb82563d
commit
09f08e727f
@ -597,9 +597,14 @@ class Monitor(cmd.Cmd):
|
||||
def help_mem(self):
|
||||
self._output("mem <address_range>")
|
||||
self._output("Display the contents of memory.")
|
||||
self._output('Range is specified like "<start:end>".')
|
||||
|
||||
def do_mem(self, args):
|
||||
start, end = self._address_parser.range(args)
|
||||
split = shlex.split(args)
|
||||
if len(split) != 1:
|
||||
return self.help_mem()
|
||||
|
||||
start, end = self._address_parser.range(split[0])
|
||||
|
||||
line = self.addrFmt % start + ":"
|
||||
for address in range(start, end+1):
|
||||
|
@ -441,7 +441,23 @@ class MonitorTests(unittest.TestCase):
|
||||
mon.do_help('m')
|
||||
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith('mem'))
|
||||
self.assertTrue(out.startswith('mem <address_range>'))
|
||||
|
||||
def test_do_mem_shows_help_when_given_no_args(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
mon.do_mem('')
|
||||
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith('mem <address_range>'))
|
||||
|
||||
def test_do_mem_shows_help_when_given_extra_args(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
mon.do_mem('c000 c001')
|
||||
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith('mem <address_range>'))
|
||||
|
||||
# mpu
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user