When working with Arrays, I often find myself needing to use write expectations for them in tests. Unfortunately, while Expect.equalLists exists (and the same for Set/Dict), Expect.equalArrays doesn't. Therefore I often end up needing to write something like this:
some operation
|> Array.toList
|> Expect.equalLists [ ... ]
Adding a expectArrays : Array a -> Array a -> Expectation function would forego the need for the manual and maybe confusing conversion.
What I'm unsure of, is whether there should also be a function that—for convenience's sake—takes a List a for the expected collection.
expect??? : List a -> Array a -> Expectation
--
some operation
|> Expect.equal??? [ 1, 2, 3 ]
-- instead of
some operation
|> Expect.equal??? (Array.fromList [ 1, 2, 3 ])
-- or
some operation
|> Array.toList
|> Expect.equalLists [ 1, 2, 3 ]
This could be beneficial for equalSets and equalDicts as well.
When working with
Arrays, I often find myself needing to use write expectations for them in tests. Unfortunately, whileExpect.equalListsexists (and the same forSet/Dict),Expect.equalArraysdoesn't. Therefore I often end up needing to write something like this:Adding a
expectArrays : Array a -> Array a -> Expectationfunction would forego the need for the manual and maybe confusing conversion.What I'm unsure of, is whether there should also be a function that—for convenience's sake—takes a
List afor the expected collection.This could be beneficial for
equalSetsandequalDictsas well.