Skip to content

Consider making assert.Equal generic? #292

@pete-woods

Description

@pete-woods

One of the benefits I often hear of "not using an assertion library" is that it makes equality comparisons type-safe (especially easy to get wrong when comparing eg specific numeric types).

I saw another assertion library recently https://github.com/alecthomas/assert that is heavily inspired by testify, but has made some of its funcs generic, to aid with this.

func Equal[T any](t testing.TB, expected, actual T, msgArgsAndCompareOptions ...any)

Is this something gotest.tools could consider?

Would it necessitate v3?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions