summaryrefslogtreecommitdiff
path: root/shell/tests
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2006-04-15 00:53:37 +1000
committerRobert Collins <robertc@robertcollins.net>2006-04-15 00:53:37 +1000
commit06cee63c1b85757faae6a3676e66edbac0624aed (patch)
tree37e241cf5ab588aa27b91e800b2fe00e8b5d88a8 /shell/tests
parent3bebe681fc9c80ced4cfdda1b8624dd64074e83a (diff)
downloadsubunit-git-06cee63c1b85757faae6a3676e66edbac0624aed.tar.gz
Basic shell subunit bindings working.
Diffstat (limited to 'shell/tests')
-rwxr-xr-xshell/tests/test_function_output.sh55
-rwxr-xr-xshell/tests/test_source_library.sh44
2 files changed, 98 insertions, 1 deletions
diff --git a/shell/tests/test_function_output.sh b/shell/tests/test_function_output.sh
index a57e6b9..35831f4 100755
--- a/shell/tests/test_function_output.sh
+++ b/shell/tests/test_function_output.sh
@@ -41,3 +41,58 @@ else
echo "output: '$func_output'"
echo ']' ;
fi
+
+subunit_start_test "subunit_pass_test output"
+func_output=$(subunit_pass_test "foo bar")
+func_status=$?
+if [ $func_status == 0 -a "x$func_output" = "xsuccess: foo bar" ]; then
+ subunit_pass_test "subunit_pass_test output"
+else
+ echo 'failure: subunit_pass_test output ['
+ echo 'got an error code or incorrect output:'
+ echo "exit: $func_status"
+ echo "output: '$func_output'"
+ echo ']' ;
+fi
+
+subunit_start_test "subunit_fail_test output"
+func_output=$(subunit_fail_test "foo bar" <<END
+something
+ wrong
+here
+END)
+func_status=$?
+if [ $func_status == 0 -a "x$func_output" = "xfailure: foo bar [
+something
+ wrong
+here
+]" ]; then
+ subunit_pass_test "subunit_fail_test output"
+else
+ echo 'failure: subunit_fail_test output ['
+ echo 'got an error code or incorrect output:'
+ echo "exit: $func_status"
+ echo "output: '$func_output'"
+ echo ']' ;
+fi
+
+subunit_start_test "subunit_error_test output"
+func_output=$(subunit_error_test "foo bar" <<END
+something
+ died
+here
+END)
+func_status=$?
+if [ $func_status == 0 -a "x$func_output" = "xerror: foo bar [
+something
+ died
+here
+]" ]; then
+ subunit_pass_test "subunit_error_test output"
+else
+ subunit_fail_test "subunit_error_test output" <<END
+got an error code or incorrect output:
+exit: $func_status
+output: '$func_output'
+END
+fi
diff --git a/shell/tests/test_source_library.sh b/shell/tests/test_source_library.sh
index 8fd10e6..765e42d 100755
--- a/shell/tests/test_source_library.sh
+++ b/shell/tests/test_source_library.sh
@@ -39,7 +39,7 @@ fi
# now source it for real
. share/subunit.sh
-# we should have a test-start function
+# we should have a start_test function
echo 'test: subunit_start_test exists'
found_type=$(type -t subunit_start_test)
status=$?
@@ -52,3 +52,45 @@ else
echo "output: $found_type"
echo ']' ;
fi
+
+# we should have a pass_test function
+echo 'test: subunit_pass_test exists'
+found_type=$(type -t subunit_pass_test)
+status=$?
+if [ $status == 0 -a "x$found_type" = "xfunction" ]; then
+ echo 'success: subunit_pass_test exists'
+else
+ echo 'failure: subunit_pass_test exists ['
+ echo 'subunit_pass_test is not a function:'
+ echo "type -t status: $status"
+ echo "output: $found_type"
+ echo ']' ;
+fi
+
+# we should have a fail_test function
+echo 'test: subunit_fail_test exists'
+found_type=$(type -t subunit_fail_test)
+status=$?
+if [ $status == 0 -a "x$found_type" = "xfunction" ]; then
+ echo 'success: subunit_fail_test exists'
+else
+ echo 'failure: subunit_fail_test exists ['
+ echo 'subunit_fail_test is not a function:'
+ echo "type -t status: $status"
+ echo "output: $found_type"
+ echo ']' ;
+fi
+
+# we should have a error_test function
+echo 'test: subunit_error_test exists'
+found_type=$(type -t subunit_error_test)
+status=$?
+if [ $status == 0 -a "x$found_type" = "xfunction" ]; then
+ echo 'success: subunit_error_test exists'
+else
+ echo 'failure: subunit_error_test exists ['
+ echo 'subunit_error_test is not a function:'
+ echo "type -t status: $status"
+ echo "output: $found_type"
+ echo ']' ;
+fi