10 TEST_PATH = os.path.join(PKG_PATH,
'test')
14 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)
20 self.
cmdbash = os.path.join(TEST_PATH,
'test_rosbash.bash')
21 self.assertTrue(os.path.exists(self.
cmdbash))
23 self.
cmdzsh = os.path.join(TEST_PATH,
'test_roszsh.zsh')
24 self.assertTrue(os.path.exists(self.
cmdzsh))
27 subprocess.check_call([self.
cmdbash], cwd=TEST_PATH)
30 subprocess.check_call([self.
cmdzsh], cwd=TEST_PATH)
44 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))
45 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))
49 subprocess.check_call(
'touch foo.launch', shell=
True, cwd=self.
test_root_path)
50 subprocess.check_call(
'touch bar.launch', shell=
True, cwd=self.
test_root_path)
53 cmd +=
"_roscomplete_launch rosbash rosbash; echo $COMPREPLY'" 54 p = subprocess.Popen(cmd,
56 stdout=subprocess.PIPE,
58 output = p.communicate()
59 self.assertEqual(0, p.returncode, (p.returncode, output, cmd))
61 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)