From c7144805803d7ceb23fc776a1ccc2506c029d618 Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Thu, 20 Aug 2009 19:04:17 -0700 Subject: [PATCH] Ignore leading dots in monitor commands. --- src/py65/monitor.py | 4 ++++ src/py65/tests/test_monitor.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/py65/monitor.py b/src/py65/monitor.py index 6283ad7..3538536 100644 --- a/src/py65/monitor.py +++ b/src/py65/monitor.py @@ -68,6 +68,10 @@ class Monitor(cmd.Cmd): 'z': 'step'} def _preprocess_line(self, line): + # ignore leading dots + while line.startswith('.'): + line = line[1:] + # command shortcuts for shortcut, command in self._shortcuts.iteritems(): pattern = '^%s\s+' % re.escape(shortcut) diff --git a/src/py65/tests/test_monitor.py b/src/py65/tests/test_monitor.py index 68f97b1..7021f27 100644 --- a/src/py65/tests/test_monitor.py +++ b/src/py65/tests/test_monitor.py @@ -7,6 +7,16 @@ from StringIO import StringIO class MonitorTests(unittest.TestCase): + # line processing + + def test_preprocess_line_removes_leading_dots(self): + stdout = StringIO() + mon = Monitor(stdout=stdout) + mon.onecmd('...help') + + out = stdout.getvalue() + self.assert_('Documented commands' in out) + # assemble def test_do_assemble_assembles_valid_statement(self):