hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Merge `includes` and `contains` to `contains`

Open jcamiel opened this issue 1 year ago • 1 comments

includes tests if a value is included in a collection, while contains test if a string/byte array is contained in a string/byte array. We could merge the two predicates an only use contains to simplify the grammar (see https://hurl.dev/docs/asserting-response.html#predicates)

jcamiel avatar Sep 06 '23 16:09 jcamiel

While I do like this idea, one reason to NOT to do it (just brainstorming) might be to make contains behave as an inner string/byte array search regardless of type and keep includes as equality in an array/object. For example, you could have this array:

[ "abc", "foobar", "def" ]

...or this object:

{ "abc": true, "foobar": "bar", "def": 123 }

...and these asserts:

jsonpath "$" includes "foo"  # false
jsonpath "$" contains "foo"  # true

However, if you don't like that idea then I would agree to merge them.

ens-scmeeu avatar Sep 08 '23 14:09 ens-scmeeu