Open
Description
Without it simple typos may be hard to catch. For example, this trivial test script should fail:
#!/bin/sh
test_description="A trival test that should fail"
. lib/test-lib.sh
#set -e
test_expect_successs "false" 'false'
test_expect_success "true" 'true'
test_done
But it doesn't because I misspelled successs
. Instead here is the output:
./t9999-example.sh: 8: ./t9999-example.sh: test_expect_successs: not found
ok 1 - true
# passed all 1 test(s)
1..1
It shows the error, but in a large script with lots of tests it may be very easy to miss.
If the set -e
in uncommented than the script will abort and make the typo more obvious:
./t9999-example.sh: 5: ./t9999-example.sh: test_expect_successs: not found
FATAL: Unexpected exit with code 127
I am not sure what consequences using set -e
globally will have though.