Skip to content

Commit

Permalink
add internal assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini authored and shoenig committed Mar 6, 2024
1 parent 30a8cbc commit 2fe33f9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions internal/assertions/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,38 @@ func MapNotContainsValuesEqual[M ~map[K]V, K comparable, V interfaces.EqualFunc[
})
}

func MapContainsValue[M ~map[K]V, K comparable, V any](m M, val V, opts cmp.Options) (s string) {
return mapContains(m, []V{val}, func(a, b V) bool {
return equal(a, b, opts)
})
}

func MapNotContainsValue[M ~map[K]V, K comparable, V any](m M, val V, opts cmp.Options) (s string) {
return mapNotContains(m, []V{val}, func(a, b V) bool {
return equal(a, b, opts)
})
}

func MapContainsValueFunc[M ~map[K]V, K comparable, V any](m M, val V, eq func(V, V) bool) (s string) {
return mapContains(m, []V{val}, eq)
}

func MapNotContainsValueFunc[M ~map[K]V, K comparable, V any](m M, val V, eq func(V, V) bool) (s string) {
return mapNotContains(m, []V{val}, eq)
}

func MapContainsValueEqual[M ~map[K]V, K comparable, V interfaces.EqualFunc[V]](m M, val V) (s string) {
return mapContains(m, []V{val}, func(a, b V) bool {
return a.Equal(b)
})
}

func MapNotContainsValueEqual[M ~map[K]V, K comparable, V interfaces.EqualFunc[V]](m M, val V) (s string) {
return mapNotContains(m, []V{val}, func(a, b V) bool {
return a.Equal(b)
})
}

func FileExistsFS(system fs.FS, file string) (s string) {
info, err := fs.Stat(system, file)
if errors.Is(err, fs.ErrNotExist) {
Expand Down

0 comments on commit 2fe33f9

Please sign in to comment.