1
0
mirror of https://github.com/mnaberez/py65.git synced 2025-03-04 18:33:49 +00:00

Show help when cd is not given an argument

This commit is contained in:
Mike Naberezny 2012-02-03 20:25:55 -08:00
parent f3034082c9
commit 393b2393a5
2 changed files with 11 additions and 0 deletions

@ -457,6 +457,9 @@ class Monitor(cmd.Cmd):
self._output("Change the working directory.")
def do_cd(self, args):
if args == '':
return self.help_cd()
try:
os.chdir(args)
except OSError, why:

@ -149,6 +149,14 @@ class MonitorTests(unittest.TestCase):
out = stdout.getvalue()
self.assertTrue(out.startswith("cd <directory>"))
def test_do_cd_with_no_dir_shows_help(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.do_cd("")
out = stdout.getvalue()
self.assertTrue(out.startswith("cd <directory>"))
# delete_label
def test_shortcut_for_delete_label(self):