diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -17,6 +17,7 @@ them. Version numbering continues where `bats-core` left off.* test helper libraries written for [Bats][bats]. Features: +- [error reporting](#error-reporting) - [output formatting](#output-formatting) See the [shared documentation][bats-docs] to learn how to install and @@ -27,6 +28,36 @@ learn about its internals see the developer documentation in the [source files](src). +## Error reporting + +### `fail` + +Display an error message and fail. This function provides a convenient +way to report failure in arbitrary situations. You can use it to +implement your own helpers when the ones available do not meet your +needs. Other functions use it internally as well. + +```bash +@test 'fail()' { + fail 'this test always fails' +} +``` + +The message can also be specified on the standard input. + +```bash +@test 'fail() with pipe' { + echo 'this test always fails' | fail +} +``` + +This function always fails and simply outputs the given message. + +``` +this test always fails +``` + + ## Output formatting Many test helpers need to produce human readable output. This library |