Document stdin option in readme
diff --git a/README.md b/README.md index 6eee99c..4842e5b 100644 --- a/README.md +++ b/README.md
@@ -189,16 +189,6 @@ } ``` -The expected output can be specified with a heredoc or standard input as well, -by providing `-` as an option. - -```bash -@test 'assert_output() with pipe' { - run echo 'have' - echo 'want' | assert_output - -} -``` - On failure, the expected and actual output are displayed. ``` @@ -267,6 +257,23 @@ This option and partial matching (`--partial` or `-p`) are mutually exclusive. An error is displayed when used simultaneously. +#### Standard Input, HereDocs and HereStrings + +The expected output can be specified via standard input (also +heredoc/herestring) with the `-`/`--stdin` option. + +```bash +@test 'assert_output() with pipe' { + run echo 'hello' + echo 'hello' | assert_output - +} + +@test 'assert_output() with herestring' { + run echo 'hello' + assert_output - <<< hello +} +``` + ### `refute_output` @@ -288,16 +295,6 @@ } ``` -The unexpected output can be specified with a heredoc or standard input as well, -by providing `-` as an option. - -```bash -@test 'refute_output() with pipe' { - run echo 'want' - echo 'want' | refute_output - -} -``` - On failure, the output is displayed. ``` @@ -365,6 +362,23 @@ This option and partial matching (`--partial` or `-p`) are mutually exclusive. An error is displayed when used simultaneously. +#### Standard Input, HereDocs and HereStrings + +The unexpected output can be specified via standard input (also +heredoc/herestring) with the `-`/`--stdin` option. + +```bash +@test 'refute_output() with pipe' { + run echo 'hello' + echo 'world' | refute_output - +} + +@test 'refute_output() with herestring' { + run echo 'hello' + refute_output - <<< world +} +``` + ### `assert_line`