Open PunchyRascal opened 7 years ago
Do you have any error messages that you can share so I can see what you mean?
Not ATM (can provide them tomorrow) but basically, the with
method reports only something along the lines of: "Expected parameters do no match" (or number of parameters) and with_deep
reports for example that "array with 3 elements was expected, but got 6 elements".
But you have no idea what those extra or missing parameters are or how the values differ when they do.
Here are the error messages with and with_deep produce now:
with
Number of arguments don't match expectation
or
Expected argument in position 0 to be 'http://example.com', but it was 'moo'
with_deep
got : array with 5 element(s)
expect : array with 6 element(s)
or
Compared $data->[0][4]
got : 'foo-downloaded-content'
expect : 'foo-downloaded-contenta'
So actually it's already halfway there - in case the number of arguments matches, the differences are shown, but not otherwise.
Thanks.
I'll look at improving the with
error messages over the weekend as that is built by Test::Spec.
Test::Deep builds the error message for with_deep
so it is probably best to raise that example with them.
Methods
with
andwith_deep
are very useful for efficient mocking, however when the expectation is not met, they provide little information as to what is actually wrong.It would be very nice, if the parameters could be for example compared using
Test::Differences
'seq_or_diff
or similar debug method.Thanks.