diff options
author | Zoltan Tombol <zoltan.tombol@gmail.com> | 2016-03-22 22:46:16 +0300 |
---|---|---|
committer | Zoltan Tombol <zoltan.tombol@gmail.com> | 2016-03-22 22:59:11 +0300 |
commit | 7649d495da279b05a559823e5c1eba2894e2bf35 (patch) | |
tree | 04553559d9819b75b581b4f73c7fc592d6ccb1e2 /README.md | |
parent | 028251d16a1766bcdd83554ef21e16c41e8ce8ae (diff) |
Add fail() from bats-assert
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 |