From 1b639ebfd0130ab3bba0e2ba37bc0b836199b253 Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Sun, 14 Dec 2014 15:58:57 -0800 Subject: [PATCH] Show an error message if load command has no args --- py65/monitor.py | 2 +- py65/tests/test_monitor.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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)