@@ -21,12 +21,14 @@ and back them with shell step definitions:
2121
2222``` bash
2323@When I run ' {command}'
24- run " $command "
24+ run " $command "
2525
2626@Then the output should include ' {text}'
27- [[ " $LAST_STDOUT " == * " $text " * ]]
27+ [[ " $LAST_STDOUT " == * " $text " * ]]
2828```
2929
30+ Indenting the step body is recommended for readability, but optional.
31+
3032## Install
3133
3234### Installing using the setup script
@@ -166,10 +168,10 @@ loads step definitions. You can rename it with `SHELLKIN_SUPPORT_FILE`.
166168
167169``` bash
168170@When I run ' {command}'
169- run " $command "
171+ run " $command "
170172
171173@Then the output should include ' {text}'
172- [[ " $LAST_STDOUT " == * " $text " * ]]
174+ [[ " $LAST_STDOUT " == * " $text " * ]]
173175```
174176
175177Each step definition starts with a header line:
@@ -182,13 +184,14 @@ Each step definition starts with a header line:
182184
183185The lines that follow are the step body and are executed when the step
184186matches.
187+ Indenting the body is recommended for readability, but optional.
185188
186189Definition headers can use named tokens in braces. When a step matches, each
187190token becomes an exported shell variable available to the body:
188191
189192``` bash
190193@Then the file ' {path}' should exist
191- [[ -f " $path " ]]
194+ [[ -f " $path " ]]
192195```
193196
194197Token names must start with a letter or underscore, and may contain letters,
@@ -207,7 +210,7 @@ assertions.
207210
208211``` bash
209212@When I run ' {command}'
210- run " $command "
213+ run " $command "
211214```
212215
213216` run ` always returns success, even if the command fails. Inspect the captured
@@ -219,7 +222,7 @@ Use `fail` to fail the current step with an optional custom message.
219222
220223``` bash
221224@Then the output should include ' {text}'
222- [[ " $LAST_STDOUT " == * " $text " * ]] || fail " invalid output detected"
225+ [[ " $LAST_STDOUT " == * " $text " * ]] || fail " invalid output detected"
223226```
224227
225228### ` defer `
@@ -229,11 +232,11 @@ finishes.
229232
230233``` bash
231234@Given I am in a temp directory
232- old_pwd=$PWD
233- temp_dir=$( mktemp -d)
234- cd " $temp_dir "
235- defer cd " $old_pwd "
236- defer rm -rf " $temp_dir "
235+ old_pwd=$PWD
236+ temp_dir=$( mktemp -d)
237+ cd " $temp_dir "
238+ defer cd " $old_pwd "
239+ defer rm -rf " $temp_dir "
237240```
238241
239242Deferred actions are scenario-scoped, run after both passing and failing
@@ -254,9 +257,14 @@ Example:
254257
255258``` bash
256259@Then the output should match
257- [[ " $LAST_STDOUT " == " $DOC_STRING " ]]
260+ [[ " $LAST_STDOUT " == " $DOC_STRING " ]]
258261```
259262
263+ ## Examples
264+
265+ For real-world examples, see this repository's [ features] ( features ) directory
266+ and the [ rush features] ( https://github.com/DannyBen/rush/tree/master/features ) .
267+
260268## Uninstalling
261269
262270If you used the setup script, you can run this uninstall script:
0 commit comments