Skip to content

Commit

Permalink
fix sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcorby-eaglen committed Apr 1, 2023
1 parent 5b2ff47 commit 0dcbdb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions has/haskey.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// Returns a matcher that matches when a map has key == expected
func Key[K comparable, V any](expected K) *gocrest.Matcher[map[K]V] {
matcher := new(gocrest.Matcher[map[K]V])
matcher.Describe = fmt.Sprintf("map has key '%s'", expected)
matcher.Describe = fmt.Sprintf("map has key '%v'", expected)
matcher.Matches = func(actual map[K]V) bool {
return hasKey(actual, expected)
}
Expand All @@ -20,7 +20,7 @@ func Key[K comparable, V any](expected K) *gocrest.Matcher[map[K]V] {
// Returns a matcher that matches when a map has all keys == all expected.
func AllKeys[K comparable, V any](expected ...K) *gocrest.Matcher[map[K]V] {
matcher := new(gocrest.Matcher[map[K]V])
matcher.Describe = fmt.Sprintf("map has keys '%s'", expected)
matcher.Describe = fmt.Sprintf("map has keys '%v'", expected)
matcher.Matches = func(actual map[K]V) bool {
for _, k := range expected {
if !hasKey(actual, k) {
Expand Down
2 changes: 1 addition & 1 deletion is/contains.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func listMatches[T comparable](expected []*gocrest.Matcher[T], actualValue []T)
func descriptionFor[T any, A []T](expected A) string {
var description = ""
for x := 0; x < len(expected); x++ {
description += fmt.Sprintf("<%s>", expected[x])
description += fmt.Sprintf("<%v>", expected[x])
if x < len(expected)-1 {
description += " and "
}
Expand Down

0 comments on commit 0dcbdb3

Please sign in to comment.