diff --git a/osht.sh b/osht.sh index 7411298..5856fda 100644 --- a/osht.sh +++ b/osht.sh @@ -77,6 +77,8 @@ done function _osht_cleanup { local rv=$? + # make sure we get latest value (possibly updated in sub-shell) + _osht_get_test_count if [ -z "$_OSHT_PLANNED_TESTS" ]; then _OSHT_PLANNED_TESTS=$_OSHT_CURRENT_TEST echo "1..$_OSHT_PLANNED_TESTS" @@ -172,6 +174,10 @@ function _osht_source_linenum { echo "${parts[0]}" } +function _osht_get_test_count { + _OSHT_CURRENT_TEST=$(cat $_OSHT_CURRENT_TEST_FILE) +} + function _osht_increment_test { _OSHT_CURRENT_TEST=$(cat $_OSHT_CURRENT_TEST_FILE) let _OSHT_CURRENT_TEST=_OSHT_CURRENT_TEST+1