Skip to content

Commit

Permalink
refactor: move cov + change describe mismatch params
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitor Hugo Salgado committed Jul 29, 2022
1 parent e8c05e4 commit 8182c89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions expect/allof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ func TestAllOf(t *testing.T) {
assert.Nil(t, err)
assert.False(t, result)
})

t.Run("mismatch description is not empty", func(t *testing.T) {
assert.NotEmpty(t, AllOf().DescribeMismatch("any target", "value"))
})
}
4 changes: 4 additions & 0 deletions expect/anyof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ func TestAnyOf(t *testing.T) {
assert.Nil(t, err)
assert.False(t, result)
})

t.Run("mismatch description is not empty", func(t *testing.T) {
assert.NotEmpty(t, AnyOf().DescribeMismatch("any target", "value"))
})
}
2 changes: 1 addition & 1 deletion expect/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type (
Name string

// DescribeMismatch gives more context of why the Matcher failed to match a given value.
DescribeMismatch func(p string, v any) string
DescribeMismatch func(target string, value any) string

// Matches is the function that does the actual matching logic.
Matches func(v any, args Args) (bool, error)
Expand Down

0 comments on commit 8182c89

Please sign in to comment.