Gomega Matcher Catalog Overview
masterGomega provides a wide variety of built-in matchers to perform assertions in Go tests. When choosing a matcher, follow these three rules:
- Prefer the most specific matcher: This produces significantly better failure messages.
- Every matcher is negatable: You can use
NotTo()orShouldNot()with any matcher. - Compose freely: Many matchers accept other matchers as arguments (e.g.,
ContainElement(ContainSubstring("x"))).
Note: Any matcher that accepts format string, args ...any will run fmt.Sprintf on those arguments.