fail fails to fail the test immediately
gqqnbig opened this issue · comments
fail [message]
Fails the test immediately.
I thus tried the following code.
$ cat t.sh
#!/bin/bash
testA() {
fail "A"
fail "B"
}
source shunit2
$ ./t.sh
testA
ASSERT:A
ASSERT:B
shunit2:ERROR testA() returned non-zero return code.
Ran 1 test.
FAILED (failures=2)
Because I was told fail fails the test immediately, I expect to only see ASSERT:A. However, I see ASSERT:A and ASSERT:B.
I don't know if it's a documentation bug or code bug. Please fix.
My version is 2.1.9pre.
I'm using this trick to fail a test fast ls /x || return $SHUNIT_FALSE
I think the documentation could be clearer about the fact that any "normal" methods to exit a shell script early on an error such as set -e
or set -o errexit
seems to have no effect with shunit2
Can you test the current dev version by copy pasting shunit2 from this repository ?
Ref: #164 - some fixes where made for set -e
I don't know what the current dev version is, but I tested https://github.com/kward/shunit2/blob/master/shunit2 again. The output is the same as what I posted one year ago. The problem is not fixed.
Thank you, this is what I expected you to test
Now we are sure some more fixing should be done