Skip to content

length checks for slices, maps etc should use a HaveLen any-matcher #35

@deltics

Description

@deltics

Although slices, maps, channels and more can be tested for emptiness using the emptiness any-matchers, testing for a specific length requires a more cumbersome test using the built-in len function, such as:

Expect(len(sut)).To(Equal(5))

A HaveLen any-matcher could be implemented using the existing emptiness matcher infrastructure to enable more flexible and intuitive tests:

Expect(sut).Should(HaveLen(5))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions