Add testing documentation to README
This commit is contained in:
parent
511397c955
commit
47341ee2d0
2 changed files with 10 additions and 1 deletions
|
@ -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 |
|
||||
|
|
4
test.sh
4
test.sh
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue