mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-06 13:31:08 +00:00
Show help when cd is not given an argument
This commit is contained in:
parent
f3034082c9
commit
393b2393a5
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user