From 4ca7d5d878c55da89309c7589784a06a4d4ef2b5 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Fri, 6 Oct 2023 11:17:08 +0200 Subject: [PATCH] osht: Fix off-by one count test report. --- osht.sh | 6 ++++++ 1 file changed, 6 insertions(+) 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