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 the output of the methods. As each is tested we start using
23 # So the first test manually implements the entire protocol, the next uses the
24 # start method and so on.
25 # it is assumed that we are running from the 'shell' tree root in the source
26 # of subunit, and that the library sourcing tests have all passed - if they
27 # have not, this test script may well fail strangely.
30 . ${SHELL_SHARE}subunit.sh
32 echo 'test: subunit_start_test output'
33 func_output=$(subunit_start_test "foo bar")
35 if [ $func_status == 0 -a "x$func_output" = "xtest: foo bar" ]; then
36 echo 'success: subunit_start_test output'
38 echo 'failure: subunit_start_test output ['
39 echo 'got an error code or incorrect output:'
40 echo "exit: $func_status"
41 echo "output: '$func_output'"
45 subunit_start_test "subunit_pass_test output"
46 func_output=$(subunit_pass_test "foo bar")
48 if [ $func_status == 0 -a "x$func_output" = "xsuccess: foo bar" ]; then
49 subunit_pass_test "subunit_pass_test output"
51 echo 'failure: subunit_pass_test output ['
52 echo 'got an error code or incorrect output:'
53 echo "exit: $func_status"
54 echo "output: '$func_output'"
58 subunit_start_test "subunit_fail_test output"
59 func_output=$(subunit_fail_test "foo bar" <<END
66 if [ $func_status == 0 -a "x$func_output" = "xfailure: foo bar [
71 subunit_pass_test "subunit_fail_test output"
73 echo 'failure: subunit_fail_test output ['
74 echo 'got an error code or incorrect output:'
75 echo "exit: $func_status"
76 echo "output: '$func_output'"
80 subunit_start_test "subunit_error_test output"
81 func_output=$(subunit_error_test "foo bar" <<END
88 if [ $func_status == 0 -a "x$func_output" = "xerror: foo bar [
93 subunit_pass_test "subunit_error_test output"
95 subunit_fail_test "subunit_error_test output" <<END
96 got an error code or incorrect output:
98 output: '$func_output'