Initial unittests for rosbash, to be expanded

This commit is contained in:
Thibault Kruse 2012-02-23 21:31:18 +00:00
parent 2392c6eb22
commit 838e517240
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#! /usr/bin/env bash
# This script is supposed to be a unit test for rosbash, also used for manual checks against other operating systems.
# TODO extend this script
. ../rosbash
export COMP_CWORD=1
_roscomplete_launch roslaunch
if [[ ! ${COMPREPLY[@]} =~ rosbash ]]; then
echo "rosbash package missing from" ${COMPREPLY[@]} ; exit 1
fi
echo success 1
export COMP_WORDS=("roslaunch" "--")
export COMP_CWORD=1
_roscomplete_launch roslaunch "--" roslaunch
if [[ ! ${COMPREPLY[@]} == "--files --args --nodes --find-node --child --local --screen --server_uri --run_id --wait --port --core --pid --dump-params" ]]; then
echo "roslaunch --options missing" from ${COMPREPLY[@]} ; exit 1
fi
echo success 2
export COMP_WORDS=("roslaunch" "roslaunch")
export COMP_CWORD=2
_roscomplete_launch roslaunch roslaunch
if [[ ! ${COMPREPLY[@]} =~ "example.launch" ]]; then
echo "example.launch missing from " ${COMPREPLY[@]} ; exit 1
fi
echo success 3

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python
import os
import subprocess
import unittest
PKG_PATH = os.getcwd()
TEST_PATH = os.path.join(PKG_PATH, 'test')
class TestRosBash(unittest.TestCase):
def setUp(self):
self.cmd = os.path.join(TEST_PATH, 'test_rosbash.bash')
self.assertTrue(os.path.exists(self.cmd))
def test_rosbash_completion(self):
subprocess.check_call([self.cmd], cwd = TEST_PATH)