Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Custom Equality and Diff in Assert and Require #1616

Open
nathanjsweet opened this issue Jun 25, 2024 · 0 comments
Open

Support Custom Equality and Diff in Assert and Require #1616

nathanjsweet opened this issue Jun 25, 2024 · 0 comments

Comments

@nathanjsweet
Copy link

Description

Update assert to compare data structures that are isomorphically equal (such as a Tree, Trie, etc) to one another, but not equal by value or reference.

Proposed solution

Define an Equal and Diff interface that structures can implement that the require/assert package will check on equality assertion (e.g. require.Equal(t, expected, actual)) rather than using DeepEqual.

Use case

Currently, the Cilium codebase uses a require.Truef as a workaround, calling into a custom Equals method and a custom Diff method.

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

No branches or pull requests

1 participant