Add testing documentation to README

This commit is contained in:
JeremyStar™ 2024-10-27 13:30:17 +01:00
parent 511397c955
commit 47341ee2d0
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 10 additions and 1 deletions

View file

@ -8,3 +8,10 @@ Provides some nice utility methods for bash scripts.
## Documentation
See [bashutils.staropensource.de](https://bashutils.staropensource.de)
## Testing
You run bashutils' tests by invoking the `test.sh` script.
The test script accepts environment variables as configuration.
### Configuration
| VARIABLE | TYPE | DEFAULT | DESCRIPTION |
| `FAILFAST` | bool | `false` | Terminates if a test fails instead of continuing |

View file

@ -2,6 +2,8 @@
set -uo pipefail
IFS=$'\n'
unset TEST TESTS
TESTS="
# Logging
logger_diag
@ -25,7 +27,7 @@ check_command_defined
function invalid() { echo ":: Error: Invalid test ${TEST}, skipping"; }
function fail() {
echo -e ":: Test ${TEST} failed\n ${*//\\n/\\n }"
[ -n "${FAILFAST}" ] && exit 1
[ "${TEST_FAILFAST}" == "true" ] && exit 1
}
## Assertions
function assert_equals() {