Skip to content

Commit

Permalink
Keep track to the total number of tests ran and failed in an entire t…
Browse files Browse the repository at this point in the history
…est run, not just in a test suite.
  • Loading branch information
Dan Rivett authored and Dan Rivett committed Mar 25, 2015
1 parent f66972a commit 402c808
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ assert_end() {
echo "$tests_failed of $tests failed$report_time."
fi
tests_failed_previous=$tests_failed
tests_ran_total=$(($tests_ran_total + $tests_ran))
tests_failed_total=$(($tests_failed_total + $tests_failed))
[[ $tests_failed -gt 0 ]] && tests_suite_status=1
_assert_reset
}
Expand Down Expand Up @@ -179,6 +181,8 @@ _skip() {

_assert_reset
: ${tests_suite_status:=0} # remember if any of the tests failed so far
: ${tests_ran_total:=0} # remember the total number of tests ran (inc. failures)
: ${tests_failed_total:=0} # remember the total number of test failures
_assert_cleanup() {
local status=$?
# modify exit code if it's not already non-zero
Expand Down

0 comments on commit 402c808

Please sign in to comment.