Skip to content

Commit ca79287

Browse files
committed
Document @test function argument order (#58)
1 parent 5094268 commit ca79287

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Fishtape is a <a href=https://testanything.org title="Test Anything Protocol">Test Anything Protocol</a> compliant test runner for Fish. Use it to test anything: scripts, functions, plugins without ever leaving your favorite shell. Here's the first example to get you started:
66

77
```fish
8+
@test "has a config.fish file" -e ~/.config/fish/config.fish
9+
810
@test "the ultimate question" (math "6 * 7") -eq 42
911
1012
@test "got root?" $USER = root
@@ -15,17 +17,18 @@ Now put that in a `fish` file and run it with `fishtape` installed. Behold, the
1517
```console
1618
$ fishtape example.fish
1719
TAP version 13
18-
ok 1 the ultimate question
19-
not ok 2 got root?
20+
ok 1 has a config.fish file
21+
ok 2 the ultimate question
22+
not ok 3 got root?
2023
---
2124
operator: =
2225
expected: root
2326
actual: jb
24-
at: ~/example.fish:3
27+
at: ~/fishtape/tests/example.fish:5
2528
...
2629

27-
1..2
28-
# pass 1
30+
1..3
31+
# pass 2
2932
# fail 1
3033
```
3134

@@ -45,11 +48,11 @@ fisher install jorgebucaran/fishtape
4548

4649
Tests are defined with the `@test` function. Each test begins with a description, followed by a typical `test` expression. Refer to the `test` builtin [documentation](https://fishshell.com/docs/current/cmds/test.html) for operators and usage details.
4750

48-
> Operators to combine expressions are not currently supported: `!`, `-a`, `-o`.
51+
<pre>
52+
@<a href=#writing-tests>test</a> <i>description</i> [<i>actual</i>] <a href=https://fishshell.com/docs/current/cmds/test.html#operators-for-files-and-directories>operator</a> <i>expected</i>
53+
</pre>
4954

50-
```fish
51-
@test "has a config.fish file" -e ~/.config/fish/config.fish
52-
```
55+
> Operators to combine expressions are not currently supported: `!`, `-a`, `-o`.
5356
5457
Sometimes you need to test the exit status of running one or more commands and for that, you use command substitutions. Just make sure to suppress stdout to avoid cluttering your `test` expression.
5558

0 commit comments

Comments
 (0)