You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that shunit2 does not work with the -e flag of bash in some cases (but works fine in other). In particular assertNotNull raises an error (no matter if the assert fails or not). I don't know if the -e flag of bash is compatible with shunit2 but I use it to be sure to catch all errors.
set -e : Exit immediately if a command exits with a non-zero status.
Observed with bash 5.1.16. Here is a simple script to reproduce the bug:
set -e
testSomething() {
# this behaves correctly
assertNotSame "Not same" "aaa" "bbb"
# this fails with message: ASSERT:Unknown failure encountered running a test
assertNotNull "Not null(1)" "something"
}
source shunit2
The text was updated successfully, but these errors were encountered:
I see the same when assertSame is used. I downloaded shUnit2 the 7th of February last year ( 2023 ). So the fix in #141 is there.
When
set -eo pipefail
shopt -s inherit_errexit
is active ... I get: ASSERT:unknown failure encountered running a test
Commenting them out:
#set -eo pipefail#shopt -s inherit_errexit
And I get:
ASSERT:The returned base worker name should be the same as: test-test-worker expected:<ASS> but was:<test-test-worker>
shunit2:ERROR testReturnsCorrectBaseWorkerName() returned non-zero return code.
Further debugging showed that when using set without -e then I get no ASSERT:unknown failure encountered running a test error.
It seems that shunit2 does not work with the -e flag of bash in some cases (but works fine in other). In particular assertNotNull raises an error (no matter if the assert fails or not). I don't know if the -e flag of bash is compatible with shunit2 but I use it to be sure to catch all errors.
set -e : Exit immediately if a command exits with a non-zero status.
Observed with bash 5.1.16. Here is a simple script to reproduce the bug:
The text was updated successfully, but these errors were encountered: