diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index b62706023446d..9b2de44654978 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -334,6 +334,14 @@ test do end ``` +* If the binary only writes to `stderr`, you can redirect `stderr` to `stdout` for assertions with `shell_output`. For example: + +```ruby +test do + assert_match "Output on stderr", shell_output("#{bin}/formula-program 2>&1", 2) +end +``` + ### Manuals Homebrew expects to find manual pages in `#{prefix}/share/man/...`, and not in `#{prefix}/man/...`.