haf / expecto

A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Apache License 2.0
663 stars 96 forks source link

Expect length of a list/sequence asserter? #311

Closed drhumlen closed 5 years ago

drhumlen commented 5 years ago

I seem to miss an expect function like:

let list = [1; 2; 3; 4]
Expect.lengthOf list 3 "Must have exactly 3 elements"

If it fails, I expect to see something like:

Expected length to be 3, but: 

[1; 2; 3; 4]

has length 4.

Is there another way to do this or..? Seems like a quite fundamental asserter.

AnthonyLloyd commented 5 years ago

There isn't an expect function for this. It sound good. Could you submit a PR?

drhumlen commented 5 years ago

Done: https://github.com/haf/expecto/pull/312/files 😄

AnthonyLloyd commented 5 years ago

Thanks