-
-
Notifications
You must be signed in to change notification settings - Fork 40
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Q | A |
---|---|
OS | MacOS / Linux / Windows |
Shell | sh / bash / ... |
bashunit version | x.y.z |
Summary
Adding a new creation I did not add the assertion counter, but the counter had already been counted for
Current behavior
adding a test like:
function assertExitCode() {
local actual_exit_code=$?
local expected_exit_code="$1"
local label="${3:-$(normalizeFunctionName "${FUNCNAME[1]}")}"
if [ $actual_exit_code -eq "$expected_exit_code" ]; then
return 0
else
((_ASSERTIONS_FAILED++))
printFailedTest "${label}" "${actual_exit_code}" "to not match" "${expected_exit_code}"
return 1
fi
}
Without incrementing the $_ASSERTIONS_PASSED somehow it's counting it
How to reproduce
Create a new assertion like:
function assertExitCode() {
local actual_exit_code=$?
local expected_exit_code="$1"
local label="${3:-$(normalizeFunctionName "${FUNCNAME[1]}")}"
if [ $actual_exit_code -eq "$expected_exit_code" ]; then
#((_ASSERTIONS_PASSED++))
return 0
else
((_ASSERTIONS_FAILED++))
printFailedTest "${label}" "${actual_exit_code}" "to not match" "${expected_exit_code}"
return 1
fi
}
Run the test and look at the number of assertions, uncomment the #((_ASSERTIONS_PASSED++))
and run it again and you will see that the number does not change
Expected behavior
It should not count assertions that are not accounted for
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working