Skip to content

Commit 5acce04

Browse files
committed
docs: Mocked functions
1 parent 9d5db4e commit 5acce04

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

docs/test-doubles.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ EOF
3737
assert_same "13525 pts/7 00:00:01 bash" "$(code)"
3838
}
3939
```
40+
41+
:::
42+
Mocked functions are also available inside subshells:
43+
44+
::: code-group
45+
```bash [Example]
46+
function test_example() {
47+
mock date echo "2024-05-01"
48+
49+
function run() {
50+
date
51+
}
52+
53+
assert_same "2024-05-01" "$(run)"
54+
}
55+
```
4056
:::
4157

4258
## spy

0 commit comments

Comments
 (0)