Skip to content

Commit 5666f98

Browse files
grosseronsi
authored andcommitted
add To/ToNot/NotTo aliases for AsyncAssertion
1 parent 2251143 commit 5666f98

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

internal/async_assertion.go

+12
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,24 @@ func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDes
145145
return assertion.match(matcher, true, optionalDescription...)
146146
}
147147

148+
func (assertion *AsyncAssertion) To(matcher types.GomegaMatcher, optionalDescription ...any) bool {
149+
return assertion.Should(matcher, optionalDescription...)
150+
}
151+
148152
func (assertion *AsyncAssertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...any) bool {
149153
assertion.g.THelper()
150154
vetOptionalDescription("Asynchronous assertion", optionalDescription...)
151155
return assertion.match(matcher, false, optionalDescription...)
152156
}
153157

158+
func (assertion *AsyncAssertion) ToNot(matcher types.GomegaMatcher, optionalDescription ...any) bool {
159+
return assertion.ShouldNot(matcher, optionalDescription...)
160+
}
161+
162+
func (assertion *AsyncAssertion) NotTo(matcher types.GomegaMatcher, optionalDescription ...any) bool {
163+
return assertion.ShouldNot(matcher, optionalDescription...)
164+
}
165+
154166
func (assertion *AsyncAssertion) buildDescription(optionalDescription ...any) string {
155167
switch len(optionalDescription) {
156168
case 0:

types/types.go

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ type AsyncAssertion interface {
7070
Should(matcher GomegaMatcher, optionalDescription ...any) bool
7171
ShouldNot(matcher GomegaMatcher, optionalDescription ...any) bool
7272

73+
// equivalent to above
74+
To(matcher GomegaMatcher, optionalDescription ...any) bool
75+
ToNot(matcher GomegaMatcher, optionalDescription ...any) bool
76+
NotTo(matcher GomegaMatcher, optionalDescription ...any) bool
77+
7378
WithOffset(offset int) AsyncAssertion
7479
WithTimeout(interval time.Duration) AsyncAssertion
7580
WithPolling(interval time.Duration) AsyncAssertion

0 commit comments

Comments
 (0)