diff --git a/py65/monitor.py b/py65/monitor.py index 99a7d68..5f9a886 100644 --- a/py65/monitor.py +++ b/py65/monitor.py @@ -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 diff --git a/py65/tests/test_monitor.py b/py65/tests/test_monitor.py index f0a8952..eb3bd27 100644 --- a/py65/tests/test_monitor.py +++ b/py65/tests/test_monitor.py @@ -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)