Esempio n. 1
0
 def test_completion(self):
     temp_dir = self.make_temp_dir()
     os.mkdir(os.path.join(temp_dir, "a-dir"))
     os.mkdir(os.path.join(temp_dir, "b-dir"))
     write_file(os.path.join(temp_dir, "a-file"), "")
     os.chdir(temp_dir)
     self.assertEquals(sorted(shell.complete_filename("a-")),
                       ["a-dir/", "a-file"])
Esempio n. 2
0
 def test_completion_with_tilde_expansion(self):
     home_dir = self.make_temp_dir()
     self.patch_env_var("HOME", home_dir)
     os.mkdir(os.path.join(home_dir, "a-dir"))
     os.mkdir(os.path.join(home_dir, "b-dir"))
     # Recent versions of Bash expand out ~ when doing completion,
     # but we leave the ~ in place, which I prefer.
     self.assertEquals(list(shell.complete_filename("~/a-")),
                       ["~/a-dir/"])