Skip to content

Commit

Permalink
Merge pull request #13 from corbym/fix-issue-#9
Browse files Browse the repository at this point in the history
Fix some of issues in #12
  • Loading branch information
corbym authored Sep 6, 2024
2 parents 70882ef + 7fd63c0 commit 62fe99b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions is/contains.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func descriptionForMatchers[A any](expected []*gocrest.Matcher[A]) string {
}

// ArrayContaining finds if all x's are contained in y.
// Acts like "ContainsAll", all elements given must be present in actual in the same order as the expected values.
// Acts like "ContainsAll", all elements given must be present in actual.
func ArrayContaining[A comparable](expected ...A) *gocrest.Matcher[[]A] {
match := new(gocrest.Matcher[[]A])
match.Describe = fmt.Sprintf("something that contains %v", descriptionFor(expected))
Expand All @@ -78,7 +78,7 @@ func ArrayContaining[A comparable](expected ...A) *gocrest.Matcher[[]A] {
}

// ArrayMatching finds if all x's are matched in y.
// Acts like "ContainsAll", all elements given must be present in actual in the same order as the expected values.
// Acts like "ContainsAll", all elements given must be present in actual.
func ArrayMatching[A comparable](expected ...*gocrest.Matcher[A]) *gocrest.Matcher[[]A] {
match := new(gocrest.Matcher[[]A])
match.Describe = fmt.Sprintf("something that contains %v", descriptionFor(expected))
Expand Down
5 changes: 0 additions & 5 deletions is/nil.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package is

import (
"fmt"
"github.com/corbym/gocrest"
)

Expand All @@ -12,7 +11,6 @@ func Nil() *gocrest.Matcher[error] {
match := new(gocrest.Matcher[error])
match.Describe = description
match.Matches = func(actual error) bool {
match.Actual = fmt.Sprintf("%v", actual)
return actual == nil
}
return match
Expand All @@ -23,7 +21,6 @@ func NilArray[A any]() *gocrest.Matcher[[]A] {
match := new(gocrest.Matcher[[]A])
match.Describe = description
match.Matches = func(actual []A) bool {
match.Actual = fmt.Sprintf("%v", actual)
return actual == nil
}
return match
Expand All @@ -34,7 +31,6 @@ func NilMap[K comparable, V any]() *gocrest.Matcher[map[K]V] {
match := new(gocrest.Matcher[map[K]V])
match.Describe = description
match.Matches = func(actual map[K]V) bool {
match.Actual = fmt.Sprintf("%v", actual)
return actual == nil
}
return match
Expand All @@ -45,7 +41,6 @@ func NilPtr[T any]() *gocrest.Matcher[*T] {
match := new(gocrest.Matcher[*T])
match.Describe = description
match.Matches = func(actual *T) bool {
match.Actual = fmt.Sprintf("%v", actual)
return actual == nil
}
return match
Expand Down

0 comments on commit 62fe99b

Please sign in to comment.