You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reports an error if `spy` is not called with `expected`. When `call_index` is
123
123
provided, the assertion checks the arguments of that specific call (starting at
124
-
1). Without `call_index` it checks the last invocation.
124
+
1). Without `call_index` it checks the last invocation. The optional `--strict`
125
+
flag forces an exact match on argument boundaries.
125
126
126
127
::: code-group
127
128
```bash [Example]
@@ -131,20 +132,31 @@ function test_success() {
131
132
ps foo
132
133
ps bar
133
134
134
-
assert_have_been_called_with "foo" ps 1
135
-
assert_have_been_called_with "bar" ps 2
135
+
assert_have_been_called_with ps "foo" 1
136
+
assert_have_been_called_with ps "bar" 2
136
137
}
137
138
138
139
functiontest_failure() {
139
140
spy ps
140
141
141
142
ps bar
142
143
143
-
assert_have_been_called_with "foo" ps 1
144
+
assert_have_been_called_with ps "foo" 1
144
145
}
145
146
```
146
147
:::
147
148
149
+
### Argument boundaries
150
+
151
+
By default, `assert_have_been_called_with` joins arguments with spaces before comparison. This means a call like `ps "foo bar"` is indistinguishable from `ps foo bar`. Use the `--strict` flag to force an exact match on argument boundaries:
0 commit comments