mirror of
https://github.com/mnaberez/py65.git
synced 2025-04-08 19:40:03 +00:00
Add tests for the cd command
This commit is contained in:
parent
393b2393a5
commit
c2776190fd
@ -157,6 +157,24 @@ class MonitorTests(unittest.TestCase):
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith("cd <directory>"))
|
||||
|
||||
def test_do_cd_changes_cwd(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
mon.do_cd(here)
|
||||
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith(here))
|
||||
self.assertEqual(here, os.getcwd())
|
||||
|
||||
def test_do_cd_with_bad_dir_shows_error(self):
|
||||
stdout = StringIO()
|
||||
mon = Monitor(stdout=stdout)
|
||||
mon.do_cd("/path/to/a/nonexistant/directory")
|
||||
|
||||
out = stdout.getvalue()
|
||||
self.assertTrue(out.startswith("Cannot change directory"))
|
||||
|
||||
# delete_label
|
||||
|
||||
def test_shortcut_for_delete_label(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user