Skip to content

SliceEqualT and MapEqualT #86

Closed

Description

@Inuart

Is your feature request related to a problem? Please describe.
I'm always frustrated when I try to check if 2 slices (or maps) are equal in a type-safe way.

Describe the solution you'd like
Equal handles slices and maps but EqualT can't be used in those cases as it doesn't compile. An extra SliceEqual, MapEqualT or similar name is needed.

Describe alternatives you've considered
SliceSubsetT, MapContainsT or ElementsMatchT are not the same. I'm looking for the equivalent of slices.Equal() and maps.Equal.

Activity

  1. changed the title [-]SliceEqualT[/-] [+]SliceEqualT and MapEqualT[/+] on Apr 13, 2026
  2. fredbi commented on Apr 13, 2026

    @fredbi
    Member

    Yes I totally agree, this would make the generic API more symmetric.

    We could add:

    • SliceEqualT, SliceNotEqualT
    • similar for maps should not be that hard (perhaps another time)

    This could be a nice addition to the release coming this month (2 more weeks to wrap things up for v2.5).

    Bottom line:

    • 2 more assertions in internal/assertions:collections.go
    • refactor existing tests on slices to cover generic vs reflection-based testing together
    • regenerate code & docs
  3. added a commit that references this issue on Apr 13, 2026
    aa9182b
  4. fredbi commented on Apr 13, 2026

    @fredbi
    Member

    @Inuart something like this? #87

  5. added a commit that references this issue on Apr 13, 2026
    1cd664e
  6. Inuart commented on Apr 13, 2026

    @Inuart
    Author

    oh wow I didn't expect such a fast reply and even a merged PR 💯

  7. fredbi commented on Apr 14, 2026

    @fredbi
    Member

    @Inuart yeah you raised the issue just the week I had picked to pour some more gas into the project… your ask was reasonable and simple to implement.
    Now still have a few new things to do before I cut a v2.5 : https://go-openapi.github.io/testify/project/maintainers/roadmap/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions