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 the output of the methods. As each is tested we start using
20
# So the first test manually implements the entire protocol, the next uses the
21
# start method and so on.
22
# it is assumed that we are running from the 'shell' tree root in the source
23
# of subunit, and that the library sourcing tests have all passed - if they
24
# have not, this test script may well fail strangely.
27
. ${SHELL_SHARE}subunit.sh
29
echo 'test: subunit_start_test output'
30
func_output=$(subunit_start_test "foo bar")
32
if [ $func_status == 0 -a "x$func_output" = "xtest: foo bar" ]; then
33
echo 'success: subunit_start_test output'
35
echo 'failure: subunit_start_test output ['
36
echo 'got an error code or incorrect output:'
37
echo "exit: $func_status"
38
echo "output: '$func_output'"
42
subunit_start_test "subunit_pass_test output"
43
func_output=$(subunit_pass_test "foo bar")
45
if [ $func_status == 0 -a "x$func_output" = "xsuccess: foo bar" ]; then
46
subunit_pass_test "subunit_pass_test output"
48
echo 'failure: subunit_pass_test output ['
49
echo 'got an error code or incorrect output:'
50
echo "exit: $func_status"
51
echo "output: '$func_output'"
55
subunit_start_test "subunit_fail_test output"
56
func_output=$(subunit_fail_test "foo bar" <<END
63
if [ $func_status == 0 -a "x$func_output" = "xfailure: foo bar [
68
subunit_pass_test "subunit_fail_test output"
70
echo 'failure: subunit_fail_test output ['
71
echo 'got an error code or incorrect output:'
72
echo "exit: $func_status"
73
echo "output: '$func_output'"
77
subunit_start_test "subunit_error_test output"
78
func_output=$(subunit_error_test "foo bar" <<END
85
if [ $func_status == 0 -a "x$func_output" = "xerror: foo bar [
90
subunit_pass_test "subunit_error_test output"
92
subunit_fail_test "subunit_error_test output" <<END
93
got an error code or incorrect output:
95
output: '$func_output'