2 # subunit shell bindings.
3 # Copyright (C) 2006 Robert Collins <robertc@robertcollins.net>
5 # Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
6 # license at the users choice. A copy of both licenses are available in the
7 # project source as Apache-2.0 and BSD. You may not use this file except in
8 # compliance with one of these two licences.
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # license you chose for the specific language governing permissions and
14 # limitations under that license.
18 # this script tests that we can source the subunit shell bindings successfully.
19 # It manually implements the control protocol so that it des not depend on the
20 # bindings being complete yet.
22 # we expect to be run from the tree root.
24 echo 'test: shell bindings can be sourced'
25 # if any output occurs, this has failed to source cleanly
26 source_output=$(. ${SHELL_SHARE}subunit.sh 2>&1)
27 if [ $? -eq 0 -a "x$source_output" = "x" ]; then
28 echo 'success: shell bindings can be sourced'
30 echo 'failure: shell bindings can be sourced ['
31 echo 'got an error code or output during sourcing.:'
36 # now source it for real
37 . ${SHELL_SHARE}subunit.sh
39 # we should have a start_test function
40 echo 'test: subunit_start_test exists'
41 found_type=$(type -t subunit_start_test)
43 if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then
44 echo 'success: subunit_start_test exists'
46 echo 'failure: subunit_start_test exists ['
47 echo 'subunit_start_test is not a function:'
48 echo "type -t status: $status"
49 echo "output: $found_type"
53 # we should have a pass_test function
54 echo 'test: subunit_pass_test exists'
55 found_type=$(type -t subunit_pass_test)
57 if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then
58 echo 'success: subunit_pass_test exists'
60 echo 'failure: subunit_pass_test exists ['
61 echo 'subunit_pass_test is not a function:'
62 echo "type -t status: $status"
63 echo "output: $found_type"
67 # we should have a fail_test function
68 echo 'test: subunit_fail_test exists'
69 found_type=$(type -t subunit_fail_test)
71 if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then
72 echo 'success: subunit_fail_test exists'
74 echo 'failure: subunit_fail_test exists ['
75 echo 'subunit_fail_test is not a function:'
76 echo "type -t status: $status"
77 echo "output: $found_type"
81 # we should have a error_test function
82 echo 'test: subunit_error_test exists'
83 found_type=$(type -t subunit_error_test)
85 if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then
86 echo 'success: subunit_error_test exists'
88 echo 'failure: subunit_error_test exists ['
89 echo 'subunit_error_test is not a function:'
90 echo "type -t status: $status"
91 echo "output: $found_type"
95 # we should have a skip_test function
96 echo 'test: subunit_skip_test exists'
97 found_type=$(type -t subunit_skip_test)
99 if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then
100 echo 'success: subunit_skip_test exists'
102 echo 'failure: subunit_skip_test exists ['
103 echo 'subunit_skip_test is not a function:'
104 echo "type -t status: $status"
105 echo "output: $found_type"