2 # subunit shell bindings.
3 # Copyright (C) 2006 Robert Collins <robertc@robertcollins.net>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # this script tests that we can source the subunit shell bindings successfully.
22 # It manually implements the control protocol so that it des not depend on the
23 # bindings being complete yet.
25 # we expect to be run from the tree root.
27 echo 'test: shell bindings can be sourced'
28 # if any output occurs, this has failed to source cleanly
29 source_output=$(. ${SHELL_SHARE}subunit.sh 2>&1)
30 if [ $? == 0 -a "x$source_output" = "x" ]; then
31 echo 'success: shell bindings can be sourced'
33 echo 'failure: shell bindings can be sourced ['
34 echo 'got an error code or output during sourcing.:'
39 # now source it for real
40 . ${SHELL_SHARE}subunit.sh
42 # we should have a start_test function
43 echo 'test: subunit_start_test exists'
44 found_type=$(type -t subunit_start_test)
46 if [ $status == 0 -a "x$found_type" = "xfunction" ]; then
47 echo 'success: subunit_start_test exists'
49 echo 'failure: subunit_start_test exists ['
50 echo 'subunit_start_test is not a function:'
51 echo "type -t status: $status"
52 echo "output: $found_type"
56 # we should have a pass_test function
57 echo 'test: subunit_pass_test exists'
58 found_type=$(type -t subunit_pass_test)
60 if [ $status == 0 -a "x$found_type" = "xfunction" ]; then
61 echo 'success: subunit_pass_test exists'
63 echo 'failure: subunit_pass_test exists ['
64 echo 'subunit_pass_test is not a function:'
65 echo "type -t status: $status"
66 echo "output: $found_type"
70 # we should have a fail_test function
71 echo 'test: subunit_fail_test exists'
72 found_type=$(type -t subunit_fail_test)
74 if [ $status == 0 -a "x$found_type" = "xfunction" ]; then
75 echo 'success: subunit_fail_test exists'
77 echo 'failure: subunit_fail_test exists ['
78 echo 'subunit_fail_test is not a function:'
79 echo "type -t status: $status"
80 echo "output: $found_type"
84 # we should have a error_test function
85 echo 'test: subunit_error_test exists'
86 found_type=$(type -t subunit_error_test)
88 if [ $status == 0 -a "x$found_type" = "xfunction" ]; then
89 echo 'success: subunit_error_test exists'
91 echo 'failure: subunit_error_test exists ['
92 echo 'subunit_error_test is not a function:'
93 echo "type -t status: $status"
94 echo "output: $found_type"