File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -328,4 +328,19 @@ pluto: test.pluto:4 -> Assertion Error: (assert.searcherror)
328
328
Absent String: argument
329
329
Error Message: something s
330
330
--]]
331
+ ```
332
+ ---
333
+ ### ` assert.contains `
334
+ Asserts that ` element ` is contained inside of ` container ` by using Pluto's modified ` in ` operator.
335
+ It's important to understand the type constraints of ` in ` to understand the type constraints here.
336
+ #### Parameters
337
+ 1 . ` element ` — The element to search for. If ` container ` is a string, ` element ` must be a string. If ` container ` is a table, ` element ` can be any type.
338
+ 2 . ` container ` — The container that ` element ` should be inside of. The ` container ` should be a string or table.
339
+ #### Errors
340
+ An assertion error is thrown if:
341
+ 1 . ` element ` is not contained inside of ` container ` .
342
+ 2 . ` element ` or ` container ` are of the wrong type and cannot be used with Pluto's modified ` in ` operator.
343
+ ``` pluto showLineNumbers
344
+ assert.contains("hello", { "hello", "world" }) --> Passes.
345
+ assert.contains("world", { "hello", "hello" }) --> Fails.
331
346
```
You can’t perform that action at this time.
0 commit comments