-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider recovering after missing/extra element in sequence #177
Comments
I didn't know I think this is definitely possible, especially given we have a notion of mismatch weights (for example the weight of sequence mismatch is the sum of the mismatch weights of each mismatching element). Currently we mostly use this in the cheers and glad to hear you've been enjoying using the lib :) |
Thanks for the reply @philomates! If matcher-combinators were to adopt this new behaviour for sequences, I don't see a need for it to support the current behaviour. Does that make sense to you too? |
Very exciting @philomates! I'll try it out shortly and provide feedback in the PR! |
Thanks!
First thanks so much for this library, I've used it with great pleasure on some cljdoc tests and am now proposing its use on clj-kondo tests.
Observation
matcher-combinators behaviour
While exploring matcher-combinators for clj-kondo tests, I noticed when an item is missing from a sequence, matcher-combinators does not seem to attempt to recover after the missing element.
Given test:
The mismatch is reported as:
Snapshot for colours:
Same idea for an unexpected extra element in a sequence:
Gives us:
deep-diff2 behaviour
For comparison, let's use deep-diff2 to show what I mean by "recovering".
Snapshot to show colours:
We see that deep-diff2 sees
2
as missing and then continues to match3
and4
.It also handles extra elements like this:
We see
2
as an unexpected addition but shows3
and4
as matching.To Consider
Would it be viable and/or make sense for matcher-combinators to compare sequences the same way that deep-diff2 does?
This would mean the missing
2
would might be reported like so:And the extra
2
maybe like so:Next Steps
If the above seems like a good idea, would be happy to help in any way that makes sense.
The text was updated successfully, but these errors were encountered: