Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 552cfb0

Browse files
committed
Add doc comments
1 parent c46255d commit 552cfb0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

any.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (x FluentAny[T]) Should(pred func(got T) bool) FailureMessage {
2929
return FailureMessage(fmt.Sprintf("object does not meet the predicate criteria\ngot: %+v", x.Got))
3030
}
3131

32-
// ShouldNot tests if the object does not the predicate criteria.
32+
// ShouldNot tests if the object does not meet the predicate criteria.
3333
func (x FluentAny[T]) ShouldNot(fn func(got T) bool) FailureMessage {
3434
if !fn(x.Got) {
3535
return ""

slice.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ func Slice[T any](got []T) FluentSlice[T] {
1616
return FluentSlice[T]{FluentAny[[]T]{got}}
1717
}
1818

19-
// Empty banana.
19+
// Empty tests if the slice is empty.
2020
func (x FluentSlice[T]) Empty() FailureMessage {
2121
if len(x.Got) == 0 {
2222
return ""
2323
}
2424
return FailureMessage(fmt.Sprintf("not an empty slice\ngot: %+v", x.Got))
2525
}
2626

27-
// NotEmpty banana.
27+
// NotEmpty tests if the slice is not empty.
2828
func (x FluentSlice[T]) NotEmpty() FailureMessage {
2929
if len(x.Got) > 0 {
3030
return ""
3131
}
3232
return FailureMessage(fmt.Sprintf("an empty slice\ngot: %+v", x.Got))
3333
}
3434

35-
// Equivalent banana.
35+
// Equivalent tests if the slice has the same element as want in any order.
3636
func (x FluentSlice[T]) Equivalent(want []T, opts ...cmp.Option) FailureMessage {
3737
extraGot, extraWant := x.diff(want, opts)
3838
if len(extraGot) == 0 && len(extraWant) == 0 {
@@ -41,7 +41,7 @@ func (x FluentSlice[T]) Equivalent(want []T, opts ...cmp.Option) FailureMessage
4141
return FailureMessage(fmt.Sprintf("not equivalent\nextra got: %+v\nextra want: %+v", extraGot, extraWant))
4242
}
4343

44-
// NotEquivalent banana.
44+
// NotEquivalent tests if the slice does not have the same element as want in any order.
4545
func (x FluentSlice[T]) NotEquivalent(want []T, opts ...cmp.Option) FailureMessage {
4646
extraGot, extraWant := x.diff(want, opts)
4747
if len(extraGot) != 0 || len(extraWant) != 0 {
@@ -83,7 +83,7 @@ func (x FluentSlice[T]) diff(want []T, opts []cmp.Option) (extraGot, extraWant [
8383
return
8484
}
8585

86-
// Contain banana.
86+
// Contain tests if the slice contains the item.
8787
func (x FluentSlice[T]) Contain(item T, opts ...cmp.Option) FailureMessage {
8888
for _, v := range x.Got {
8989
if cmp.Equal(item, v, opts...) {
@@ -93,7 +93,7 @@ func (x FluentSlice[T]) Contain(item T, opts ...cmp.Option) FailureMessage {
9393
return FailureMessage(fmt.Sprintf("slice does not contain the item\ngot: %+v\nitem: %+v", x.Got, item))
9494
}
9595

96-
// NotContain banana.
96+
// NotContain tests if the slice does not contain the item.
9797
func (x FluentSlice[T]) NotContain(item T, opts ...cmp.Option) FailureMessage {
9898
for _, v := range x.Got {
9999
if cmp.Equal(item, v, opts...) {
@@ -103,7 +103,7 @@ func (x FluentSlice[T]) NotContain(item T, opts ...cmp.Option) FailureMessage {
103103
return ""
104104
}
105105

106-
// Any banana.
106+
// Any tests if any of the slice's item meets the predicate criteria.
107107
func (x FluentSlice[T]) Any(predicate func(T) bool) FailureMessage {
108108
for _, v := range x.Got {
109109
if predicate(v) {
@@ -113,7 +113,7 @@ func (x FluentSlice[T]) Any(predicate func(T) bool) FailureMessage {
113113
return FailureMessage(fmt.Sprintf("none item does meet the predicate criteria\ngot: %+v", x.Got))
114114
}
115115

116-
// All banana.
116+
// All tests if all of the slice's items meets the predicate criteria.
117117
func (x FluentSlice[T]) All(predicate func(T) bool) FailureMessage {
118118
for _, v := range x.Got {
119119
if !predicate(v) {
@@ -123,7 +123,7 @@ func (x FluentSlice[T]) All(predicate func(T) bool) FailureMessage {
123123
return ""
124124
}
125125

126-
// None banana.
126+
// None tests if all of the slice's item does not meet the predicate criteria.
127127
func (x FluentSlice[T]) None(predicate func(T) bool) FailureMessage {
128128
for _, v := range x.Got {
129129
if predicate(v) {

0 commit comments

Comments
 (0)