feat: add entry-embeds matcher for predicate map keys (#132) - #244
Open
felipeofdev-ai wants to merge 1 commit into
Open
feat: add entry-embeds matcher for predicate map keys (#132)#244felipeofdev-ai wants to merge 1 commit into
felipeofdev-ai wants to merge 1 commit into
Conversation
Opt-in matcher recasts map expectations as [key-matcher value-matcher] entry pairs, following philomates embeds-over-entries approach. Default map matching unchanged. Signed-off-by: Felipe Fernandes <felipe.of.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements philomates' opt-in approach from #132: a new
entry-embedsmatcher for maps whose keys and/or values should be matched with predicates or submatchers.Default map matching is unchanged — literal keys only. Predicate keys like
{keyword? :b}still do not match{:a :b}unless wrapped inentry-embeds.Fixes #132 (opt-in path; documents limitation for default maps)
Design
Following philomates' suggestion, map matching with predicate keys is recast as order-agnostic matching over
[key-matcher value-matcher]entry pairs:Extra entries in the actual map are ignored (embeds semantics). Runtime is the same class as
embeds/in-any-order— documented warning for large maps.Changes
EntryEmbedsrecord +entry-embedspublic matcherentry-embedsand notes default map behaviourTest plan
core_test.cljandmatchers_test.clj— Felipe Fernandes · Systems & Agentic AI Engineer
https://github.com/felipeofdev-ai · https://felipeofdev-ai.github.io/