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
It can be beneficial to be able to see all elements of the list in the test output. This can be achieved by wrapping the input in a class and overriding its ToString(), but it takes significantly more code, so a simpler way would be preferable.
testCase "generated input list of five elements is not abbreviated in the report"<|fun _ ->
Expect.throwsC
(fun()->
property {let!xs= Range.singleton 0|> Gen.int |> Gen.list (Range.singleton 5)return Seq.forall ((>)0) xs
}|> Property.checkWith (PropertyConfig.withShrinks 0<shrinks> PropertyConfig.defaultConfig))(fun ex ->
Expect.isNotMatch ex.Message "\.\.\.""Abbreviation (...) found")
But if we convert the F# list to a C# list, like Hedgehog.Linq does, then the ellipsis is there
It looks like sprintf "%A" only recognizes a C# generic List<T> (aka ResizeArray<_>) as IEnumerable (aka seq) but not as a list and so, knowing that it can be infinite or slow to traverse, decides to only dump the first elements.
@altxt If you have more tests like these, we'd be glad to include them for the C# interface so we don't introduce regressions. C# support is something we definitely want to improve, so these would be a very welcome addition!
Given a property that takes a list generator, such as this
When the property fails, the output only shows the first several elements of the list
It can be beneficial to be able to see all elements of the list in the test output. This can be achieved by wrapping the input in a class and overriding its ToString(), but it takes significantly more code, so a simpler way would be preferable.
The text was updated successfully, but these errors were encountered: