Skip to content

Commit a1717e7

Browse files
committed
docs: add inline filter syntax documentation
1 parent 7fefded commit a1717e7

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

docs/command-line.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,38 @@ bashunit test tests/ --filter "user_login"
8888
```
8989
:::
9090

91+
### Inline Filter Syntax
92+
93+
You can also specify a filter directly in the file path using `::` or `:line` syntax:
94+
95+
**Run a specific test by function name:**
96+
> `bashunit test path::function_name`
97+
98+
::: code-group
99+
```bash [Exact match]
100+
bashunit test tests/unit/example_test.sh::test_user_login
101+
```
102+
```bash [Partial match]
103+
# Runs all tests containing "user" in their name
104+
bashunit test tests/unit/example_test.sh::user
105+
```
106+
:::
107+
108+
**Run the test at a specific line number:**
109+
> `bashunit test path:line_number`
110+
111+
This is useful when jumping to a test from your editor or IDE.
112+
113+
::: code-group
114+
```bash [Example]
115+
bashunit test tests/unit/example_test.sh:42
116+
```
117+
:::
118+
119+
::: tip
120+
The line number syntax finds the test function that contains the specified line. If the line is before any test function, an error is shown.
121+
:::
122+
91123
### Parallel
92124

93125
> `bashunit test -p|--parallel`

0 commit comments

Comments
 (0)