Composing Matchers

Build compound Gomega assertions by combining matchers — And/SatisfyAll (all pass), Or/SatisfyAny (any pass), Not (negate), WithTransform to map the actual before matching, Satisfy for an ad-hoc predicate, HaveValue to dereference pointers/interfaces, HaveField for struct fields and method results, HaveEach for every element, plus the matchers-as-arguments idiom that lets you nest matchers inside ContainElement/ConsistOf/HaveKeyWithValue/Receive. Use when one Expect needs several requirements at once, or you want to assert deep into a value without writing a custom matcher.

onsi 1522d9c 6.0 KB Updated

File contents

onsi/gomega/tree/main/plugins/gomega/skills/composing-matchers commit 1522d9c1fa

Frequently asked questions

npx skillmds@latest add onsi/composing-matchers