Skip to content

Commit c90aa1f

Browse files
authored
refact: ShouldNotExist is equal to ShouldNotBeNil (#805)
no need to compare zero nor blank value close #732 Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com> --------- Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
1 parent dce5a19 commit c90aa1f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

assertions/assertions.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,9 @@ func ShouldBeNil(actual interface{}, expected ...interface{}) error {
243243
return fmt.Errorf("expected: Nil but is wasn't")
244244
}
245245

246-
// ShouldNotExist receives a single parameter and ensures that it is nil, blank or zero value
246+
// ShouldNotExist receives a single parameter and ensures that it is nil
247247
func ShouldNotExist(actual interface{}, expected ...interface{}) error {
248-
if ShouldBeNil(actual) != nil ||
249-
ShouldBeBlank(actual) != nil ||
250-
ShouldBeZeroValue(actual) != nil {
248+
if ShouldBeNil(actual) != nil {
251249
return fmt.Errorf("expected not exist but it was")
252250
}
253251
return nil

0 commit comments

Comments
 (0)