_testPassCount=0 _testTotalCount=0 # $1: Message # $2: Subshell output function it() { local exitCode=$? local message="$1" local output="$2" local status _testTotalCount=$((_testTotalCount+1)) if [ "$exitCode" -eq 0 ]; then status='✓' _testPassCount=$((_testPassCount+1)) else status='✗' fi if [ -n "$output" ]; then printf '%s\n' "$output" fi printf '%s %s\n' "$status" "$message" } function testSummary() { printf 'Passed: %s of %s tests\n' "$_testPassCount" "$_testTotalCount" }