Skip to content

Commit

Permalink
feat: add OmitEmpty() compare option
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Jan 18, 2024
1 parent 929325d commit 9077e33
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ func Exclude[T any]() CompareOption {
}
}

// OmitEmpty fields from comparison.
func OmitEmpty() CompareOption {
return func() []repr.Option {
return []repr.Option{repr.OmitEmpty(true)}
}
}

// Compare two values for equality and return true or false.
func Compare[T any](t testing.TB, x, y T, options ...CompareOption) bool {
return objectsAreEqual(x, y, options...)
Expand Down

0 comments on commit 9077e33

Please sign in to comment.