10 TEST_PATH = os.path.join(PKG_PATH,
'test')
13 return "bash -c '. %s; export COMP_WORDS=(%s); export COMP_CWORD=%s;"%(os.path.join(PKG_PATH,
'rosbash'),
' '.join([
'"%s"'%w
for w
in strings]), currentword)
18 self.
cmdbash = os.path.join(TEST_PATH,
'test_rosbash.bash')
19 self.assertTrue(os.path.exists(self.
cmdbash))
21 self.
cmdzsh = os.path.join(TEST_PATH,
'test_roszsh.zsh')
22 self.assertTrue(os.path.exists(self.
cmdzsh))
25 subprocess.check_call([self.
cmdbash], cwd = TEST_PATH)
28 subprocess.check_call([self.
cmdzsh], cwd = TEST_PATH)
42 self.assertEqual(
"bash -c '. %s; export COMP_WORDS=(\"foo\" \"bar\"); export COMP_CWORD=1;"%os.path.join(PKG_PATH,
'rosbash'),
make_bash_pre_command([
'foo',
'bar'], 1))
43 self.assertEqual(
"bash -c '. %s; export COMP_WORDS=(\"foo\"); export COMP_CWORD=2;"%os.path.join(PKG_PATH,
'rosbash'),
make_bash_pre_command([
'foo'], 2))
47 subprocess.check_call(
"touch foo.launch", shell=
True, cwd=self.
test_root_path)
48 subprocess.check_call(
"touch bar.launch", shell=
True, cwd=self.
test_root_path)
51 cmd +=
"_roscomplete_launch rosbash rosbash; echo $COMPREPLY'" 52 p = subprocess.Popen(cmd,
54 stdout=subprocess.PIPE,
56 output = p.communicate()
57 self.assertEqual(0, p.returncode, (p.returncode, output, cmd))
59 self.assertTrue(
'example.launch' in output[0], (p.returncode, output[0], cmd))
def test_roslaunch_completion(self)
def test_roszsh_completion(self)
def make_bash_pre_command(strings, currentword)
def test_make_precommand(self)
def test_rosbash_completion(self)