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

Show an error message if load command has no args

This commit is contained in:
Mike Naberezny 2014-12-14 15:58:57 -08:00
parent 9f5cd2e425
commit 1b639ebfd0
2 changed files with 8 additions and 1 deletions

View File

@ -560,7 +560,7 @@ class Monitor(cmd.Cmd):
def do_load(self, args):
split = shlex.split(args)
if len(split) > 2:
if len(split) not in (1, 2):
self._output("Syntax error: %s" % args)
return

View File

@ -541,6 +541,13 @@ class MonitorTests(unittest.TestCase):
out = stdout.getvalue()
self.assertTrue(out.startswith('load'))
def test_load_with_less_than_two_args_syntax_error(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.do_load('')
out = stdout.getvalue()
self.assertTrue(out.startswith('Syntax error'))
def test_load_with_more_than_two_args_syntax_error(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)